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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions dumb-jump.el
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,33 @@ 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?

:tests ("CREATE FUNCTION test(i INT) RETURNS INT"
"create or replace function test (int)"
"CREATE PROCEDURE test (OUT p INT)"
"create definer = 'test'@'localhost' procedure test()"))

(:type "table" :supports ("ag" "grep" "rg" "git-grep") :language "sql"
:regex "(CREATE|create)\\s+(.+?\\s+)?(TABLE|table)(\\s+(IF NOT EXISTS|if not exists))?\\s+JJJ\\b"
:tests ("CREATE TABLE test ("
"create temporary table if not exists test"
"CREATE TABLE IF NOT EXISTS test ("
"create global temporary table test"))

(:type "view" :supports ("ag" "grep" "rg" "git-grep") :language "sql"
:regex "(CREATE|create)\\s+(.+?\\s+)?(VIEW|view)\\s+JJJ\\b"
:tests ("CREATE VIEW test ("
"create sql security definer view test"
"CREATE OR REPLACE VIEW test AS foo"))

(:type "type" :supports ("ag" "grep" "rg" "git-grep") :language "sql"
:regex "(CREATE|create)\\s+(.+?\\s+)?(TYPE|type)\\s+JJJ\\b"
:tests ("CREATE TYPE test"
"CREATE OR REPLACE TYPE test AS foo ("
"create type test as ("))

;; systemverilog
(:type "type" :supports ("ag" "grep" "rg" "git-grep") :language "systemverilog"
:regex "\\s*class\\s+\\bJJJ\\b"
Expand Down Expand Up @@ -1212,6 +1239,7 @@ or most optimal searcher."
(:language "shell" :ext "ksh" :agtype nil :rgtype nil)
(:language "shell" :ext "tcsh" :agtype nil :rgtype nil)
(:language "sml" :ext "sml" :agtype "sml" :rgtype "sml")
(:language "sql" :ext "sql" :agtype "sql" :rgtype "sql")
(:language "swift" :ext "swift" :agtype nil :rgtype "swift")
(:language "tex" :ext "tex" :agtype "tex" :rgtype "tex")
(:language "elixir" :ext "ex" :agtype "elixir" :rgtype "elixir")
Expand Down