x

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.

more ▼

asked Oct 21, 2010 at 10:55 PM in Default

avatar image

Henrik Staun Poulsen
589 14 17 20

(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

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 - it highlights properly

  2. Program an add-in for SSMS yourself to do the hightlighting

  3. Open a connect ticket

more ▼

answered Oct 21, 2010 at 11:51 PM

avatar image

WilliamD
26.2k 18 35 48

yes, DATA_COMPRESSION is on my list too. Is it really true that these keywords are hardcoded into SSMS?

Oct 22, 2010 at 12:24 AM Henrik Staun Poulsen

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.

Oct 22, 2010 at 12:27 AM WilliamD

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...

Oct 22, 2010 at 12:55 AM Matt Whitfield ♦♦

@Matt - how did/do you go about solving this in you tool?

Oct 22, 2010 at 01:45 AM WilliamD

@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...

Oct 22, 2010 at 01:59 AM Matt Whitfield ♦♦
(comments are locked)
10|1200 characters needed characters left

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

more ▼

answered Oct 21, 2010 at 11:14 PM

avatar image

Cyborg
10.8k 37 55 51

  • for the research. Congrats on the 3k Cyborg. Glad to have you around. :)

Oct 22, 2010 at 12:32 AM Fatherjack ♦♦

Thank you FatherJack! Its my pleasure to be here with SQL Server legends! Learning every day from you guys!

Oct 22, 2010 at 12:39 AM Cyborg

@Cyborg - congrats!

Oct 22, 2010 at 12:54 AM Matt Whitfield ♦♦

Thank you Matt!

Oct 22, 2010 at 01:23 AM Cyborg
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x156
x5

asked: Oct 21, 2010 at 10:55 PM

Seen: 2145 times

Last Updated: Oct 21, 2010 at 10:55 PM

Copyright 2016 Redgate Software. Privacy Policy