Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SQL] MySQL and Goto Symbol #1742

Closed
bbars opened this issue Oct 14, 2018 · 5 comments · May be fixed by #3046
Closed

[SQL] MySQL and Goto Symbol #1742

bbars opened this issue Oct 14, 2018 · 5 comments · May be fixed by #3046

Comments

@bbars
Copy link

bbars commented Oct 14, 2018

Hello, I'm facing an issue:
image
As you can see, symbols index is wrong around CREATE TABLE IF NOT EXISTS table_name — ST thinks that table name is IF.
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.
Is seems, that > the SQL syntax that ships with Sublime is a bit old and perhaps doesn't cover the syntax for MySQL.
Then i've found the SQL.sublime-syntax file and played with its copy. It's not very hard to fix my problem with Symbols, but generally there are lots of syntax issues with MySQL.

Proposal: create separate syntax-highlighting config containing actual syntax definitions (as of MySQL 8.0 or at least version 5.7).

@hl1m14
Copy link

hl1m14 commented Dec 30, 2020

Hello, I have got the SQL.sublime-syntax file, but have no idea to play with it or its copy.
Could you present some specific steps on how to do that?
Thanks a lot !

@bbars
Copy link
Author

bbars commented Dec 31, 2020

@hl1m14, I had tried to play with custom package containing alternative language synax file (here's an example of syntax package: https://github.com/bortoloso/ORACLE_SUBLIME_SYNTAX). You can copy basic SQL sublime-syntax yml-file to your package directory and change it on your own. Don't forget to change its name value. Then you can edit syntax file in one tab and test it within another tab (change its syntax highlighting with Command palette). What you want is to detect specific scope properly (it seems it is an entity.name.*). All such occurrences are listed in a Symbol palette.
Also there's one magic hotkey that might help you while developing: ctrl+alt+shift+p — shows scopes under cursor caret.
Good luck and happy New year ;)

@jrappen
Copy link
Contributor

jrappen commented Sep 30, 2021

@bbars Could you see if #3046 fixes your issue and provide some feedback there if it doesn't? That PR should bring support for the most common SQL flavors to Sublime Text.

@michaelblyons
Copy link
Collaborator

Looks good on #3046. Code below for easier copy/paste:

drop table `contents`;
create table `contents` ();
create table if not exists `users` ();
create table if not exists `accounts` ();
create table if not exists `camps` ();

Funny as of this writing, GitHub's language parser doesn't do the right thing.

@bbars
Copy link
Author

bbars commented Nov 15, 2021

Yes, it's okay now. Thank you!

@bbars bbars closed this as completed Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants