-
Notifications
You must be signed in to change notification settings - Fork 149
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
Add basic support for jumping to functions in SQL files #221
Conversation
This is incredibly basic, and adds support for syntax generally defined by the SQL standard, with provisions for syntax exposed by popular database engines, such as MySQL, PostgreSQL, MS-SQL etc. Both upper-case and lower-case definitions will match. A better solution would'be been to allow for case-insensitive matching, but mixed case within the same word should be rare enough to not be a problem at this stage.
Closes #27 |
I tried my hand at implementing support for variables, but the syntax is somewhat different between database engines (at least, the ones I'm familiar with). I'll look at implementing support for jumping to tables, views, and types, however. |
@@ -1036,6 +1036,14 @@ or most optimal searcher." | |||
"functor test (T:TEST) =" | |||
"functor test(T:TEST) =")) | |||
|
|||
;; sql | |||
(:type "function" :supports ("ag" "grep" "rg" "git-grep") :language "sql" | |||
:regex "(CREATE|create)\\s+(.+?\\s+)?(FUNCTION|function|PROCEDURE|procedure)\\s+JJJ\\s*\\\(" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate having to define the two variants, but couldn't find support for declaring the regex as case-insensitive. Perhaps adding an additional key for additional options to be passed to the command would do?
The syntax for these should be generic enough to match definitions for most popular database engines.
I've added support for tables, views, and types. Review away! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
This is awesome. Thanks so much for the PR! |
Thanks for building this awesome package ;) |
This is incredibly basic, and adds support for syntax generally defined by the SQL standard, with
provisions for syntax exposed by popular database engines, such as MySQL, PostgreSQL, MS-SQL etc.
Both upper-case and lower-case definitions will match. A better solution would'be been to allow for
case-insensitive matching, but mixed case within the same word should be rare enough to not be a
problem at this stage.