question

Henrik Staun Poulsen avatar image
Henrik Staun Poulsen asked

highlighting all keywords

Is it possible to edit the list of keywords to highlight? In SSMS when you do "SELECT * FROM mytable", the SELECT and FROM are highlighted in blue. I would like to highlight the keyword "INCLUDE" when creating an index.
ssmsedit
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

WilliamD avatar image
WilliamD answered
Henrik - this is an SSMS inconsistancy fail. The same problem occurs when using the keyword "DATA_COMPRESSION" for index creation. Microsoft forgot to add a few words to the highlighting dictionary (or whatever it is called). If you really want it to be highlighted, you will have to: 1. Use [SQL Everywhere from Matt Whitfield][1] - it highlights properly 2. Program an add-in for SSMS yourself to do the hightlighting 3. [Open a connect ticket][2] [1]: http://www.atlantis-interactive.co.uk/products/sqleverywhere/default.aspx [2]: http://connect.microsoft.com/SQLServer/
7 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Henrik Staun Poulsen avatar image Henrik Staun Poulsen commented ·
yes, DATA_COMPRESSION is on my list too. Is it really true that these keywords are hardcoded into SSMS?
0 Likes 0 ·
WilliamD avatar image WilliamD commented ·
Those two keywords are pretty new (especially DATA_COMPRESSION), so it must be some sort of keyword list that they are not keeping up to date. It is only a small thing, but it leaves a bitter taste nonetheless.
0 Likes 0 ·
Matt Whitfield avatar image Matt Whitfield ♦♦ commented ·
To be honest, there's hundreds that SSMS misses out that SQLE adds in. Some are interesting - like 'NAME' which forms part of the AS EXTERNAL NAME clause. There isn't any documentation anywhere that *really* nails it - yes there are lists of keywords, but they don't really help with these sort...
0 Likes 0 ·
WilliamD avatar image WilliamD commented ·
@Matt - how did/do you go about solving this in you tool?
0 Likes 0 ·
Matt Whitfield avatar image Matt Whitfield ♦♦ commented ·
@WilliamD - It's all custom coded, so the syntax highlighting comes from the list of keywords that I have in a class specifically designed for picking out reserved words and pure reserved words. So reserved words are 'things that should be highlighted' and pure reserved words are 'things that should be highlighted and delimited if used as an identifier'. I really made that list through a lot of trial and error because the documentation is so poor...
0 Likes 0 ·
Show more comments
Cyborg avatar image
Cyborg answered
SQL Server is listing INCLUDE as an Identifier not a Keyword.So changing the font options will do the job, but the problem is that table names and column names are also identifiers, so doing same will change the Table names color and Column name color also... I never attempted it before until i saw this post Go to Tools -> Options -> Under environment on the left panel -> fonts & Colors -> Display Items -> Choose Identifier -> change item foreground color
4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Fatherjack avatar image Fatherjack ♦♦ commented ·
+1 for the research. Congrats on the 3k Cyborg. Glad to have you around. :)
1 Like 1 ·
Cyborg avatar image Cyborg commented ·
Thank you FatherJack! Its my pleasure to be here with SQL Server legends! Learning every day from you guys!
0 Likes 0 ·
Matt Whitfield avatar image Matt Whitfield ♦♦ commented ·
@Cyborg - congrats!
0 Likes 0 ·
Cyborg avatar image Cyborg commented ·
Thank you Matt!
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.