-
-
Notifications
You must be signed in to change notification settings - Fork 16
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 tags.scm queries #15
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
; Modules | ||
(module) @name @reference.module | ||
(import alias: (identifier) @name) @reference.module | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one's a bit hand-wavy too since the alias is just what the module will be called in this file, but this seems close enough that we should keep it. 👍 |
||
(remote_type_identifier | ||
module: (identifier) @name) @reference.module | ||
((field_access | ||
record: (identifier) @name) | ||
(#is-not? local)) @reference.module | ||
|
||
; Functions | ||
(function | ||
name: (identifier) @name) @definition.function | ||
(public_function | ||
name: (identifier) @name) @definition.function | ||
(external_function | ||
name: (identifier) @name) @definition.function | ||
(public_external_function | ||
name: (identifier) @name) @definition.function | ||
(unqualified_import (identifier) @name) @reference.function | ||
((function_call | ||
function: (identifier) @name) @reference.function | ||
(#is-not? local)) | ||
((field_access | ||
record: (identifier) @ignore | ||
field: (label) @name) | ||
(#is-not? local)) @reference.function | ||
((binary_expression | ||
operator: "|>" | ||
right: (identifier) @name) | ||
(#is-not? local)) @reference.function | ||
|
||
; Types | ||
(public_type_definition | ||
(type_name | ||
name: (type_identifier) @name)) @definition.type | ||
(type_definition | ||
(type_name | ||
name: (type_identifier) @name)) @definition.type | ||
(public_type_definition | ||
(type_constructors | ||
(type_constructor | ||
name: (type_identifier) @name))) @definition.type | ||
(type_definition | ||
(type_constructors | ||
(type_constructor | ||
name: (type_identifier) @name))) @definition.type | ||
Comment on lines
+39
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically a data constructor (here mislabeled as "type_constructor"; the actual type constructors are above as "type_name") isn't a type definition. That said, I'm open to keeping this if it has nice properties when integrating into GitHub or other systems. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm yeah I wasn't sure about this. I think this ends up working out well because you can jump between usages of data constructors and their definitions. The suffix in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think for now we'll keep it as-is 👍 |
||
(external_type | ||
(type_name | ||
name: (type_identifier) @name)) @definition.type | ||
(public_external_type | ||
(type_name | ||
name: (type_identifier) @name)) @definition.type | ||
|
||
(type_identifier) @name @reference.type |
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.
This will be a bit weird for GitHub, etc, since the
(module)
nodes' contents will look like "gleam/json" (etc), which is different from it's other references in this file (just "json"). That said, what you have here is technically correct 👍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.
Hmm yeah maybe we should be splitting the module tokens in an import? The basic code navigation is a bit fuzzy so I think some awkwardness with imports is ok. Elixir has some troubles too when it comes to
alias
es.