 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
KUGS4C
Joined: 07 Feb 2008 Posts: 3 Country: Kazakhstan |
|
Custom formatting doesn't work with "Code Formatting&qu |
|
Hiho,
The default for the INSERT-snippet in MSSQL is:
<code>
INSERT ...
(
...,
...
)
VALUES
(
...,
...
)
</code>
I've changed that to:
<code>
INSERT ...
(
...
, ...
)
VALUES
(
...
, ...
)
</code>
But it appears that the auto-completion code works seperately from the code formatting tool.
|
|
Thu Feb 07, 2008 3:42 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
That's right. Code snippets have nothing to do with auto-completion. To get a better idea of code snippets are, type cfetch and then press Ctrl+Enter, pick some table. To use your own INSERT snippet, type ins and then Ctrl+Enter
|
|
Thu Feb 07, 2008 3:58 pm |
|
 |
KUGS4C
Joined: 07 Feb 2008 Posts: 3 Country: Kazakhstan |
|
|
|
Thank you for your reply.
I would really have preferred if code completion were customized according to code formatting.
Perhaps this is something you consider interesting?
|
|
Fri Feb 08, 2008 1:09 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
I can offer a solution for that.
1. Disable code completion feature for DDL statements (uncheck Auto Expand SQL Code option)
2. Create a snippet with the name INSERT and set the activation key to be a space character. Set the snippet case-sensitive option to False.
3. In the snippet, code what you want it to do. You may use to use macro-variables like $COLUMNS$ or $OBJECT$. There are plenty of examples available in the existing pre-configured snippets.
Hope this helps.
|
|
Fri Feb 08, 2008 1:24 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
An alternative method is to use the reformat Ctrl+F11 function to convert the generated SQL as required, for example, to put commas in front.
|
|
Fri Feb 08, 2008 1:30 pm |
|
 |
KUGS4C
Joined: 07 Feb 2008 Posts: 3 Country: Kazakhstan |
|
|
|
 |
 |
Hope this helps. |
Thanks, but it seems the macro-variable $COLUMNS$ is expands to a comma-and-space separated list.
As in this example:
 |
 |
CREATE TABLE foo (id int, bar int)
INSERT INTO foo
(
id, bar
, id, bar
)
SELECT
|
, where I defined the snippet to be:
 |
 |
INSERT INTO $OBJECT$
(
$COLUMNS$
, $COLUMNS$
)
SELECT |
|
CTRL+F11 works, of course, but it is a tad tiring to have to press this key-combination after every statement.
Possibly the application could automatically run a reformat of the newly-generated code after it is inserted in the editor.
|
|
Sat Feb 09, 2008 8:14 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
At the time of the previous post I was thinking about
 |
 |
INSERT INTO $OBJECT$
(
,$COLUMNS$
)
SELECT | |
Yet, it appears that symbols adjacent to macro variables have special treatment. Basically they are treated as user-defined prefixes and/or suffixes for auto-generated object and column names. I am going to submit an enhancement request for snippets to support vertical column format and positional control for commas.
|
|
Sat Feb 09, 2008 11:35 am |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|