Sublime Forum

MySQL and Goto Symbol

#1

I’m facing an issue:

As you can see, symbols index is wrong around CREATE TABLE IF NOT EXISTS table_name — ST thinks that table name is IF.
Is there a way to fix it on my own? Maybe there’s a config for that?

0 Likes

#2

Also I’ve just found that CREATE ALGORITHM=MERGE VIEW view_name is out of index at all.
When I skip the ALGORITHM=MERGE declaration, it works fine.

0 Likes

#3

The symbols that appear in the symbol list come from a combination of the Syntax definition in use in the file and a set of Metadata rules that tell Sublime what parts of the syntax are supposed to be symbols.

The SQL syntax that ships with Sublime is a bit old and perhaps doesn’t cover the syntax for MySQL that you’re using here, which is probably the root of the issue. This area is a bit lacking, in part due to how each of the DB systems has a slightly different syntax that may or may not line up with what others can do, which makes a lowest-common-denominator type solution harder to get into a good state.

It’s possible to tweak the metadata rules that say what goes into the index, but if the syntax isn’t reliably detecting the contents of the file that is more likely to make things worse than it is to make them better.

0 Likes

#4

you may want to consider logging this at https://github.com/sublimehq/Packages/issues, the contributors there may have some ideas how to fix it without breaking things for other SQL dialects

2 Likes

#5

Thank you for your answers!
I’ve found the SQL.sublime-syntax file in the SQL.sublime-package file and played with its copy. There are quite simple regexps controlling the behavior of symbol indexing. It’s done, thanks!
Issue was logged to GitHub. It’s not so hard to update some syntax rules on my own and use it as a specific MySQL syntax highlighting package.

0 Likes