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

Add basic support for jumping to functions in SQL files #221

Merged
merged 2 commits into from
May 28, 2018

Conversation

deuill
Copy link
Contributor

@deuill deuill commented May 27, 2018

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.

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.
@deuill
Copy link
Contributor Author

deuill commented May 27, 2018

Closes #27

@deuill
Copy link
Contributor Author

deuill commented May 27, 2018

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.

@coveralls
Copy link

coveralls commented May 27, 2018

Coverage Status

Coverage remained the same at 97.072% when pulling 92bc9ef on deuill:master into 84d5f41 on jacktasia:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.072% when pulling 5e1188d on deuill:master into 84d5f41 on jacktasia:master.

@@ -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*\\\("
Copy link
Contributor Author

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.
@deuill
Copy link
Contributor Author

deuill commented May 27, 2018

I've added support for tables, views, and types. Review away!

Copy link
Owner

@jacktasia jacktasia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@jacktasia jacktasia merged commit 4ef0307 into jacktasia:master May 28, 2018
@jacktasia
Copy link
Owner

This is awesome. Thanks so much for the PR!

@deuill
Copy link
Contributor Author

deuill commented May 28, 2018

Thanks for building this awesome package ;)

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 this pull request may close these issues.

3 participants