You're on the right track; what you tried should work for you. If you get an error indicating that Sublime can't load the syntax, the most likely cause is that you deleted too much or altered the file in some other subtle way. sublime-syntax
files are YAML, and as such they're sensitive to things like indentation.
Note also that doing anything in the Packages folder directly is a Bad Idea; modifying a sublime-package
file works in the short term, but they're upgraded by removing them and replacing them. So unless you're the one that made the file in the first place, modifying the contents directly is a recipe for your change to be unceremoniously removed at some future point when you least expect it.
Making the following changes worked for me. This uses the OverrideAudit package to make the change (disclaimer: I am the package author). That will let you easily make the change in a safe way and also let you know if the underlying package ever gets upgraded.
- Install OverrideAudit
- From the Command Palette, select
OverrideAudit: Create Override
- Select the
SQL
package, then the SQL.sublime-syntax
file
- Use the find panel to search for
comments:
to see the context that contains all of the match patterns that represent comments. This should be around line 128, depending on what version of Sublime you're using
comments:
- match: "--"
scope: punctuation.definition.comment.sql
push:
- meta_scope: comment.line.double-dash.sql
- match: \n
pop: true
- match: "#"
scope: punctuation.definition.comment.sql
push:
- meta_scope: comment.line.number-sign.sql
- match: \n
pop: true
- match: /\*
scope: punctuation.definition.comment.sql
push:
- meta_scope: comment.block.c
- match: \*/
pop: true
- Delete just the match rule that matches the comment style you don't want; make sure that you don't modify any other lines before or after or change the indent. The result should look like this when you're done:
comments:
- match: "--"
scope: punctuation.definition.comment.sql
push:
- meta_scope: comment.line.double-dash.sql
- match: \n
pop: true
- match: /\*
scope: punctuation.definition.comment.sql
push:
- meta_scope: comment.block.c
- match: \*/
pop: true
- Save the syntax file.
As soon as you save the file, the change should take effect immediately. If you check the Sublime console with View > Show Console
you should see a line that says generating syntax summary
, which indicates that Sublime has seen and reloaded the syntax. If there's an error during this process, it will be displayed here.
After performing these steps, your sample text renders like this (using the Adaptive
theme and the Monokai
color scheme:
If you've previously modified the actual sublime-package
file this may not work. In such a case you may need to do a reinstall of Sublime to get the original file back; doing so won't remove your settings. Alternatively you can download the Windows portable version from the Sublime website (even if you're not using windows) and get the pristine package from there to replace the one you modified.