This repository has been archived by the owner on Sep 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SCIP ctags: add kinds for Kotlin (#57998)
Improved ctags kind output for Kotlin: * Split type into class, interface, object, and enum * Split variable into enumMember, constant, and property * Add type alias
- Loading branch information
1 parent
714aca7
commit 1df495a
Showing
5 changed files
with
140 additions
and
78 deletions.
There are no files selected for viewing
44 changes: 34 additions & 10 deletions
44
docker-images/syntax-highlighter/crates/scip-syntax/queries/kotlin/scip-tags.scm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,44 @@ | ||
(source_file | ||
(package_header | ||
(identifier) | ||
@descriptor.namespace)) @scope | ||
@descriptor.namespace @kind.package)) @scope | ||
|
||
(function_declaration | ||
(simple_identifier) @descriptor.method | ||
(function_body) @local) | ||
(simple_identifier) @descriptor.method @kind.method | ||
(function_body)? @local) | ||
|
||
(anonymous_function (_ (type_identifier) @descriptor.type . (type_identifier) @descriptor.method)) @local | ||
(class_declaration (type_identifier) @descriptor.type) @scope | ||
(object_declaration (type_identifier) @descriptor.type) @scope | ||
(class_parameter (simple_identifier) @descriptor.term) | ||
(enum_entry (simple_identifier) @descriptor.term) | ||
(property_declaration (variable_declaration (simple_identifier) @descriptor.term)) | ||
(anonymous_function) @local | ||
|
||
(multi_variable_declaration (variable_declaration (simple_identifier) @descriptor.term)) | ||
(class_declaration "interface" (type_identifier) @descriptor.type @kind.interface) @scope | ||
(class_declaration "enum" "class" (type_identifier) @descriptor.type @kind.enum) @scope | ||
|
||
;; Exclude enums from the 'class' kind | ||
((class_declaration | ||
("enum")? @_enum "class" | ||
(type_identifier) @descriptor.type @kind.class) | ||
(#filter! @_enum "enum")) @scope | ||
|
||
(object_declaration (type_identifier) @descriptor.type @kind.object) @scope | ||
(companion_object (type_identifier) @descriptor.type @kind.object) @scope | ||
|
||
(type_alias (type_identifier) @descriptor.type @kind.typealias) | ||
|
||
(class_parameter (simple_identifier) @descriptor.term @kind.property) | ||
(enum_entry (simple_identifier) @descriptor.term @kind.enummember) | ||
|
||
;; In the grammar, property_modifier always represents 'const' | ||
(property_declaration | ||
(modifiers (property_modifier)) | ||
(variable_declaration (simple_identifier) @descriptor.term @kind.constant)) | ||
|
||
;; Exclude constants from the 'property' kind | ||
((property_declaration | ||
(modifiers (property_modifier) @_const)? | ||
(variable_declaration (simple_identifier) @descriptor.term @kind.property)) | ||
(#filter! @_const "property_modifier")) | ||
|
||
(property_declaration | ||
(multi_variable_declaration (variable_declaration (simple_identifier) @descriptor.term @kind.property))) | ||
|
||
;; Future TODOs: | ||
;; - Should probably unescape `Escaped` simple identifiers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters