Author |
Message |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
[7.0.132 beta] FR - Pre-format queries prior pasting |
|
When building the query to be pasted (either by a snippet or by selecting objects from popup lists for different keywords such as SELECT, UPDATE, INSERT, etc.) SA should pre-format query according the active formatting rules prior pasting the result into the editor. This could save us the time and effort applying the formatting rules manually by of selecting the pasted text and pressing ctrl+F11 (or whichever hotkey is set for that feature).
|
|
Fri Jul 04, 2014 4:38 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
It sounds like you want an option for snippets to format the dynamically generated code from snippet before inserting it into the editor? Am I right?
|
|
Fri Jul 04, 2014 11:14 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
 |
 |
It sounds like you want an option for snippets to format the dynamically generated code from snippet before inserting it into the editor? Am I right? |
Well… yes, and no. Not only the code generated by snippets but those generated otherwise as well. When I select a table/view/whatever or a number of its columns after a keyword (SELECT, UPDATE, etc.) code is generated and it is formatted but not using the rules I defined. I'd like all code generated by SA to be preformatted according my redefined rules, not just out of blue. Conditionally, of course, there should be an option for this to turn on/off.
|
|
Fri Jul 04, 2014 11:48 am |
|
 |
sqltogo
Joined: 02 Jul 2014 Posts: 38 Country: Netherlands |
|
|
|
Although formatting is easy using Ctrl+F11, it sure is a good option to add to SA.
|
|
Fri Jul 04, 2014 3:24 pm |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
 |
 |
Although formatting is easy using Ctrl+F11, it sure is a good option to add to SA. |
It's not about simple formatting. Pressing Ctrl+F11 will format the whole content of the editor. You could, of course, select the newly inserted part and then press Ctrl+ F11 but the inserted part might occupy half of the screen or more for larger tables/views (I've got snippets that insert tens of thousands of characters spanning over several screens) and then selecting the fresh code fragment might not be that easy. Often the new script is inserted into a structure already several levels deep and formatted and applying formatting to the whole might be undesired (eg. it's formatted differently). Reminded me to another feature request I wanted to post :)
|
|
Fri Jul 04, 2014 4:21 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
There are a few technical difficulties with formatting code inserted from standard popups because "Pre-format queries prior pasting" does't work as described. Many popups insert code while interacting with the user, for example, when you use columns popup, you can select and deselect columns as needed and they are added and removed from the code in the editor right away, there is no "final" code to paste. When the popup is closed, the code is already there.
The situation with snippets is a bit different. In most cases the code is inserted after the selection is processed, so it can be reformatted before pasting into the editor, and yet there are a few cases when it is inserted during the interaction just like in case of the columns popup.
We are studying this request, and looking at how and if it can be implemented, yet I cannot promise it will be implemented in the current incarnation of popup and snippet processing functions.
Last edited by SysOp on Mon Jul 07, 2014 8:10 am; edited 1 time in total |
|
Sat Jul 05, 2014 12:48 pm |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
 |
 |
There are a few technical difficulties with formatting code inserted from standard popups because "Pre-format queries prior pasting" does't work as described. Many popups insert code while interacting with the user, for example, when you use columns popup, you can select and deselect columns as needed and they are added and removed from the code in the editor right away, there is no "final" code to paste. When the popup is closed, the code is already there.
|
Yes, that's the main reason I already created custom snippets to accomplish that in a formatted way, though it was severely limited until the introduction of multi-select capable $OBJECTS$ macro. The built-in popup for SELECT is the only one I still use. Now that we have the new $OBJECTS$ I can select more than one column and I could use that to create my own snippet for SELECT as well but the formatting suffers again.
 |
 |
We are studying this request, and looking at how and if it can be implemented, yet I cannot promise it will be implemented in the current incarnation of popup and snippet processing functions. |
Never mind, formatting custom snippet result would be fine on its own. Thank you for your time and effort though.
|
|
Mon Jul 07, 2014 4:15 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
I have submitted an enhancement request for formatting custom snippet result using user selected formatting style. This way different styles can be used with different snippets
|
|
Mon Jul 07, 2014 8:13 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
Thank you very much.
|
|
Mon Jul 07, 2014 8:21 am |
|
 |
|