diff --git a/docker-images/syntax-highlighter/Cargo.Bazel.lock b/docker-images/syntax-highlighter/Cargo.Bazel.lock index 550289dc7e2..d2ffa1c6ded 100644 --- a/docker-images/syntax-highlighter/Cargo.Bazel.lock +++ b/docker-images/syntax-highlighter/Cargo.Bazel.lock @@ -1,5 +1,5 @@ { - "checksum": "edfef804723dc794cca785f7de2dc8def338c0fa9829ef5b2afab75ca692c755", + "checksum": "9d730cdc37d6a005b78babdf0cbe8fa947cac02458b3f6faef35d0d5cc2aa41a", "crates": { "addr2line 0.20.0": { "name": "addr2line", @@ -9437,16 +9437,13 @@ }, "license": "Unlicense/MIT" }, - "scip 0.1.1": { + "scip 0.3.1": { "name": "scip", - "version": "0.1.1", + "version": "0.3.1", "repository": { - "Git": { - "remote": "https://github.com/sourcegraph/scip", - "commitish": { - "Rev": "1bf111e1cf175569970e95566b379fb2a548d70a" - }, - "strip_prefix": "bindings/rust" + "Http": { + "url": "https://crates.io/api/v1/crates/scip/0.3.1/download", + "sha256": "3e84d21062a3ba08d58870c8c36b0c005b2b2261c6ad1bf7042585427c781883" } }, "targets": [ @@ -9475,7 +9472,7 @@ "selects": {} }, "edition": "2021", - "version": "0.1.1" + "version": "0.3.1" }, "license": "Apache-2.0" }, @@ -9576,7 +9573,7 @@ "target": "rustc_hash" }, { - "id": "scip 0.1.1", + "id": "scip 0.3.1", "target": "scip" }, { @@ -9634,7 +9631,7 @@ "target": "protobuf" }, { - "id": "scip 0.1.1", + "id": "scip 0.3.1", "target": "scip" }, { @@ -9676,7 +9673,7 @@ "target": "lazy_static" }, { - "id": "scip 0.1.1", + "id": "scip 0.3.1", "target": "scip" }, { @@ -9696,7 +9693,7 @@ "target": "tree_sitter_cpp" }, { - "id": "tree-sitter-go 0.19.1", + "id": "tree-sitter-go 0.20.0", "target": "tree_sitter_go" }, { @@ -10150,7 +10147,7 @@ "target": "rocket" }, { - "id": "scip 0.1.1", + "id": "scip 0.3.1", "target": "scip" }, { @@ -11017,7 +11014,7 @@ "target": "rustyline" }, { - "id": "scip 0.1.1", + "id": "scip 0.3.1", "target": "scip" }, { @@ -12545,13 +12542,13 @@ }, "license": "MIT" }, - "tree-sitter-go 0.19.1": { + "tree-sitter-go 0.20.0": { "name": "tree-sitter-go", - "version": "0.19.1", + "version": "0.20.0", "repository": { "Http": { - "url": "https://crates.io/api/v1/crates/tree-sitter-go/0.19.1/download", - "sha256": "71967701c8214be4aa77e0260e98361e6fd71ceec1d9d03abb37a22c9f60d0ff" + "url": "https://crates.io/api/v1/crates/tree-sitter-go/0.20.0/download", + "sha256": "1ad6d11f19441b961af2fda7f12f5d0dac325f6d6de83836a1d3750018cc5114" } }, "targets": [ @@ -12586,14 +12583,14 @@ "target": "tree_sitter" }, { - "id": "tree-sitter-go 0.19.1", + "id": "tree-sitter-go 0.20.0", "target": "build_script_build" } ], "selects": {} }, "edition": "2018", - "version": "0.19.1" + "version": "0.20.0" }, "build_script_attrs": { "data_glob": [ diff --git a/docker-images/syntax-highlighter/Cargo.lock b/docker-images/syntax-highlighter/Cargo.lock index c09c2035ba0..ab9af9dbbfe 100644 --- a/docker-images/syntax-highlighter/Cargo.lock +++ b/docker-images/syntax-highlighter/Cargo.lock @@ -1708,8 +1708,9 @@ dependencies = [ [[package]] name = "scip" -version = "0.1.1" -source = "git+https://github.com/sourcegraph/scip?rev=1bf111e1cf175569970e95566b379fb2a548d70a#1bf111e1cf175569970e95566b379fb2a548d70a" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e84d21062a3ba08d58870c8c36b0c005b2b2261c6ad1bf7042585427c781883" dependencies = [ "protobuf", ] @@ -2316,9 +2317,9 @@ dependencies = [ [[package]] name = "tree-sitter-go" -version = "0.19.1" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71967701c8214be4aa77e0260e98361e6fd71ceec1d9d03abb37a22c9f60d0ff" +checksum = "1ad6d11f19441b961af2fda7f12f5d0dac325f6d6de83836a1d3750018cc5114" dependencies = [ "cc", "tree-sitter", diff --git a/docker-images/syntax-highlighter/Cargo.toml b/docker-images/syntax-highlighter/Cargo.toml index 076691e5876..6f67535eed2 100644 --- a/docker-images/syntax-highlighter/Cargo.toml +++ b/docker-images/syntax-highlighter/Cargo.toml @@ -61,7 +61,7 @@ tree-sitter = "0.20.9" tree-sitter-highlight = "0.20.1" # Since there is no version tag, we pin the dependency to a specific revision -scip = { git = "https://github.com/sourcegraph/scip", rev="1bf111e1cf175569970e95566b379fb2a548d70a" } +scip = "0.3.1" protobuf = "3" diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/queries/c_sharp/scip-tags.scm b/docker-images/syntax-highlighter/crates/scip-syntax/queries/c_sharp/scip-tags.scm index 83473586d78..29e2159d615 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/queries/c_sharp/scip-tags.scm +++ b/docker-images/syntax-highlighter/crates/scip-syntax/queries/c_sharp/scip-tags.scm @@ -1,20 +1,18 @@ -(using_directive (qualified_name) @descriptor.type) - -(class_declaration name: (_) @descriptor.type) @scope -(interface_declaration name: (_) @descriptor.type) @scope -(enum_declaration name: (_) @descriptor.type) @scope -(struct_declaration name: (_) @descriptor.type) @scope -(namespace_declaration name: (_) @descriptor.namespace) @scope +(class_declaration name: (_) @descriptor.type @kind.class) @scope +(interface_declaration name: (_) @descriptor.type @kind.interface) @scope +(enum_declaration name: (_) @descriptor.type @kind.enum) @scope +(struct_declaration name: (_) @descriptor.type @kind.struct) @scope +(namespace_declaration name: (_) @descriptor.namespace @kind.namespace) @scope ; Counter-intuitive name; it can actually be global -(local_function_statement name: (_) @descriptor.method) -(method_declaration name: (_) @descriptor.method) -(constructor_declaration name: (_) @descriptor.method) +(local_function_statement name: (_) @descriptor.method @kind.function) +(method_declaration name: (_) @descriptor.method @kind.method) +(constructor_declaration name: (_) @descriptor.method @kind.constructor) (block) @local -(field_declaration (variable_declaration (variable_declarator (identifier) @descriptor.term))) -(event_field_declaration (variable_declaration (variable_declarator (identifier) @descriptor.term))) -(property_declaration name: (identifier) @descriptor.term) -(enum_member_declaration name: (_) @descriptor.term) -(delegate_declaration name: (identifier) @descriptor.method) +(field_declaration (variable_declaration (variable_declarator (identifier) @descriptor.term @kind.field))) +(event_field_declaration (variable_declaration (variable_declarator (identifier) @kind.event @descriptor.term))) +(property_declaration name: (identifier) @descriptor.term @kind.property) +(enum_member_declaration name: (_) @descriptor.term @kind.enummember) +(delegate_declaration name: (identifier) @descriptor.method @kind.delegate) diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/queries/go/scip-tags.scm b/docker-images/syntax-highlighter/crates/scip-syntax/queries/go/scip-tags.scm index 179e31ea3b0..b9ed40c5985 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/queries/go/scip-tags.scm +++ b/docker-images/syntax-highlighter/crates/scip-syntax/queries/go/scip-tags.scm @@ -11,25 +11,47 @@ (parameter_declaration type: [(pointer_type (type_identifier) @descriptor.type) (type_identifier) @descriptor.type])) - name: (field_identifier) @descriptor.method @enclosing + name: (field_identifier) @descriptor.method @kind.method @enclosing body: (_) @local) -(type_declaration (type_spec name: (type_identifier) @descriptor.type)) @scope +(type_declaration + (type_spec + name: (type_identifier) @descriptor.type @kind.struct + type: (struct_type))) @scope + +(type_declaration + (type_spec + name: (type_identifier) @descriptor.type @kind.interface + type: (interface_type))) @scope + +(type_declaration + (type_spec + name: (type_identifier) @descriptor.type @kind.typealias + type: (type_identifier))) + +(type_declaration + (type_alias + name: (type_identifier) @descriptor.type @kind.typealias)) ;; For fields, we have nested struct definitions. ;; To get the scope properly ((field_declaration_list (field_declaration - name: (_) @descriptor.term + name: (_) @descriptor.term @kind.field type: (_) @_type) @enclosing) (#filter! @_type "interface_type" "struct_type")) (field_declaration_list (field_declaration - name: (_) @descriptor.type - type: [(interface_type) (struct_type)] @scope)) + name: (_) @descriptor.type @kind.interface + type: (interface_type) @scope)) + +(field_declaration_list + (field_declaration + name: (_) @descriptor.type @kind.struct + type: (struct_type) @scope)) (const_spec name: (_) @descriptor.term) @kind.constant @enclosing (import_spec name: (_) @descriptor.term) @enclosing -(method_spec name: (_) @descriptor.method) @enclosing -(var_spec name: (_) @descriptor.term) @enclosing +(method_spec name: (_) @descriptor.method @kind.methodspec) @enclosing +(var_spec name: (_) @descriptor.term @kind.variable) @enclosing diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/queries/javascript/scip-tags.scm b/docker-images/syntax-highlighter/crates/scip-syntax/queries/javascript/scip-tags.scm index 3de953d975b..6767fa882a4 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/queries/javascript/scip-tags.scm +++ b/docker-images/syntax-highlighter/crates/scip-syntax/queries/javascript/scip-tags.scm @@ -1,15 +1,16 @@ -(namespace_import (identifier) @descriptor.term) +(namespace_import (identifier) @descriptor.term @kind.variable) (named_imports - [(import_specifier alias: (_) @descriptor.term) - (import_specifier name: (_) @descriptor.term !alias)]) + (import_specifier alias: (_) @descriptor.term @kind.variable)) +(named_imports + (import_specifier name: (_) @descriptor.term @kind.variable !alias)) ;; Function / Generator declaration. ;; Don't think there is any reason to expose anything from within the body of the functions -(function_declaration (identifier) @descriptor.method body: (_) @local) -(generator_function_declaration (identifier) @descriptor.method body: (_) @local) +(function_declaration (identifier) @descriptor.method @kind.function body: (_) @local) +(generator_function_declaration (identifier) @descriptor.method @kind.function body: (_) @local) -(lexical_declaration (variable_declarator name: (identifier) @descriptor.term)) @scope -(variable_declaration (variable_declarator name: (identifier) @descriptor.term)) @scope +(lexical_declaration (variable_declarator name: (identifier) @descriptor.term @kind.variable)) @scope +(variable_declaration (variable_declarator name: (identifier) @descriptor.term @kind.variable)) @scope ;; {{{ Handle multiple scenarios of literal objects at top level ;; var X = { key: value } @@ -21,25 +22,31 @@ ;; (object (pair - key: (property_identifier) @descriptor.method + key: (property_identifier) @descriptor.method @kind.function value: [(function) (arrow_function)])) ((object (pair - key: (property_identifier) @descriptor.term + key: (property_identifier) @descriptor.term @kind.property value: (_) @_value_type)) (#filter! @_value_type "function" "arrow_function")) ;; }}} ;; class X { ... } (class_declaration - name: (_) @descriptor.type + name: (_) @descriptor.type @kind.class body: (_) @scope) (class_declaration (class_body [(method_definition - name: (_) @descriptor.method + name: (_) @descriptor.method @kind.method (#not-eq? @descriptor.method "constructor") + body: (_) @local)])) + +(class_declaration + (class_body + [(method_definition + name: (_) @descriptor.method @kind.constructor (#eq? @descriptor.method "constructor") body: (_) @local)])) [(if_statement) (while_statement) (for_statement) (do_statement) (call_expression)] @local diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/queries/kotlin/scip-tags.scm b/docker-images/syntax-highlighter/crates/scip-syntax/queries/kotlin/scip-tags.scm index 8a6944f8717..97c69dbd273 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/queries/kotlin/scip-tags.scm +++ b/docker-images/syntax-highlighter/crates/scip-syntax/queries/kotlin/scip-tags.scm @@ -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 diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/queries/python/scip-tags.scm b/docker-images/syntax-highlighter/crates/scip-syntax/queries/python/scip-tags.scm index a9d9ac87fc3..9bec77b3d89 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/queries/python/scip-tags.scm +++ b/docker-images/syntax-highlighter/crates/scip-syntax/queries/python/scip-tags.scm @@ -8,23 +8,22 @@ ; (import_statement name: (_) @descriptor.term) ; (import_from_statement name: (_) @descriptor.term) -(class_definition name: (_) @descriptor.type body: (_) @scope) +(class_definition name: (_) @descriptor.type @kind.class body: (_) @scope) (class_definition body: (block [(function_definition - name: (_) @descriptor.method @kind.field + name: (_) @descriptor.method @kind.method body: (_) @local) (decorated_definition definition: (function_definition - name: (_) @descriptor.method @kind.field + name: (_) @descriptor.method @kind.method body: (_) @local))])) - -(module (function_definition name: (_) @descriptor.method body: (_) @local)) -(module (decorated_definition (function_definition name: (_) @descriptor.method body: (_) @local))) +(module (function_definition name: (_) @descriptor.method @kind.function body: (_) @local)) +(module (decorated_definition (function_definition name: (_) @descriptor.method @kind.function body: (_) @local))) ;; foo = 1 -(expression_statement (assignment left: (identifier) @descriptor.term)) +(expression_statement (assignment left: (identifier) @descriptor.term @kind.variable)) ;; foo, bar, baz = 1, 2, 3 -(expression_statement (assignment left: (pattern_list (identifier) @descriptor.term))) +(expression_statement (assignment left: (pattern_list (identifier) @descriptor.term @kind.variable))) diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/queries/ruby/scip-tags.scm b/docker-images/syntax-highlighter/crates/scip-syntax/queries/ruby/scip-tags.scm index ce51f7486f3..daa1283a618 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/queries/ruby/scip-tags.scm +++ b/docker-images/syntax-highlighter/crates/scip-syntax/queries/ruby/scip-tags.scm @@ -1,27 +1,30 @@ -(assignment left: [(identifier) (constant)] @descriptor.term) -(class name: (_) @descriptor.type) @scope -(method name: (_) @descriptor.method) @local +(module name: (_) @descriptor.namespace @kind.module) @scope -(singleton_method name: (_) @descriptor.method) @local +(assignment left: (identifier) @descriptor.term @kind.variable) +(assignment left: (constant) @descriptor.term @kind.constant) +(class name: (_) @descriptor.type @kind.class) @scope +(method name: (_) @descriptor.method @kind.method) @local + +(singleton_method name: (_) @descriptor.method @kind.singletonmethod) @local [(do_block) (block) (unless) (case) (begin) (if) (while) (for)] @local ;; attr_accessor :bar -> bar, bar= ((call method: (identifier) @_attr_accessor - arguments: (argument_list (simple_symbol) @descriptor.method)) + arguments: (argument_list (simple_symbol) @descriptor.method @kind.accessor)) (#eq? @_attr_accessor "attr_accessor") (#transform! ":(.*)" "$1") (#transform! ":(.*)" "$1=")) ((call method: (identifier) @_attr_reader - arguments: (argument_list (simple_symbol) @descriptor.method)) + arguments: (argument_list (simple_symbol) @descriptor.method @kind.getter)) (#eq? @_attr_reader "attr_reader") (#transform! ":(.*)" "$1")) ((call method: (identifier) @_attr_writer - arguments: (argument_list (simple_symbol) @descriptor.method)) + arguments: (argument_list (simple_symbol) @descriptor.method @kind.setter)) (#eq? @_attr_writer "attr_writer") (#transform! ":(.*)" "$1=")) @@ -30,7 +33,7 @@ method: (identifier) @_alias_method arguments: (argument_list . - (simple_symbol) @descriptor.method)) + (simple_symbol) @descriptor.method @kind.methodalias)) (#eq? @_alias_method "alias_method") (#transform! ":(.*)" "$1")) diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/queries/rust/scip-tags.scm b/docker-images/syntax-highlighter/crates/scip-syntax/queries/rust/scip-tags.scm index 8cecc24944a..2876cd0958c 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/queries/rust/scip-tags.scm +++ b/docker-images/syntax-highlighter/crates/scip-syntax/queries/rust/scip-tags.scm @@ -1,30 +1,40 @@ ;; TODO: Could do @scope.ignore to ignore this as a definition (mod_item - name: (_) @descriptor.namespace) @scope + name: (_) @descriptor.namespace @kind.namespace) @scope (trait_item - name: (_) @descriptor.type) @scope + name: (_) @descriptor.type @kind.trait) @scope (impl_item - trait: [(generic_type type: (type_identifier) @descriptor.type) - (type_identifier) @descriptor.type]? + trait: (generic_type type: (type_identifier) @descriptor.type @kind.trait)) @scope - type: [(generic_type type: (type_identifier) @descriptor.type) - (type_identifier) @descriptor.type]) @scope +(impl_item + trait: (type_identifier) @descriptor.type @kind.trait) @scope + +(impl_item + type: (generic_type type: (type_identifier) @descriptor.type @kind.struct) + body: (_) @scope) + +(impl_item + type: (type_identifier) @descriptor.type @kind.struct + body: (_) @scope) ;; TODO: @local to stop traversal (function_signature_item - name: (identifier) @descriptor.method) + name: (identifier) @descriptor.method @kind.function) (function_item - name: (identifier) @descriptor.method body: (_) @local) + name: (identifier) @descriptor.method @kind.function body: (_) @local) (struct_item - name: (type_identifier) @descriptor.type) @scope + name: (type_identifier) @descriptor.type @kind.struct) @scope (field_declaration - name: (_) @descriptor.term) @enclosing + name: (_) @descriptor.term @kind.field) @enclosing -(enum_item name: (_) @descriptor.type) @scope -(enum_variant name: (_) @descriptor.term) +(enum_item name: (_) @descriptor.type @kind.enum) @scope +(enum_variant name: (_) @descriptor.term @kind.enummember) + +(const_item name: (_) @descriptor.term @kind.constant) +(static_item name: (_) @descriptor.term @kind.variable) diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/queries/typescript/scip-tags.scm b/docker-images/syntax-highlighter/crates/scip-syntax/queries/typescript/scip-tags.scm index 385e4946d22..01afebe9bb9 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/queries/typescript/scip-tags.scm +++ b/docker-images/syntax-highlighter/crates/scip-syntax/queries/typescript/scip-tags.scm @@ -1,20 +1,20 @@ ;;include javascript -(module name: (string (string_fragment) @descriptor.namespace) body: (_) @scope) +(module name: (string (string_fragment) @descriptor.namespace @kind.module) body: (_) @scope) -(interface_declaration name: (_) @descriptor.type body: (_) @scope) +(interface_declaration name: (_) @descriptor.type @kind.interface body: (_) @scope) (interface_declaration (object_type [ - (method_signature (property_identifier) @descriptor.method) - (property_signature (property_identifier) @descriptor.term)])) + (method_signature (property_identifier) @descriptor.method @kind.method) + (property_signature (property_identifier) @descriptor.term @kind.property)])) (class_declaration (class_body - [(public_field_definition name: (_) @descriptor.term)])) + [(public_field_definition name: (_) @descriptor.term @kind.property)])) -(enum_declaration name: (_) @descriptor.type body: (_) @scope) +(enum_declaration name: (_) @descriptor.type @kind.enum body: (_) @scope) (enum_declaration (enum_body - (property_identifier) @descriptor.term)) + (property_identifier) @descriptor.term @kind.property)) diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/src/lib.rs b/docker-images/syntax-highlighter/crates/scip-syntax/src/lib.rs index ea2eced085e..f36e8900650 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/src/lib.rs +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/lib.rs @@ -98,11 +98,12 @@ mod test { // But most tests should go here and just generate scip snapshots generate_tags_and_snapshot!(Scip, test_scip_zig, "globals.zig"); - generate_tags_and_snapshot!(Scip, test_scip_python, "globals.py"); + generate_tags_and_snapshot!(All, test_tags_python, test_scip_python, "globals.py"); generate_tags_and_snapshot!(Scip, test_scip_python_comp, "python-repo-comp.py"); + generate_tags_and_snapshot!(All, test_tags_ruby, test_scip_ruby, "ruby-globals.rb"); generate_tags_and_snapshot!(Scip, test_scip_java, "globals.java"); generate_tags_and_snapshot!(Scip, test_scip_typescript, "globals.ts"); - generate_tags_and_snapshot!(Scip, test_scip_csharp, "globals.cs"); + generate_tags_and_snapshot!(All, test_tags_csharp, test_scip_csharp, "globals.cs"); generate_tags_and_snapshot!(Scip, test_scip_scala, "globals.scala"); generate_tags_and_snapshot!(All, test_tags_kotlin, test_scip_kotlin, "globals.kt"); diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__ctags__test__ctags_runner_basic.snap b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__ctags__test__ctags_runner_basic.snap index 76e6f2897c0..4d00bf41e30 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__ctags__test__ctags_runner_basic.snap +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__ctags__test__ctags_runner_basic.snap @@ -3,8 +3,8 @@ source: crates/scip-syntax/src/ctags.rs expression: output --- {"_type":"program","name":"SCIP Ctags","version":"5.9.0"} -{"_type":"tag","name":"other","path":"main.rs","language":"rust","line":6,"kind":"method","scope":null} -{"_type":"tag","name":"something","path":"main.rs","language":"rust","line":5,"kind":"method","scope":null} -{"_type":"tag","name":"main","path":"main.rs","language":"rust","line":1,"kind":"method","scope":null} +{"_type":"tag","name":"other","path":"main.rs","language":"rust","line":6,"kind":"function","scope":null} +{"_type":"tag","name":"something","path":"main.rs","language":"rust","line":5,"kind":"function","scope":null} +{"_type":"tag","name":"main","path":"main.rs","language":"rust","line":1,"kind":"function","scope":null} {"_type":"completed","command":"generate-tags"} diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__globals__test__enclosing_range.snap b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__globals__test__enclosing_range.snap index 019707f61f0..34b5f83f3ff 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__globals__test__enclosing_range.snap +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__globals__test__enclosing_range.snap @@ -11,10 +11,10 @@ expression: dumped } type SomethingElse struct { -//^^^^^^^^^^^^^^^^^^^^^^^^^^^ 6:0..9:1 definition scip-ctags scopes_of_go/SomethingElse# +//^^^^^^^^^^^^^^^^^^^^^^^^^^^ 6:0..9:1 definition(Struct) scip-ctags scopes_of_go/SomethingElse# a int -// ^^^^^ definition scip-ctags scopes_of_go/SomethingElse#a. +// ^^^^^ definition(Field) scip-ctags scopes_of_go/SomethingElse#a. b string -// ^^^^^^^^ definition scip-ctags scopes_of_go/SomethingElse#b. +// ^^^^^^^^ definition(Field) scip-ctags scopes_of_go/SomethingElse#b. } diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_ctags-empty-scope.rs.snap b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_ctags-empty-scope.rs.snap index 52ff04576f1..f7b6281e704 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_ctags-empty-scope.rs.snap +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_ctags-empty-scope.rs.snap @@ -9,35 +9,56 @@ expression: dumped use scip_treesitter_languages::parsers::BundledParser; use walkdir::WalkDir; + static LANGUAGE: &str = "Rust"; +// ^^^^^^^^ definition scip-ctags LANGUAGE. + const THRESHOLD: i32 = 10; +// ^^^^^^^^^ definition(Constant) scip-ctags THRESHOLD. + + trait Yay {} +// ^^^ definition(Trait) scip-ctags Yay# + #[derive(Parser)] #[command(author, version, about, long_about = None)] struct Arguments { -// ^^^^^^^^^ definition scip-ctags Arguments# +// ^^^^^^^^^ definition(Struct) scip-ctags Arguments# /// Root directory to run local navigation over root_dir: String, -// ^^^^^^^^ definition scip-ctags Arguments#root_dir. +// ^^^^^^^^ definition(Field) scip-ctags Arguments#root_dir. + } + + impl Arguments { +// ^^^^^^^^^ definition(Struct) scip-ctags Arguments# + fn parse() {} +// ^^^^^ definition(Function) scip-ctags Arguments#parse(). + } + + impl Yay for Arguments { +// ^^^ definition(Trait) scip-ctags Yay# +// ^^^^^^^^^ definition(Struct) scip-ctags Yay#Arguments# + fn pog() {} +// ^^^ definition(Function) scip-ctags Yay#Arguments#pog(). } struct ParseTiming { -// ^^^^^^^^^^^ definition scip-ctags ParseTiming# +// ^^^^^^^^^^^ definition(Struct) scip-ctags ParseTiming# pub filepath: String, -// ^^^^^^^^ definition scip-ctags ParseTiming#filepath. +// ^^^^^^^^ definition(Field) scip-ctags ParseTiming#filepath. pub duration: std::time::Duration, -// ^^^^^^^^ definition scip-ctags ParseTiming#duration. +// ^^^^^^^^ definition(Field) scip-ctags ParseTiming#duration. } fn parse_files(dir: &Path) -> Vec { -// ^^^^^^^^^^^ definition scip-ctags parse_files(). +// ^^^^^^^^^^^ definition(Function) scip-ctags parse_files(). // TODO } fn measure_parsing() { -// ^^^^^^^^^^^^^^^ definition scip-ctags measure_parsing(). +// ^^^^^^^^^^^^^^^ definition(Function) scip-ctags measure_parsing(). // TODO } fn main() { -// ^^^^ definition scip-ctags main(). +// ^^^^ definition(Function) scip-ctags main(). // TODO } diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_example.go.snap b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_example.go.snap index 2e5cd7ee3d8..8a1dfdbb4d3 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_example.go.snap +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_example.go.snap @@ -20,10 +20,10 @@ expression: dumped // ^^^^^^^ definition(Function) scip-ctags example/Another(). type MyThing struct{} -// ^^^^^^^ definition scip-ctags example/MyThing# +// ^^^^^^^ definition(Struct) scip-ctags example/MyThing# func (m *MyThing) DoSomething() {} -// ^^^^^^^^^^^ definition scip-ctags example/MyThing#DoSomething(). +// ^^^^^^^^^^^ definition(Method) scip-ctags example/MyThing#DoSomething(). func (m MyThing) DoSomethingElse() {} -// ^^^^^^^^^^^^^^^ definition scip-ctags example/MyThing#DoSomethingElse(). +// ^^^^^^^^^^^^^^^ definition(Method) scip-ctags example/MyThing#DoSomethingElse(). diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_globals.cs.snap b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_globals.cs.snap index ddf3e5aee99..f819463a843 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_globals.cs.snap +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_globals.cs.snap @@ -3,19 +3,18 @@ source: crates/scip-syntax/src/lib.rs expression: dumped --- using System.Collections.Generic; -// ^^^^^^^^^^^^^^^^^^^^^^^^^^ definition scip-ctags `System.Collections.Generic`# public void SurprisinglyValid(string firstParam) { } -// ^^^^^^^^^^^^^^^^^ definition scip-ctags SurprisinglyValid(). +// ^^^^^^^^^^^^^^^^^ definition(Function) scip-ctags SurprisinglyValid(). namespace Longer.Namespace -// ^^^^^^^^^^^^^^^^ definition scip-ctags `Longer.Namespace`/ +// ^^^^^^^^^^^^^^^^ definition(Namespace) scip-ctags `Longer.Namespace`/ { public class Class -// ^^^^^ definition scip-ctags `Longer.Namespace`/Class# +// ^^^^^ definition(Class) scip-ctags `Longer.Namespace`/Class# { public int ExplicitGetterSetter -// ^^^^^^^^^^^^^^^^^^^^ definition scip-ctags `Longer.Namespace`/Class#ExplicitGetterSetter. +// ^^^^^^^^^^^^^^^^^^^^ definition(Property) scip-ctags `Longer.Namespace`/Class#ExplicitGetterSetter. { get { @@ -27,104 +26,104 @@ expression: dumped } } private int _val; -// ^^^^ definition scip-ctags `Longer.Namespace`/Class#_val. +// ^^^^ definition(Field) scip-ctags `Longer.Namespace`/Class#_val. protected virtual int ImplicitGetterSetter -// ^^^^^^^^^^^^^^^^^^^^ definition scip-ctags `Longer.Namespace`/Class#ImplicitGetterSetter. +// ^^^^^^^^^^^^^^^^^^^^ definition(Property) scip-ctags `Longer.Namespace`/Class#ImplicitGetterSetter. { get; set; } internal int ImplicitGetterPrivateSetter -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition scip-ctags `Longer.Namespace`/Class#ImplicitGetterPrivateSetter. +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition(Property) scip-ctags `Longer.Namespace`/Class#ImplicitGetterPrivateSetter. { get; private set; } public struct Coords -// ^^^^^^ definition scip-ctags `Longer.Namespace`/Class#Coords# +// ^^^^^^ definition(Struct) scip-ctags `Longer.Namespace`/Class#Coords# { public Coords(double x, double y) -// ^^^^^^ definition scip-ctags `Longer.Namespace`/Class#Coords#Coords(). +// ^^^^^^ definition(Constructor) scip-ctags `Longer.Namespace`/Class#Coords#Coords(). { X = x; Y = y; } public double X { get; } -// ^ definition scip-ctags `Longer.Namespace`/Class#Coords#X. +// ^ definition(Property) scip-ctags `Longer.Namespace`/Class#Coords#X. public double Y { get; } -// ^ definition scip-ctags `Longer.Namespace`/Class#Coords#Y. +// ^ definition(Property) scip-ctags `Longer.Namespace`/Class#Coords#Y. public override string ToString() => $"({X}, {Y})"; -// ^^^^^^^^ definition scip-ctags `Longer.Namespace`/Class#Coords#ToString(). +// ^^^^^^^^ definition(Method) scip-ctags `Longer.Namespace`/Class#Coords#ToString(). } delegate int MyDelegate(); -// ^^^^^^^^^^ definition scip-ctags `Longer.Namespace`/Class#MyDelegate(). +// ^^^^^^^^^^ definition(Delegate) scip-ctags `Longer.Namespace`/Class#MyDelegate(). public event ChangedEventHandler Changed; -// ^^^^^^^ definition scip-ctags `Longer.Namespace`/Class#Changed. +// ^^^^^^^ definition(Event) scip-ctags `Longer.Namespace`/Class#Changed. int _speed; -// ^^^^^^ definition scip-ctags `Longer.Namespace`/Class#_speed. +// ^^^^^^ definition(Field) scip-ctags `Longer.Namespace`/Class#_speed. public string PublicImplicitGetterSetter { get; set; } -// ^^^^^^^^^^^^^^^^^^^^^^^^^^ definition scip-ctags `Longer.Namespace`/Class#PublicImplicitGetterSetter. +// ^^^^^^^^^^^^^^^^^^^^^^^^^^ definition(Property) scip-ctags `Longer.Namespace`/Class#PublicImplicitGetterSetter. public string LambdaFunction => PublicImplicitGetterSetter + " " + _speed + " speed"; -// ^^^^^^^^^^^^^^ definition scip-ctags `Longer.Namespace`/Class#LambdaFunction. +// ^^^^^^^^^^^^^^ definition(Property) scip-ctags `Longer.Namespace`/Class#LambdaFunction. public enum Swag -// ^^^^ definition scip-ctags `Longer.Namespace`/Class#Swag# +// ^^^^ definition(Enum) scip-ctags `Longer.Namespace`/Class#Swag# { Shirt, -// ^^^^^ definition scip-ctags `Longer.Namespace`/Class#Swag#Shirt. +// ^^^^^ definition(EnumMember) scip-ctags `Longer.Namespace`/Class#Swag#Shirt. Sweater, -// ^^^^^^^ definition scip-ctags `Longer.Namespace`/Class#Swag#Sweater. +// ^^^^^^^ definition(EnumMember) scip-ctags `Longer.Namespace`/Class#Swag#Sweater. Socks = 42, -// ^^^^^ definition scip-ctags `Longer.Namespace`/Class#Swag#Socks. +// ^^^^^ definition(EnumMember) scip-ctags `Longer.Namespace`/Class#Swag#Socks. Pants -// ^^^^^ definition scip-ctags `Longer.Namespace`/Class#Swag#Pants. +// ^^^^^ definition(EnumMember) scip-ctags `Longer.Namespace`/Class#Swag#Pants. } public Swag SourcegraphSwag; -// ^^^^^^^^^^^^^^^ definition scip-ctags `Longer.Namespace`/Class#SourcegraphSwag. +// ^^^^^^^^^^^^^^^ definition(Field) scip-ctags `Longer.Namespace`/Class#SourcegraphSwag. [Flags] public enum ZigFeatureSet -// ^^^^^^^^^^^^^ definition scip-ctags `Longer.Namespace`/Class#ZigFeatureSet# +// ^^^^^^^^^^^^^ definition(Enum) scip-ctags `Longer.Namespace`/Class#ZigFeatureSet# { None = 0, -// ^^^^ definition scip-ctags `Longer.Namespace`/Class#ZigFeatureSet#None. +// ^^^^ definition(EnumMember) scip-ctags `Longer.Namespace`/Class#ZigFeatureSet#None. Errors = 1, -// ^^^^^^ definition scip-ctags `Longer.Namespace`/Class#ZigFeatureSet#Errors. +// ^^^^^^ definition(EnumMember) scip-ctags `Longer.Namespace`/Class#ZigFeatureSet#Errors. Comptime = 2, -// ^^^^^^^^ definition scip-ctags `Longer.Namespace`/Class#ZigFeatureSet#Comptime. +// ^^^^^^^^ definition(EnumMember) scip-ctags `Longer.Namespace`/Class#ZigFeatureSet#Comptime. BuildSystem = 4, -// ^^^^^^^^^^^ definition scip-ctags `Longer.Namespace`/Class#ZigFeatureSet#BuildSystem. +// ^^^^^^^^^^^ definition(EnumMember) scip-ctags `Longer.Namespace`/Class#ZigFeatureSet#BuildSystem. CoolCommunity = 8, -// ^^^^^^^^^^^^^ definition scip-ctags `Longer.Namespace`/Class#ZigFeatureSet#CoolCommunity. +// ^^^^^^^^^^^^^ definition(EnumMember) scip-ctags `Longer.Namespace`/Class#ZigFeatureSet#CoolCommunity. FullPackage = Errors | Comptime | BuildSystem | CoolCommunity -// ^^^^^^^^^^^ definition scip-ctags `Longer.Namespace`/Class#ZigFeatureSet#FullPackage. +// ^^^^^^^^^^^ definition(EnumMember) scip-ctags `Longer.Namespace`/Class#ZigFeatureSet#FullPackage. } public static void Syntax() {} -// ^^^^^^ definition scip-ctags `Longer.Namespace`/Class#Syntax(). +// ^^^^^^ definition(Method) scip-ctags `Longer.Namespace`/Class#Syntax(). } } namespace OneClass -// ^^^^^^^^ definition scip-ctags OneClass/ +// ^^^^^^^^ definition(Namespace) scip-ctags OneClass/ { public class TheClass -// ^^^^^^^^ definition scip-ctags OneClass/TheClass# +// ^^^^^^^^ definition(Class) scip-ctags OneClass/TheClass# { public Clickable ClickAction { get; set; } -// ^^^^^^^^^^^ definition scip-ctags OneClass/TheClass#ClickAction. +// ^^^^^^^^^^^ definition(Property) scip-ctags OneClass/TheClass#ClickAction. public string Text { get; set; } -// ^^^^ definition scip-ctags OneClass/TheClass#Text. +// ^^^^ definition(Property) scip-ctags OneClass/TheClass#Text. } } diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_globals.js.snap b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_globals.js.snap index 583cbed6159..171fc11aee6 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_globals.js.snap +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_globals.js.snap @@ -16,7 +16,7 @@ expression: dumped // Function declaration function functionDeclaration() { -// ^^^^^^^^^^^^^^^^^^^ definition scip-ctags functionDeclaration(). +// ^^^^^^^^^^^^^^^^^^^ definition(Function) scip-ctags functionDeclaration(). return "Hello, I'm a function declaration"; } @@ -34,9 +34,9 @@ expression: dumped // ES6 class declaration class ClassDeclaration { -// ^^^^^^^^^^^^^^^^ definition scip-ctags ClassDeclaration# +// ^^^^^^^^^^^^^^^^ definition(Class) scip-ctags ClassDeclaration# constructor() { -// ^^^^^^^^^^^ definition scip-ctags ClassDeclaration#constructor(). +// ^^^^^^^^^^^ definition(Constructor) scip-ctags ClassDeclaration#constructor(). this.message = "Hello, I'm a class declaration"; } } @@ -45,12 +45,12 @@ expression: dumped var objectDeclaration = { // ^^^^^^^^^^^^^^^^^ definition scip-ctags objectDeclaration. message: "Hello, I'm an object declaration" -// ^^^^^^^ definition scip-ctags objectDeclaration.message. +// ^^^^^^^ definition(Property) scip-ctags objectDeclaration.message. }; // Object constructor declaration function ObjectConstructor() { -// ^^^^^^^^^^^^^^^^^ definition scip-ctags ObjectConstructor(). +// ^^^^^^^^^^^^^^^^^ definition(Function) scip-ctags ObjectConstructor(). this.message = "Hello, I'm an object constructor"; } var objectConstructed = new ObjectConstructor(); @@ -66,13 +66,13 @@ expression: dumped // ES6 Generator Function declaration function* generatorFunction(){ -// ^^^^^^^^^^^^^^^^^ definition scip-ctags generatorFunction(). +// ^^^^^^^^^^^^^^^^^ definition(Function) scip-ctags generatorFunction(). yield "Hello, I'm a generator function"; } // ES6 Async Function declaration async function asyncFunction() { -// ^^^^^^^^^^^^^ definition scip-ctags asyncFunction(). +// ^^^^^^^^^^^^^ definition(Function) scip-ctags asyncFunction(). return "Hello, I'm an async function"; } @@ -86,77 +86,77 @@ expression: dumped // ES6 class declaration class ExampleClass { -// ^^^^^^^^^^^^ definition scip-ctags ExampleClass# +// ^^^^^^^^^^^^ definition(Class) scip-ctags ExampleClass# // Private field declaration (ES2020) #privateField = "Hello, I'm a private field"; // Private method declaration (ES2020) #privateMethod() { -// ^^^^^^^^^^^^^^ definition scip-ctags ExampleClass#`#privateMethod`(). +// ^^^^^^^^^^^^^^ definition(Method) scip-ctags ExampleClass#`#privateMethod`(). return "Hello, I'm a private method"; } // Class Constructor constructor(publicField, publicMethodParameter) { -// ^^^^^^^^^^^ definition scip-ctags ExampleClass#constructor(). +// ^^^^^^^^^^^ definition(Constructor) scip-ctags ExampleClass#constructor(). this.publicField = publicField; // Public Field this.publicMethodParameter = publicMethodParameter; } // Instance method instanceMethod() { -// ^^^^^^^^^^^^^^ definition scip-ctags ExampleClass#instanceMethod(). +// ^^^^^^^^^^^^^^ definition(Method) scip-ctags ExampleClass#instanceMethod(). return "Hello, I'm an instance method"; } // Static method static staticMethod() { -// ^^^^^^^^^^^^ definition scip-ctags ExampleClass#staticMethod(). +// ^^^^^^^^^^^^ definition(Method) scip-ctags ExampleClass#staticMethod(). return "Hello, I'm a static method"; } // Getter method get retrievedField() { -// ^^^^^^^^^^^^^^ definition scip-ctags ExampleClass#retrievedField(). +// ^^^^^^^^^^^^^^ definition(Method) scip-ctags ExampleClass#retrievedField(). return this.publicField; } // Setter method set updatedField(value) { -// ^^^^^^^^^^^^ definition scip-ctags ExampleClass#updatedField(). +// ^^^^^^^^^^^^ definition(Method) scip-ctags ExampleClass#updatedField(). this.publicField = value; } // Public method using private field and private method publicMethod() { -// ^^^^^^^^^^^^ definition scip-ctags ExampleClass#publicMethod(). +// ^^^^^^^^^^^^ definition(Method) scip-ctags ExampleClass#publicMethod(). return this.#privateMethod() + " " + this.#privateField; } // Method using arguments methodWithArgs(arg1, arg2) { -// ^^^^^^^^^^^^^^ definition scip-ctags ExampleClass#methodWithArgs(). +// ^^^^^^^^^^^^^^ definition(Method) scip-ctags ExampleClass#methodWithArgs(). return "Hello, I received " + arg1 + " and " + arg2; } // Method using rest parameters methodWithRestArgs(...args) { -// ^^^^^^^^^^^^^^^^^^ definition scip-ctags ExampleClass#methodWithRestArgs(). +// ^^^^^^^^^^^^^^^^^^ definition(Method) scip-ctags ExampleClass#methodWithRestArgs(). return "Hello, I received " + args.join(", "); } } // Prototype methods function MyClass() {} -// ^^^^^^^ definition scip-ctags MyClass(). +// ^^^^^^^ definition(Function) scip-ctags MyClass(). MyClass.prototype.myMethod = function() {}; // Generator function function* myGeneratorFunction() {} -// ^^^^^^^^^^^^^^^^^^^ definition scip-ctags myGeneratorFunction(). +// ^^^^^^^^^^^^^^^^^^^ definition(Function) scip-ctags myGeneratorFunction(). // Async function async function myAsyncFunction() {} -// ^^^^^^^^^^^^^^^ definition scip-ctags myAsyncFunction(). +// ^^^^^^^^^^^^^^^ definition(Function) scip-ctags myAsyncFunction(). diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_globals.kt.snap b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_globals.kt.snap index 044189b580e..bae8f235684 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_globals.kt.snap +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_globals.kt.snap @@ -2,109 +2,127 @@ source: crates/scip-syntax/src/lib.rs expression: dumped --- + package org.example +// ^^^^^^^^^^^ definition(Package) scip-ctags `org.example`/ + // Top level constant property const val PI = 3.14 -// ^^ definition scip-ctags PI. +// ^^ definition(Constant) scip-ctags `org.example`/PI. // Top level property with getter val version: String -// ^^^^^^^ definition scip-ctags version. +// ^^^^^^^ definition(Property) scip-ctags `org.example`/version. get() = "1.0.0" // Top level function fun printHello() { -// ^^^^^^^^^^ definition scip-ctags printHello(). +// ^^^^^^^^^^ definition(Method) scip-ctags `org.example`/printHello(). println("Hello, Kotlin!") } // Class with properties and methods class MyKotlinClass { -// ^^^^^^^^^^^^^ definition scip-ctags MyKotlinClass# +// ^^^^^^^^^^^^^ definition(Class) scip-ctags `org.example`/MyKotlinClass# var prop: String = "property" -// ^^^^ definition scip-ctags MyKotlinClass#prop. +// ^^^^ definition(Property) scip-ctags `org.example`/MyKotlinClass#prop. fun method() { -// ^^^^^^ definition scip-ctags MyKotlinClass#method(). +// ^^^^^^ definition(Method) scip-ctags `org.example`/MyKotlinClass#method(). println("This is a method") } } // Data class data class User(val name: String, val age: Int) -// ^^^^ definition scip-ctags User# -// ^^^^ definition scip-ctags User#name. -// ^^^ definition scip-ctags User#age. +// ^^^^ definition(Class) scip-ctags `org.example`/User# +// ^^^^ definition(Property) scip-ctags `org.example`/User#name. +// ^^^ definition(Property) scip-ctags `org.example`/User#age. // Enum class enum class Days { -// ^^^^ definition scip-ctags Days# +// ^^^^ definition(Enum) scip-ctags `org.example`/Days# MONDAY, -// ^^^^^^ definition scip-ctags Days#MONDAY. +// ^^^^^^ definition(EnumMember) scip-ctags `org.example`/Days#MONDAY. TUESDAY, -// ^^^^^^^ definition scip-ctags Days#TUESDAY. +// ^^^^^^^ definition(EnumMember) scip-ctags `org.example`/Days#TUESDAY. WEDNESDAY, -// ^^^^^^^^^ definition scip-ctags Days#WEDNESDAY. +// ^^^^^^^^^ definition(EnumMember) scip-ctags `org.example`/Days#WEDNESDAY. THURSDAY, -// ^^^^^^^^ definition scip-ctags Days#THURSDAY. +// ^^^^^^^^ definition(EnumMember) scip-ctags `org.example`/Days#THURSDAY. FRIDAY, -// ^^^^^^ definition scip-ctags Days#FRIDAY. +// ^^^^^^ definition(EnumMember) scip-ctags `org.example`/Days#FRIDAY. SATURDAY, -// ^^^^^^^^ definition scip-ctags Days#SATURDAY. +// ^^^^^^^^ definition(EnumMember) scip-ctags `org.example`/Days#SATURDAY. SUNDAY -// ^^^^^^ definition scip-ctags Days#SUNDAY. +// ^^^^^^ definition(EnumMember) scip-ctags `org.example`/Days#SUNDAY. } // Object (singleton) object MyObject { -// ^^^^^^^^ definition scip-ctags MyObject# +// ^^^^^^^^ definition(Object) scip-ctags `org.example`/MyObject# val property = "Object property" -// ^^^^^^^^ definition scip-ctags MyObject#property. +// ^^^^^^^^ definition(Property) scip-ctags `org.example`/MyObject#property. } // Interface interface MyInterface { -// ^^^^^^^^^^^ definition scip-ctags MyInterface# +// ^^^^^^^^^^^ definition(Interface) scip-ctags `org.example`/MyInterface# fun interfaceMethod(): String +// ^^^^^^^^^^^^^^^ definition(Method) scip-ctags `org.example`/MyInterface#interfaceMethod(). + } + + object SimpleSingleton { +// ^^^^^^^^^^^^^^^ definition(Object) scip-ctags `org.example`/SimpleSingleton# + val answer = 42; +// ^^^^^^ definition(Property) scip-ctags `org.example`/SimpleSingleton#answer. + fun greet(name: String) = "Hello, $name!" +// ^^^^^ definition(Method) scip-ctags `org.example`/SimpleSingleton#greet(). } // Type alias typealias UserList = List +// ^^^^^^^^ definition(TypeAlias) scip-ctags `org.example`/UserList# // Extension function fun String.print() { -// ^^^^^ definition scip-ctags print(). +// ^^^^^ definition(Method) scip-ctags `org.example`/print(). println(this) } // Sealed class sealed class Result { -// ^^^^^^ definition scip-ctags Result# +// ^^^^^^ definition(Class) scip-ctags `org.example`/Result# data class Success(val message: String) : Result() -// ^^^^^^^ definition scip-ctags Result#Success# -// ^^^^^^^ definition scip-ctags Result#Success#message. +// ^^^^^^^ definition(Class) scip-ctags `org.example`/Result#Success# +// ^^^^^^^ definition(Property) scip-ctags `org.example`/Result#Success#message. data class Error(val error: Exception) : Result() -// ^^^^^ definition scip-ctags Result#Error# -// ^^^^^ definition scip-ctags Result#Error#error. +// ^^^^^ definition(Class) scip-ctags `org.example`/Result#Error# +// ^^^^^ definition(Property) scip-ctags `org.example`/Result#Error#error. } // Inline class inline class Password(val value: String) -// ^^^^^^^^ definition scip-ctags Password# -// ^^^^^ definition scip-ctags Password#value. +// ^^^^^^^^ definition(Class) scip-ctags `org.example`/Password# +// ^^^^^ definition(Property) scip-ctags `org.example`/Password#value. // Companion object class MyClassWithCompanion { -// ^^^^^^^^^^^^^^^^^^^^ definition scip-ctags MyClassWithCompanion# - companion object { +// ^^^^^^^^^^^^^^^^^^^^ definition(Class) scip-ctags `org.example`/MyClassWithCompanion# + companion object ConstantCompanion { +// ^^^^^^^^^^^^^^^^^ definition(Object) scip-ctags `org.example`/MyClassWithCompanion#ConstantCompanion# const val CONSTANT = "Companion constant" -// ^^^^^^^^ definition scip-ctags MyClassWithCompanion#CONSTANT. +// ^^^^^^^^ definition(Constant) scip-ctags `org.example`/MyClassWithCompanion#ConstantCompanion#CONSTANT. } } fun `Escaped`() {} -// ^^^^^^^^^ definition scip-ctags . . . ``Escaped``(). +// ^^^^^^^^^ definition(Method) scip-ctags . . . `org.example`/``Escaped``(). + // Multi-variable declaration val (left, right) = directions() -// ^^^^ definition scip-ctags left. -// ^^^^^ definition scip-ctags right. +// ^^^^ definition(Property) scip-ctags `org.example`/left. +// ^^^^^ definition(Property) scip-ctags `org.example`/right. + + // Anonymous function + fun(x: Int, y: Int): Int = x + y diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_globals.py.snap b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_globals.py.snap index 9b40ddfcdc3..95269707bb2 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_globals.py.snap +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_globals.py.snap @@ -8,16 +8,16 @@ expression: dumped //^^^^ definition scip-ctags bruh. class Bruh(object): -// ^^^^ definition scip-ctags Bruh# +// ^^^^ definition(Class) scip-ctags Bruh# a: int // ^ definition scip-ctags Bruh#a. def __init__(self) -> None: -// ^^^^^^^^ definition scip-ctags Bruh#__init__(). +// ^^^^^^^^ definition(Method) scip-ctags Bruh#__init__(). pass def dab(): -// ^^^ definition scip-ctags Bruh#dab(). +// ^^^ definition(Method) scip-ctags Bruh#dab(). print("yay!") def more(): print("a function in a function!!") @@ -40,52 +40,52 @@ expression: dumped async def my_function(): -// ^^^^^^^^^^^ definition scip-ctags my_function(). +// ^^^^^^^^^^^ definition(Function) scip-ctags my_function(). pass class SomeAsyncStuffs: -// ^^^^^^^^^^^^^^^ definition scip-ctags SomeAsyncStuffs# +// ^^^^^^^^^^^^^^^ definition(Class) scip-ctags SomeAsyncStuffs# def __init__(self, obj): -// ^^^^^^^^ definition scip-ctags SomeAsyncStuffs#__init__(). +// ^^^^^^^^ definition(Method) scip-ctags SomeAsyncStuffs#__init__(). pass def __aiter__(self): -// ^^^^^^^^^ definition scip-ctags SomeAsyncStuffs#__aiter__(). +// ^^^^^^^^^ definition(Method) scip-ctags SomeAsyncStuffs#__aiter__(). pass async def __anext__(self): -// ^^^^^^^^^ definition scip-ctags SomeAsyncStuffs#__anext__(). +// ^^^^^^^^^ definition(Method) scip-ctags SomeAsyncStuffs#__anext__(). pass def does_nothing(f): -// ^^^^^^^^^^^^ definition scip-ctags does_nothing(). +// ^^^^^^^^^^^^ definition(Function) scip-ctags does_nothing(). return f def does_nothingwrapper(*args): -// ^^^^^^^^^^^^^^^^^^^ definition scip-ctags does_nothingwrapper(). +// ^^^^^^^^^^^^^^^^^^^ definition(Function) scip-ctags does_nothingwrapper(). return does_nothing @does_nothing def has_a_name(): -// ^^^^^^^^^^ definition scip-ctags has_a_name(). +// ^^^^^^^^^^ definition(Function) scip-ctags has_a_name(). pass @does_nothing def func02(): pass -// ^^^^^^ definition scip-ctags func02(). +// ^^^^^^ definition(Function) scip-ctags func02(). @does_nothing class ClassWithDecorators(object): -// ^^^^^^^^^^^^^^^^^^^ definition scip-ctags ClassWithDecorators# +// ^^^^^^^^^^^^^^^^^^^ definition(Class) scip-ctags ClassWithDecorators# @staticmethod def static_method(): -// ^^^^^^^^^^^^^ definition scip-ctags ClassWithDecorators#static_method(). +// ^^^^^^^^^^^^^ definition(Method) scip-ctags ClassWithDecorators#static_method(). print("hello") @classmethod def class_method(cls): -// ^^^^^^^^^^^^ definition scip-ctags ClassWithDecorators#class_method(). +// ^^^^^^^^^^^^ definition(Method) scip-ctags ClassWithDecorators#class_method(). print("hi from %s" % cls.__name__) @does_nothingwrapper(1, 2, 3) @@ -93,7 +93,7 @@ expression: dumped @ staticmethod @does_nothing def prints_something(): -// ^^^^^^^^^^^^^^^^ definition scip-ctags ClassWithDecorators#prints_something(). +// ^^^^^^^^^^^^^^^^ definition(Method) scip-ctags ClassWithDecorators#prints_something(). print("something") diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_globals.ts.snap b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_globals.ts.snap index 19e079516b3..d0d4508e244 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_globals.ts.snap +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_globals.ts.snap @@ -3,38 +3,38 @@ source: crates/scip-syntax/src/lib.rs expression: dumped --- class MyClass { -// ^^^^^^^ definition scip-ctags MyClass# +// ^^^^^^^ definition(Class) scip-ctags MyClass# public_field: number -// ^^^^^^^^^^^^ definition scip-ctags MyClass#public_field. +// ^^^^^^^^^^^^ definition(Property) scip-ctags MyClass#public_field. #private_field: number -// ^^^^^^^^^^^^^^ definition scip-ctags MyClass#`#private_field`. +// ^^^^^^^^^^^^^^ definition(Property) scip-ctags MyClass#`#private_field`. private also_private_field: number -// ^^^^^^^^^^^^^^^^^^ definition scip-ctags MyClass#also_private_field. +// ^^^^^^^^^^^^^^^^^^ definition(Property) scip-ctags MyClass#also_private_field. public_method() {} -// ^^^^^^^^^^^^^ definition scip-ctags MyClass#public_method(). +// ^^^^^^^^^^^^^ definition(Method) scip-ctags MyClass#public_method(). #private_method() {} -// ^^^^^^^^^^^^^^^ definition scip-ctags MyClass#`#private_method`(). +// ^^^^^^^^^^^^^^^ definition(Method) scip-ctags MyClass#`#private_method`(). private also_private_method() {} -// ^^^^^^^^^^^^^^^^^^^ definition scip-ctags MyClass#also_private_method(). +// ^^^^^^^^^^^^^^^^^^^ definition(Method) scip-ctags MyClass#also_private_method(). } interface MyInterface { -// ^^^^^^^^^^^ definition scip-ctags MyInterface# +// ^^^^^^^^^^^ definition(Interface) scip-ctags MyInterface# bruh: number, -// ^^^^ definition scip-ctags MyInterface#bruh. +// ^^^^ definition(Property) scip-ctags MyInterface#bruh. sayBruh(): void, -// ^^^^^^^ definition scip-ctags MyInterface#sayBruh(). +// ^^^^^^^ definition(Method) scip-ctags MyInterface#sayBruh(). } enum MyEnum { -// ^^^^^^ definition scip-ctags MyEnum# +// ^^^^^^ definition(Enum) scip-ctags MyEnum# zig, -// ^^^ definition scip-ctags MyEnum#zig. +// ^^^ definition(Property) scip-ctags MyEnum#zig. rust, -// ^^^^ definition scip-ctags MyEnum#rust. +// ^^^^ definition(Property) scip-ctags MyEnum#rust. go, -// ^^ definition scip-ctags MyEnum#go. +// ^^ definition(Property) scip-ctags MyEnum#go. } var global1 = 0; @@ -43,7 +43,7 @@ expression: dumped // ^^^^^^^ definition scip-ctags global2. function func() { -// ^^^^ definition scip-ctags func(). +// ^^^^ definition(Function) scip-ctags func(). var c; function inAnotherFunc() { var b; @@ -56,12 +56,12 @@ expression: dumped var myObject = { // ^^^^^^^^ definition scip-ctags myObject. myProperty: "value", -// ^^^^^^^^^^ definition scip-ctags myObject.myProperty. +// ^^^^^^^^^^ definition(Property) scip-ctags myObject.myProperty. myMethod: function() {}, -// ^^^^^^^^ definition scip-ctags myObject.myMethod(). +// ^^^^^^^^ definition(Function) scip-ctags myObject.myMethod(). myArrow: () => {}, -// ^^^^^^^ definition scip-ctags myObject.myArrow(). +// ^^^^^^^ definition(Function) scip-ctags myObject.myArrow(). }; diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_go-globals.go.snap b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_go-globals.go.snap index f349bd70fdc..1528ae65bc0 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_go-globals.go.snap +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_go-globals.go.snap @@ -10,40 +10,45 @@ expression: dumped // Group is a collection of goroutines which return errors that need to be // coalesced. type Group struct { -// ^^^^^ definition scip-ctags multierror/Group# +// ^^^^^ definition(Struct) scip-ctags multierror/Group# mutex sync.Mutex -// ^^^^^ definition scip-ctags multierror/Group#mutex. +// ^^^^^ definition(Field) scip-ctags multierror/Group#mutex. err *Error -// ^^^ definition scip-ctags multierror/Group#err. +// ^^^ definition(Field) scip-ctags multierror/Group#err. wg sync.WaitGroup -// ^^ definition scip-ctags multierror/Group#wg. +// ^^ definition(Field) scip-ctags multierror/Group#wg. nested struct { -// ^^^^^^ definition scip-ctags multierror/Group#nested# +// ^^^^^^ definition(Struct) scip-ctags multierror/Group#nested# inner bool -// ^^^^^ definition scip-ctags multierror/Group#nested#inner. +// ^^^^^ definition(Field) scip-ctags multierror/Group#nested#inner. } innerface interface { -// ^^^^^^^^^ definition scip-ctags multierror/Group#innerface# +// ^^^^^^^^^ definition(Interface) scip-ctags multierror/Group#innerface# Another() bool -// ^^^^^^^ definition scip-ctags multierror/Group#innerface#Another(). +// ^^^^^^^ definition(MethodSpecification) scip-ctags multierror/Group#innerface#Another(). } } type SomeInterface interface { -// ^^^^^^^^^^^^^ definition scip-ctags multierror/SomeInterface# +// ^^^^^^^^^^^^^ definition(Interface) scip-ctags multierror/SomeInterface# Something() bool -// ^^^^^^^^^ definition scip-ctags multierror/SomeInterface#Something(). +// ^^^^^^^^^ definition(MethodSpecification) scip-ctags multierror/SomeInterface#Something(). Incredible() int -// ^^^^^^^^^^ definition scip-ctags multierror/SomeInterface#Incredible(). +// ^^^^^^^^^^ definition(MethodSpecification) scip-ctags multierror/SomeInterface#Incredible(). } + type TypeDef uint8 +// ^^^^^^^ definition(TypeAlias) scip-ctags multierror/TypeDef# + type TypeAlias = uint8 +// ^^^^^^^^^ definition(TypeAlias) scip-ctags multierror/TypeAlias# + // Go calls the given function in a new goroutine. // // If the function returns an error it is added to the group multierror which // is returned by Wait. func (g *Group) Go(f func() error) { -// ^^ definition scip-ctags multierror/Group#Go(). +// ^^ definition(Method) scip-ctags multierror/Group#Go(). g.wg.Add(1) go func() { @@ -60,7 +65,7 @@ expression: dumped // Wait blocks until all function calls from the Go method have returned, then // returns the multierror. func (g *Group) Wait() *Error { -// ^^^^ definition scip-ctags multierror/Group#Wait(). +// ^^^^ definition(Method) scip-ctags multierror/Group#Wait(). g.wg.Wait() g.mutex.Lock() defer g.mutex.Unlock() diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_internal_go.go.snap b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_internal_go.go.snap index 1c2213d08ef..f420a542a0b 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_internal_go.go.snap +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_internal_go.go.snap @@ -13,15 +13,15 @@ expression: dumped // constructor being called once. The arguments to the call will be the // first call to occur. All callers will receive the same return values. type MemoizedConstructorWithArg[A, T any] struct { -// ^^^^^^^^^^^^^^^^^^^^^^^^^^ definition scip-ctags memo/MemoizedConstructorWithArg# +// ^^^^^^^^^^^^^^^^^^^^^^^^^^ definition(Struct) scip-ctags memo/MemoizedConstructorWithArg# ctor func(A) (T, error) -// ^^^^ definition scip-ctags memo/MemoizedConstructorWithArg#ctor. +// ^^^^ definition(Field) scip-ctags memo/MemoizedConstructorWithArg#ctor. value T -// ^^^^^ definition scip-ctags memo/MemoizedConstructorWithArg#value. +// ^^^^^ definition(Field) scip-ctags memo/MemoizedConstructorWithArg#value. err error -// ^^^ definition scip-ctags memo/MemoizedConstructorWithArg#err. +// ^^^ definition(Field) scip-ctags memo/MemoizedConstructorWithArg#err. once sync.Once -// ^^^^ definition scip-ctags memo/MemoizedConstructorWithArg#once. +// ^^^^ definition(Field) scip-ctags memo/MemoizedConstructorWithArg#once. } // NewMemoizedConstructor memoizes the given constructor @@ -33,8 +33,6 @@ expression: dumped // Init ensures that the given constructor has been called exactly // once, then returns the constructor's result value and error. func (m *MemoizedConstructorWithArg[A, T]) Init(arg A) (T, error) { -// ^^^^ definition scip-ctags memo/T#Init(). -// ^^^^ definition scip-ctags memo/A#Init(). m.once.Do(func() { m.value, m.err = m.ctor(arg) }) return m.value, m.err } diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_javascript-object.js.snap b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_javascript-object.js.snap index c5dcf4d4c48..62423a82f9b 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_javascript-object.js.snap +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_javascript-object.js.snap @@ -5,12 +5,12 @@ expression: dumped var myObject = { // ^^^^^^^^ definition scip-ctags myObject. myProperty: "value", -// ^^^^^^^^^^ definition scip-ctags myObject.myProperty. +// ^^^^^^^^^^ definition(Property) scip-ctags myObject.myProperty. myMethod: function() {}, -// ^^^^^^^^ definition scip-ctags myObject.myMethod(). +// ^^^^^^^^ definition(Function) scip-ctags myObject.myMethod(). myArrow: () => {}, -// ^^^^^^^ definition scip-ctags myObject.myArrow(). +// ^^^^^^^ definition(Function) scip-ctags myObject.myArrow(). }; diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_python-repo-comp.py.snap b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_python-repo-comp.py.snap index be10bf49af2..92724177901 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_python-repo-comp.py.snap +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_python-repo-comp.py.snap @@ -25,7 +25,7 @@ expression: dumped # A custom socket for the sock parameter to RemoteCollector's allows one to # specify e.g. a TLS socket. class RemoteCollector: -// ^^^^^^^^^^^^^^^ definition scip-ctags RemoteCollector# +// ^^^^^^^^^^^^^^^ definition(Class) scip-ctags RemoteCollector# # sock is literally the socket that is used to communicate with the remote # collector. sock = None @@ -35,19 +35,19 @@ expression: dumped // ^^^^^^ definition scip-ctags RemoteCollector#_debug. def __init__(self, sock=None, debug=False): -// ^^^^^^^^ definition scip-ctags RemoteCollector#__init__(). +// ^^^^^^^^ definition(Method) scip-ctags RemoteCollector#__init__(). self.sock = sock self._debug = debug def _log(self, *args): -// ^^^^ definition scip-ctags RemoteCollector#_log(). +// ^^^^ definition(Method) scip-ctags RemoteCollector#_log(). if self._debug: print "appdash: %s" % (" ".join(args)) # connect connects the underlying socket to the given address, waiting at # max for the given timeout before raising an exception. def connect(self, host="localhost", port=7701, timeout=10): -// ^^^^^^^ definition scip-ctags RemoteCollector#connect(). +// ^^^^^^^ definition(Method) scip-ctags RemoteCollector#connect(). # Use the given socket, or create a new one. if self.sock is None: self.sock = socket.create_connection((host, port), timeout=timeout) @@ -60,7 +60,7 @@ expression: dumped # function does not return until all have been sent out or an exception has # occured (e.g. disconnection). def collect(self, spanID, *annotations): -// ^^^^^^^ definition scip-ctags RemoteCollector#collect(). +// ^^^^^^^ definition(Method) scip-ctags RemoteCollector#collect(). self._log("collecting", str(len(annotations)), "annotations for", str(spanID)) packet = encode._collect(spanID, *annotations) buf = encode._msg(packet) @@ -74,7 +74,7 @@ expression: dumped # close closes the underlying socket. def close(self): -// ^^^^^ definition scip-ctags RemoteCollector#close(). +// ^^^^^ definition(Method) scip-ctags RemoteCollector#close(). self.sock.close() self.sock = None diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_ruby-globals.rb.snap b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_ruby-globals.rb.snap new file mode 100644 index 00000000000..32f7e79273c --- /dev/null +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_ruby-globals.rb.snap @@ -0,0 +1,101 @@ +--- +source: crates/scip-syntax/src/lib.rs +expression: dumped +--- + SOME_CONSTANT = 2.718 +//^^^^^^^^^^^^^ definition(Constant) scip-ctags SOME_CONSTANT. + + if true + a = 1 + elsif false + b = 2 + else + c = 3 + end + + (1..5).each do |counter| + z = 3 + end + + for counter in 1..5 + y = 10 + end + + counter = 1 +//^^^^^^^ definition scip-ctags counter. + while counter <= 5 do + no = true + counter += 1 + end + + begin + raise NoMemoryError, 'Z.' + rescue NoMemoryError => exception_variable + puts 'A', exception_variable + rescue RuntimeError => other_exception_variable + puts 'K' + else + puts 'L' + ensure + puts 'O' + end + + grade = 42 +//^^^^^ definition scip-ctags grade. + case grade + when 0.100 + shouldntgetcaptured = true + puts 'you got a grade i guess' + end + + module MyModule +// ^^^^^^^^ definition(Module) scip-ctags MyModule/ + def self.abc(base) +// ^^^ definition(SingletonMethod) scip-ctags MyModule/abc(). + end + + class MyClass +// ^^^^^^^ definition(Class) scip-ctags MyModule/MyClass# + def yay +// ^^^ definition(Method) scip-ctags MyModule/MyClass#yay(). + end + + def self.woo(base) +// ^^^ definition(SingletonMethod) scip-ctags MyModule/MyClass#woo(). + end + end + end + + class Foo +// ^^^ definition(Class) scip-ctags Foo# + attr_accessor :bar +// ^^^^ definition(Accessor) scip-ctags Foo#`bar=`(). +// ^^^^ definition(Accessor) scip-ctags Foo#bar(). + attr_reader :baz +// ^^^^ definition(Getter) scip-ctags Foo#baz(). + attr_writer :qux +// ^^^^ definition(Setter) scip-ctags Foo#`qux=`(). + end + + class Aliased +// ^^^^^^^ definition(Class) scip-ctags Aliased# + def bar +// ^^^ definition(Method) scip-ctags Aliased#bar(). + end + + alias_method :baz, :bar +// ^^^^ definition(MethodAlias) scip-ctags Aliased#baz(). + end + + class Parental +// ^^^^^^^^ definition(Class) scip-ctags Parental# + def parental_func() +// ^^^^^^^^^^^^^ definition(Method) scip-ctags Parental#parental_func(). + end + end + + class Composed +// ^^^^^^^^ definition(Class) scip-ctags Composed# + include Parental + end + diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_scopes.rs.snap b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_scopes.rs.snap index 43decf4d7da..082debdfb7f 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_scopes.rs.snap +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_scopes.rs.snap @@ -3,46 +3,49 @@ source: crates/scip-syntax/src/lib.rs expression: dumped --- pub trait Tag { -// ^^^ definition scip-ctags Tag# +// ^^^ definition(Trait) scip-ctags Tag# // This is a pretty big thing // And some more things here fn name(&self) -> &str; -// ^^^^ definition scip-ctags Tag#name(). +// ^^^^ definition(Function) scip-ctags Tag#name(). } mod namespace { -// ^^^^^^^^^ definition scip-ctags namespace/ +// ^^^^^^^^^ definition(Namespace) scip-ctags namespace/ mod nested { -// ^^^^^^ definition scip-ctags namespace/nested/ +// ^^^^^^ definition(Namespace) scip-ctags namespace/nested/ mod even_more_nested { -// ^^^^^^^^^^^^^^^^ definition scip-ctags namespace/nested/even_more_nested/ +// ^^^^^^^^^^^^^^^^ definition(Namespace) scip-ctags namespace/nested/even_more_nested/ pub struct CoolStruct {} -// ^^^^^^^^^^ definition scip-ctags namespace/nested/even_more_nested/CoolStruct# +// ^^^^^^^^^^ definition(Struct) scip-ctags namespace/nested/even_more_nested/CoolStruct# impl Tag for CoolStruct { -// ^^^^^^^^^^ definition scip-ctags namespace/nested/even_more_nested/Tag#CoolStruct# +// ^^^ definition(Trait) scip-ctags namespace/nested/even_more_nested/Tag# +// ^^^^^^^^^^ definition(Struct) scip-ctags namespace/nested/even_more_nested/Tag#CoolStruct# fn name(&self) -> &str {} -// ^^^^ definition scip-ctags namespace/nested/even_more_nested/Tag#CoolStruct#name(). +// ^^^^ definition(Function) scip-ctags namespace/nested/even_more_nested/Tag#CoolStruct#name(). } } } } fn something() {} -// ^^^^^^^^^ definition scip-ctags something(). +// ^^^^^^^^^ definition(Function) scip-ctags something(). impl X for Y {} -// ^ definition scip-ctags X#Y# +// ^ definition(Trait) scip-ctags X# +// ^ definition(Struct) scip-ctags X#Y# impl X for Y> {} -// ^ definition scip-ctags X#Y# +// ^ definition(Trait) scip-ctags X# +// ^ definition(Struct) scip-ctags X#Y# enum MyEnum { -// ^^^^^^ definition scip-ctags MyEnum# +// ^^^^^^ definition(Enum) scip-ctags MyEnum# Dog, -// ^^^ definition scip-ctags MyEnum#Dog. +// ^^^ definition(EnumMember) scip-ctags MyEnum#Dog. Cat(u8), -// ^^^ definition scip-ctags MyEnum#Cat. +// ^^^ definition(EnumMember) scip-ctags MyEnum#Cat. Bat(String), -// ^^^ definition scip-ctags MyEnum#Bat. +// ^^^ definition(EnumMember) scip-ctags MyEnum#Bat. } diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_ctags-empty-scope.rs.snap b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_ctags-empty-scope.rs.snap index 2243d0388be..49b7c9fe378 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_ctags-empty-scope.rs.snap +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_ctags-empty-scope.rs.snap @@ -2,12 +2,18 @@ source: crates/scip-syntax/src/lib.rs expression: "String::from_utf8_lossy(buf_writer.buffer())" --- -{"_type":"tag","name":"Arguments","path":"ctags-empty-scope.rs","language":"rust","line":10,"kind":"type","scope":null} -{"_type":"tag","name":"root_dir","path":"ctags-empty-scope.rs","language":"rust","line":12,"kind":"variable","scope":"Arguments"} -{"_type":"tag","name":"ParseTiming","path":"ctags-empty-scope.rs","language":"rust","line":15,"kind":"type","scope":null} -{"_type":"tag","name":"duration","path":"ctags-empty-scope.rs","language":"rust","line":17,"kind":"variable","scope":"ParseTiming"} -{"_type":"tag","name":"filepath","path":"ctags-empty-scope.rs","language":"rust","line":16,"kind":"variable","scope":"ParseTiming"} -{"_type":"tag","name":"main","path":"ctags-empty-scope.rs","language":"rust","line":28,"kind":"method","scope":null} -{"_type":"tag","name":"measure_parsing","path":"ctags-empty-scope.rs","language":"rust","line":24,"kind":"method","scope":null} -{"_type":"tag","name":"parse_files","path":"ctags-empty-scope.rs","language":"rust","line":20,"kind":"method","scope":null} +{"_type":"tag","name":"Yay","path":"ctags-empty-scope.rs","language":"rust","line":11,"kind":"trait","scope":null} +{"_type":"tag","name":"Arguments","path":"ctags-empty-scope.rs","language":"rust","line":15,"kind":"struct","scope":null} +{"_type":"tag","name":"root_dir","path":"ctags-empty-scope.rs","language":"rust","line":17,"kind":"field","scope":"Arguments"} +{"_type":"tag","name":"parse","path":"ctags-empty-scope.rs","language":"rust","line":21,"kind":"function","scope":"Arguments"} +{"_type":"tag","name":"Arguments","path":"ctags-empty-scope.rs","language":"rust","line":24,"kind":"struct","scope":"Yay"} +{"_type":"tag","name":"pog","path":"ctags-empty-scope.rs","language":"rust","line":25,"kind":"function","scope":"Yay.Arguments"} +{"_type":"tag","name":"ParseTiming","path":"ctags-empty-scope.rs","language":"rust","line":28,"kind":"struct","scope":null} +{"_type":"tag","name":"duration","path":"ctags-empty-scope.rs","language":"rust","line":30,"kind":"field","scope":"ParseTiming"} +{"_type":"tag","name":"filepath","path":"ctags-empty-scope.rs","language":"rust","line":29,"kind":"field","scope":"ParseTiming"} +{"_type":"tag","name":"main","path":"ctags-empty-scope.rs","language":"rust","line":41,"kind":"function","scope":null} +{"_type":"tag","name":"measure_parsing","path":"ctags-empty-scope.rs","language":"rust","line":37,"kind":"function","scope":null} +{"_type":"tag","name":"parse_files","path":"ctags-empty-scope.rs","language":"rust","line":33,"kind":"function","scope":null} +{"_type":"tag","name":"THRESHOLD","path":"ctags-empty-scope.rs","language":"rust","line":9,"kind":"constant","scope":null} +{"_type":"tag","name":"LANGUAGE","path":"ctags-empty-scope.rs","language":"rust","line":8,"kind":"variable","scope":null} diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_globals.cs.snap b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_globals.cs.snap new file mode 100644 index 00000000000..4ddc82d97ee --- /dev/null +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_globals.cs.snap @@ -0,0 +1,39 @@ +--- +source: crates/scip-syntax/src/lib.rs +expression: "String::from_utf8_lossy(buf_writer.buffer())" +--- +{"_type":"tag","name":"Longer.Namespace","path":"globals.cs","language":"c_sharp","line":5,"kind":"namespace","scope":null} +{"_type":"tag","name":"Class","path":"globals.cs","language":"c_sharp","line":7,"kind":"class","scope":"Longer.Namespace"} +{"_type":"tag","name":"Coords","path":"globals.cs","language":"c_sharp","line":34,"kind":"struct","scope":"Longer.Namespace.Class"} +{"_type":"tag","name":"ToString","path":"globals.cs","language":"c_sharp","line":45,"kind":"method","scope":"Longer.Namespace.Class.Coords"} +{"_type":"tag","name":"Y","path":"globals.cs","language":"c_sharp","line":43,"kind":"property","scope":"Longer.Namespace.Class.Coords"} +{"_type":"tag","name":"X","path":"globals.cs","language":"c_sharp","line":42,"kind":"property","scope":"Longer.Namespace.Class.Coords"} +{"_type":"tag","name":"Coords","path":"globals.cs","language":"c_sharp","line":36,"kind":"constructor","scope":"Longer.Namespace.Class.Coords"} +{"_type":"tag","name":"Swag","path":"globals.cs","language":"c_sharp","line":57,"kind":"enum","scope":"Longer.Namespace.Class"} +{"_type":"tag","name":"Pants","path":"globals.cs","language":"c_sharp","line":62,"kind":"enumMember","scope":"Longer.Namespace.Class.Swag"} +{"_type":"tag","name":"Socks","path":"globals.cs","language":"c_sharp","line":61,"kind":"enumMember","scope":"Longer.Namespace.Class.Swag"} +{"_type":"tag","name":"Sweater","path":"globals.cs","language":"c_sharp","line":60,"kind":"enumMember","scope":"Longer.Namespace.Class.Swag"} +{"_type":"tag","name":"Shirt","path":"globals.cs","language":"c_sharp","line":59,"kind":"enumMember","scope":"Longer.Namespace.Class.Swag"} +{"_type":"tag","name":"ZigFeatureSet","path":"globals.cs","language":"c_sharp","line":67,"kind":"enum","scope":"Longer.Namespace.Class"} +{"_type":"tag","name":"FullPackage","path":"globals.cs","language":"c_sharp","line":75,"kind":"enumMember","scope":"Longer.Namespace.Class.ZigFeatureSet"} +{"_type":"tag","name":"CoolCommunity","path":"globals.cs","language":"c_sharp","line":74,"kind":"enumMember","scope":"Longer.Namespace.Class.ZigFeatureSet"} +{"_type":"tag","name":"BuildSystem","path":"globals.cs","language":"c_sharp","line":73,"kind":"enumMember","scope":"Longer.Namespace.Class.ZigFeatureSet"} +{"_type":"tag","name":"Comptime","path":"globals.cs","language":"c_sharp","line":72,"kind":"enumMember","scope":"Longer.Namespace.Class.ZigFeatureSet"} +{"_type":"tag","name":"Errors","path":"globals.cs","language":"c_sharp","line":71,"kind":"enumMember","scope":"Longer.Namespace.Class.ZigFeatureSet"} +{"_type":"tag","name":"None","path":"globals.cs","language":"c_sharp","line":70,"kind":"enumMember","scope":"Longer.Namespace.Class.ZigFeatureSet"} +{"_type":"tag","name":"Syntax","path":"globals.cs","language":"c_sharp","line":78,"kind":"method","scope":"Longer.Namespace.Class"} +{"_type":"tag","name":"SourcegraphSwag","path":"globals.cs","language":"c_sharp","line":65,"kind":"field","scope":"Longer.Namespace.Class"} +{"_type":"tag","name":"LambdaFunction","path":"globals.cs","language":"c_sharp","line":55,"kind":"property","scope":"Longer.Namespace.Class"} +{"_type":"tag","name":"PublicImplicitGetterSetter","path":"globals.cs","language":"c_sharp","line":53,"kind":"property","scope":"Longer.Namespace.Class"} +{"_type":"tag","name":"_speed","path":"globals.cs","language":"c_sharp","line":52,"kind":"field","scope":"Longer.Namespace.Class"} +{"_type":"tag","name":"Changed","path":"globals.cs","language":"c_sharp","line":50,"kind":"event","scope":"Longer.Namespace.Class"} +{"_type":"tag","name":"MyDelegate","path":"globals.cs","language":"c_sharp","line":48,"kind":"delegate","scope":"Longer.Namespace.Class"} +{"_type":"tag","name":"ImplicitGetterPrivateSetter","path":"globals.cs","language":"c_sharp","line":28,"kind":"property","scope":"Longer.Namespace.Class"} +{"_type":"tag","name":"ImplicitGetterSetter","path":"globals.cs","language":"c_sharp","line":22,"kind":"property","scope":"Longer.Namespace.Class"} +{"_type":"tag","name":"_val","path":"globals.cs","language":"c_sharp","line":20,"kind":"field","scope":"Longer.Namespace.Class"} +{"_type":"tag","name":"ExplicitGetterSetter","path":"globals.cs","language":"c_sharp","line":9,"kind":"property","scope":"Longer.Namespace.Class"} +{"_type":"tag","name":"OneClass","path":"globals.cs","language":"c_sharp","line":82,"kind":"namespace","scope":null} +{"_type":"tag","name":"TheClass","path":"globals.cs","language":"c_sharp","line":84,"kind":"class","scope":"OneClass"} +{"_type":"tag","name":"Text","path":"globals.cs","language":"c_sharp","line":87,"kind":"property","scope":"OneClass.TheClass"} +{"_type":"tag","name":"ClickAction","path":"globals.cs","language":"c_sharp","line":86,"kind":"property","scope":"OneClass.TheClass"} +{"_type":"tag","name":"SurprisinglyValid","path":"globals.cs","language":"c_sharp","line":3,"kind":"function","scope":null} diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_globals.kt.snap b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_globals.kt.snap index 4257b9d7305..60a8d36b25c 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_globals.kt.snap +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_globals.kt.snap @@ -2,37 +2,44 @@ source: crates/scip-syntax/src/lib.rs expression: "String::from_utf8_lossy(buf_writer.buffer())" --- -{"_type":"tag","name":"MyKotlinClass","path":"globals.kt","language":"kotlin","line":14,"kind":"type","scope":null} -{"_type":"tag","name":"method","path":"globals.kt","language":"kotlin","line":17,"kind":"method","scope":"MyKotlinClass"} -{"_type":"tag","name":"prop","path":"globals.kt","language":"kotlin","line":15,"kind":"variable","scope":"MyKotlinClass"} -{"_type":"tag","name":"User","path":"globals.kt","language":"kotlin","line":23,"kind":"type","scope":null} -{"_type":"tag","name":"age","path":"globals.kt","language":"kotlin","line":23,"kind":"variable","scope":"User"} -{"_type":"tag","name":"name","path":"globals.kt","language":"kotlin","line":23,"kind":"variable","scope":"User"} -{"_type":"tag","name":"Days","path":"globals.kt","language":"kotlin","line":26,"kind":"type","scope":null} -{"_type":"tag","name":"SUNDAY","path":"globals.kt","language":"kotlin","line":33,"kind":"variable","scope":"Days"} -{"_type":"tag","name":"SATURDAY","path":"globals.kt","language":"kotlin","line":32,"kind":"variable","scope":"Days"} -{"_type":"tag","name":"FRIDAY","path":"globals.kt","language":"kotlin","line":31,"kind":"variable","scope":"Days"} -{"_type":"tag","name":"THURSDAY","path":"globals.kt","language":"kotlin","line":30,"kind":"variable","scope":"Days"} -{"_type":"tag","name":"WEDNESDAY","path":"globals.kt","language":"kotlin","line":29,"kind":"variable","scope":"Days"} -{"_type":"tag","name":"TUESDAY","path":"globals.kt","language":"kotlin","line":28,"kind":"variable","scope":"Days"} -{"_type":"tag","name":"MONDAY","path":"globals.kt","language":"kotlin","line":27,"kind":"variable","scope":"Days"} -{"_type":"tag","name":"MyObject","path":"globals.kt","language":"kotlin","line":37,"kind":"type","scope":null} -{"_type":"tag","name":"property","path":"globals.kt","language":"kotlin","line":38,"kind":"variable","scope":"MyObject"} -{"_type":"tag","name":"MyInterface","path":"globals.kt","language":"kotlin","line":42,"kind":"type","scope":null} -{"_type":"tag","name":"Result","path":"globals.kt","language":"kotlin","line":55,"kind":"type","scope":null} -{"_type":"tag","name":"Success","path":"globals.kt","language":"kotlin","line":56,"kind":"type","scope":"Result"} -{"_type":"tag","name":"message","path":"globals.kt","language":"kotlin","line":56,"kind":"variable","scope":"Result.Success"} -{"_type":"tag","name":"Error","path":"globals.kt","language":"kotlin","line":57,"kind":"type","scope":"Result"} -{"_type":"tag","name":"error","path":"globals.kt","language":"kotlin","line":57,"kind":"variable","scope":"Result.Error"} -{"_type":"tag","name":"Password","path":"globals.kt","language":"kotlin","line":61,"kind":"type","scope":null} -{"_type":"tag","name":"value","path":"globals.kt","language":"kotlin","line":61,"kind":"variable","scope":"Password"} -{"_type":"tag","name":"MyClassWithCompanion","path":"globals.kt","language":"kotlin","line":64,"kind":"type","scope":null} -{"_type":"tag","name":"CONSTANT","path":"globals.kt","language":"kotlin","line":66,"kind":"variable","scope":"MyClassWithCompanion"} -{"_type":"tag","name":"right","path":"globals.kt","language":"kotlin","line":72,"kind":"variable","scope":null} -{"_type":"tag","name":"left","path":"globals.kt","language":"kotlin","line":72,"kind":"variable","scope":null} -{"_type":"tag","name":"`Escaped`","path":"globals.kt","language":"kotlin","line":70,"kind":"method","scope":null} -{"_type":"tag","name":"print","path":"globals.kt","language":"kotlin","line":50,"kind":"method","scope":null} -{"_type":"tag","name":"printHello","path":"globals.kt","language":"kotlin","line":9,"kind":"method","scope":null} -{"_type":"tag","name":"version","path":"globals.kt","language":"kotlin","line":5,"kind":"variable","scope":null} -{"_type":"tag","name":"PI","path":"globals.kt","language":"kotlin","line":2,"kind":"variable","scope":null} +{"_type":"tag","name":"org.example","path":"globals.kt","language":"kotlin","line":1,"kind":"package","scope":null} +{"_type":"tag","name":"MyKotlinClass","path":"globals.kt","language":"kotlin","line":16,"kind":"class","scope":"org.example"} +{"_type":"tag","name":"method","path":"globals.kt","language":"kotlin","line":19,"kind":"method","scope":"org.example.MyKotlinClass"} +{"_type":"tag","name":"prop","path":"globals.kt","language":"kotlin","line":17,"kind":"property","scope":"org.example.MyKotlinClass"} +{"_type":"tag","name":"User","path":"globals.kt","language":"kotlin","line":25,"kind":"class","scope":"org.example"} +{"_type":"tag","name":"age","path":"globals.kt","language":"kotlin","line":25,"kind":"property","scope":"org.example.User"} +{"_type":"tag","name":"name","path":"globals.kt","language":"kotlin","line":25,"kind":"property","scope":"org.example.User"} +{"_type":"tag","name":"Days","path":"globals.kt","language":"kotlin","line":28,"kind":"enum","scope":"org.example"} +{"_type":"tag","name":"SUNDAY","path":"globals.kt","language":"kotlin","line":35,"kind":"enumMember","scope":"org.example.Days"} +{"_type":"tag","name":"SATURDAY","path":"globals.kt","language":"kotlin","line":34,"kind":"enumMember","scope":"org.example.Days"} +{"_type":"tag","name":"FRIDAY","path":"globals.kt","language":"kotlin","line":33,"kind":"enumMember","scope":"org.example.Days"} +{"_type":"tag","name":"THURSDAY","path":"globals.kt","language":"kotlin","line":32,"kind":"enumMember","scope":"org.example.Days"} +{"_type":"tag","name":"WEDNESDAY","path":"globals.kt","language":"kotlin","line":31,"kind":"enumMember","scope":"org.example.Days"} +{"_type":"tag","name":"TUESDAY","path":"globals.kt","language":"kotlin","line":30,"kind":"enumMember","scope":"org.example.Days"} +{"_type":"tag","name":"MONDAY","path":"globals.kt","language":"kotlin","line":29,"kind":"enumMember","scope":"org.example.Days"} +{"_type":"tag","name":"MyObject","path":"globals.kt","language":"kotlin","line":39,"kind":"object","scope":"org.example"} +{"_type":"tag","name":"property","path":"globals.kt","language":"kotlin","line":40,"kind":"property","scope":"org.example.MyObject"} +{"_type":"tag","name":"MyInterface","path":"globals.kt","language":"kotlin","line":44,"kind":"interface","scope":"org.example"} +{"_type":"tag","name":"interfaceMethod","path":"globals.kt","language":"kotlin","line":45,"kind":"method","scope":"org.example.MyInterface"} +{"_type":"tag","name":"SimpleSingleton","path":"globals.kt","language":"kotlin","line":48,"kind":"object","scope":"org.example"} +{"_type":"tag","name":"greet","path":"globals.kt","language":"kotlin","line":50,"kind":"method","scope":"org.example.SimpleSingleton"} +{"_type":"tag","name":"answer","path":"globals.kt","language":"kotlin","line":49,"kind":"property","scope":"org.example.SimpleSingleton"} +{"_type":"tag","name":"Result","path":"globals.kt","language":"kotlin","line":62,"kind":"class","scope":"org.example"} +{"_type":"tag","name":"Success","path":"globals.kt","language":"kotlin","line":63,"kind":"class","scope":"org.example.Result"} +{"_type":"tag","name":"message","path":"globals.kt","language":"kotlin","line":63,"kind":"property","scope":"org.example.Result.Success"} +{"_type":"tag","name":"Error","path":"globals.kt","language":"kotlin","line":64,"kind":"class","scope":"org.example.Result"} +{"_type":"tag","name":"error","path":"globals.kt","language":"kotlin","line":64,"kind":"property","scope":"org.example.Result.Error"} +{"_type":"tag","name":"Password","path":"globals.kt","language":"kotlin","line":68,"kind":"class","scope":"org.example"} +{"_type":"tag","name":"value","path":"globals.kt","language":"kotlin","line":68,"kind":"property","scope":"org.example.Password"} +{"_type":"tag","name":"MyClassWithCompanion","path":"globals.kt","language":"kotlin","line":71,"kind":"class","scope":"org.example"} +{"_type":"tag","name":"ConstantCompanion","path":"globals.kt","language":"kotlin","line":72,"kind":"object","scope":"org.example.MyClassWithCompanion"} +{"_type":"tag","name":"CONSTANT","path":"globals.kt","language":"kotlin","line":73,"kind":"constant","scope":"org.example.MyClassWithCompanion.ConstantCompanion"} +{"_type":"tag","name":"right","path":"globals.kt","language":"kotlin","line":80,"kind":"property","scope":"org.example"} +{"_type":"tag","name":"left","path":"globals.kt","language":"kotlin","line":80,"kind":"property","scope":"org.example"} +{"_type":"tag","name":"`Escaped`","path":"globals.kt","language":"kotlin","line":77,"kind":"method","scope":"org.example"} +{"_type":"tag","name":"print","path":"globals.kt","language":"kotlin","line":57,"kind":"method","scope":"org.example"} +{"_type":"tag","name":"UserList","path":"globals.kt","language":"kotlin","line":54,"kind":"typeAlias","scope":"org.example"} +{"_type":"tag","name":"printHello","path":"globals.kt","language":"kotlin","line":11,"kind":"method","scope":"org.example"} +{"_type":"tag","name":"version","path":"globals.kt","language":"kotlin","line":7,"kind":"property","scope":"org.example"} +{"_type":"tag","name":"PI","path":"globals.kt","language":"kotlin","line":4,"kind":"constant","scope":"org.example"} diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_globals.py.snap b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_globals.py.snap new file mode 100644 index 00000000000..e4456f3a8d7 --- /dev/null +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_globals.py.snap @@ -0,0 +1,28 @@ +--- +source: crates/scip-syntax/src/lib.rs +expression: "String::from_utf8_lossy(buf_writer.buffer())" +--- +{"_type":"tag","name":"Bruh","path":"globals.py","language":"python","line":6,"kind":"class","scope":null} +{"_type":"tag","name":"dab","path":"globals.py","language":"python","line":11,"kind":"method","scope":"Bruh"} +{"_type":"tag","name":"__init__","path":"globals.py","language":"python","line":8,"kind":"method","scope":"Bruh"} +{"_type":"tag","name":"a","path":"globals.py","language":"python","line":6,"kind":"variable","scope":"Bruh"} +{"_type":"tag","name":"SomeAsyncStuffs","path":"globals.py","language":"python","line":37,"kind":"class","scope":null} +{"_type":"tag","name":"__anext__","path":"globals.py","language":"python","line":43,"kind":"method","scope":"SomeAsyncStuffs"} +{"_type":"tag","name":"__aiter__","path":"globals.py","language":"python","line":40,"kind":"method","scope":"SomeAsyncStuffs"} +{"_type":"tag","name":"__init__","path":"globals.py","language":"python","line":37,"kind":"method","scope":"SomeAsyncStuffs"} +{"_type":"tag","name":"ClassWithDecorators","path":"globals.py","language":"python","line":61,"kind":"class","scope":null} +{"_type":"tag","name":"prints_something","path":"globals.py","language":"python","line":73,"kind":"method","scope":"ClassWithDecorators"} +{"_type":"tag","name":"class_method","path":"globals.py","language":"python","line":66,"kind":"method","scope":"ClassWithDecorators"} +{"_type":"tag","name":"static_method","path":"globals.py","language":"python","line":62,"kind":"method","scope":"ClassWithDecorators"} +{"_type":"tag","name":"bar","path":"globals.py","language":"python","line":80,"kind":"variable","scope":null} +{"_type":"tag","name":"foo","path":"globals.py","language":"python","line":80,"kind":"variable","scope":null} +{"_type":"tag","name":"baz","path":"globals.py","language":"python","line":77,"kind":"variable","scope":null} +{"_type":"tag","name":"bar","path":"globals.py","language":"python","line":77,"kind":"variable","scope":null} +{"_type":"tag","name":"foo","path":"globals.py","language":"python","line":77,"kind":"variable","scope":null} +{"_type":"tag","name":"func02","path":"globals.py","language":"python","line":57,"kind":"function","scope":null} +{"_type":"tag","name":"has_a_name","path":"globals.py","language":"python","line":53,"kind":"function","scope":null} +{"_type":"tag","name":"does_nothingwrapper","path":"globals.py","language":"python","line":49,"kind":"function","scope":null} +{"_type":"tag","name":"does_nothing","path":"globals.py","language":"python","line":46,"kind":"function","scope":null} +{"_type":"tag","name":"my_function","path":"globals.py","language":"python","line":32,"kind":"function","scope":null} +{"_type":"tag","name":"should_show_ifs","path":"globals.py","language":"python","line":19,"kind":"variable","scope":null} +{"_type":"tag","name":"bruh","path":"globals.py","language":"python","line":3,"kind":"variable","scope":null} diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_go-globals.go.snap b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_go-globals.go.snap index 0407f502ad5..daa5c7c3bbc 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_go-globals.go.snap +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_go-globals.go.snap @@ -3,20 +3,21 @@ source: crates/scip-syntax/src/lib.rs expression: "String::from_utf8_lossy(buf_writer.buffer())" --- {"_type":"tag","name":"multierror","path":"go-globals.go","language":"go","line":1,"kind":"package","scope":null} -{"_type":"tag","name":"Group","path":"go-globals.go","language":"go","line":7,"kind":"type","scope":"multierror"} -{"_type":"tag","name":"nested","path":"go-globals.go","language":"go","line":11,"kind":"type","scope":"multierror.Group"} -{"_type":"tag","name":"inner","path":"go-globals.go","language":"go","line":12,"kind":"variable","scope":"multierror.Group.nested"} -{"_type":"tag","name":"innerface","path":"go-globals.go","language":"go","line":15,"kind":"type","scope":"multierror.Group"} -{"_type":"tag","name":"Another","path":"go-globals.go","language":"go","line":16,"kind":"method","scope":"multierror.Group.innerface"} -{"_type":"tag","name":"wg","path":"go-globals.go","language":"go","line":10,"kind":"variable","scope":"multierror.Group"} -{"_type":"tag","name":"err","path":"go-globals.go","language":"go","line":9,"kind":"variable","scope":"multierror.Group"} -{"_type":"tag","name":"mutex","path":"go-globals.go","language":"go","line":8,"kind":"variable","scope":"multierror.Group"} -{"_type":"tag","name":"SomeInterface","path":"go-globals.go","language":"go","line":20,"kind":"type","scope":"multierror"} -{"_type":"tag","name":"Incredible","path":"go-globals.go","language":"go","line":22,"kind":"method","scope":"multierror.SomeInterface"} -{"_type":"tag","name":"Something","path":"go-globals.go","language":"go","line":21,"kind":"method","scope":"multierror.SomeInterface"} -{"_type":"tag","name":"RegularFunc","path":"go-globals.go","language":"go","line":57,"kind":"function","scope":"multierror"} -{"_type":"tag","name":"fileIdx","path":"go-globals.go","language":"go","line":54,"kind":"variable","scope":"multierror"} -{"_type":"tag","name":"diffPath","path":"go-globals.go","language":"go","line":53,"kind":"variable","scope":"multierror"} -{"_type":"tag","name":"Wait","path":"go-globals.go","language":"go","line":45,"kind":"method","scope":"multierror.Group"} -{"_type":"tag","name":"Go","path":"go-globals.go","language":"go","line":29,"kind":"method","scope":"multierror.Group"} - +{"_type":"tag","name":"Group","path":"go-globals.go","language":"go","line":7,"kind":"struct","scope":"multierror"} +{"_type":"tag","name":"nested","path":"go-globals.go","language":"go","line":11,"kind":"struct","scope":"multierror.Group"} +{"_type":"tag","name":"inner","path":"go-globals.go","language":"go","line":12,"kind":"field","scope":"multierror.Group.nested"} +{"_type":"tag","name":"innerface","path":"go-globals.go","language":"go","line":15,"kind":"interface","scope":"multierror.Group"} +{"_type":"tag","name":"Another","path":"go-globals.go","language":"go","line":16,"kind":"methodSpec","scope":"multierror.Group.innerface"} +{"_type":"tag","name":"wg","path":"go-globals.go","language":"go","line":10,"kind":"field","scope":"multierror.Group"} +{"_type":"tag","name":"err","path":"go-globals.go","language":"go","line":9,"kind":"field","scope":"multierror.Group"} +{"_type":"tag","name":"mutex","path":"go-globals.go","language":"go","line":8,"kind":"field","scope":"multierror.Group"} +{"_type":"tag","name":"SomeInterface","path":"go-globals.go","language":"go","line":20,"kind":"interface","scope":"multierror"} +{"_type":"tag","name":"Incredible","path":"go-globals.go","language":"go","line":22,"kind":"methodSpec","scope":"multierror.SomeInterface"} +{"_type":"tag","name":"Something","path":"go-globals.go","language":"go","line":21,"kind":"methodSpec","scope":"multierror.SomeInterface"} +{"_type":"tag","name":"RegularFunc","path":"go-globals.go","language":"go","line":60,"kind":"function","scope":"multierror"} +{"_type":"tag","name":"fileIdx","path":"go-globals.go","language":"go","line":57,"kind":"variable","scope":"multierror"} +{"_type":"tag","name":"diffPath","path":"go-globals.go","language":"go","line":56,"kind":"variable","scope":"multierror"} +{"_type":"tag","name":"Wait","path":"go-globals.go","language":"go","line":48,"kind":"method","scope":"multierror.Group"} +{"_type":"tag","name":"Go","path":"go-globals.go","language":"go","line":32,"kind":"method","scope":"multierror.Group"} +{"_type":"tag","name":"TypeAlias","path":"go-globals.go","language":"go","line":26,"kind":"typeAlias","scope":"multierror"} +{"_type":"tag","name":"TypeDef","path":"go-globals.go","language":"go","line":25,"kind":"typeAlias","scope":"multierror"} diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_ruby-globals.rb.snap b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_ruby-globals.rb.snap new file mode 100644 index 00000000000..af4de6b2686 --- /dev/null +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_ruby-globals.rb.snap @@ -0,0 +1,23 @@ +--- +source: crates/scip-syntax/src/lib.rs +expression: "String::from_utf8_lossy(buf_writer.buffer())" +--- +{"_type":"tag","name":"MyModule","path":"ruby-globals.rb","language":"ruby","line":44,"kind":"module","scope":null} +{"_type":"tag","name":"MyClass","path":"ruby-globals.rb","language":"ruby","line":48,"kind":"class","scope":"MyModule"} +{"_type":"tag","name":"woo","path":"ruby-globals.rb","language":"ruby","line":52,"kind":"singletonMethod","scope":"MyModule.MyClass"} +{"_type":"tag","name":"yay","path":"ruby-globals.rb","language":"ruby","line":49,"kind":"method","scope":"MyModule.MyClass"} +{"_type":"tag","name":"abc","path":"ruby-globals.rb","language":"ruby","line":45,"kind":"singletonMethod","scope":"MyModule"} +{"_type":"tag","name":"Foo","path":"ruby-globals.rb","language":"ruby","line":57,"kind":"class","scope":null} +{"_type":"tag","name":"qux=","path":"ruby-globals.rb","language":"ruby","line":60,"kind":"setter","scope":"Foo"} +{"_type":"tag","name":"baz","path":"ruby-globals.rb","language":"ruby","line":59,"kind":"getter","scope":"Foo"} +{"_type":"tag","name":"bar=","path":"ruby-globals.rb","language":"ruby","line":58,"kind":"accessor","scope":"Foo"} +{"_type":"tag","name":"bar","path":"ruby-globals.rb","language":"ruby","line":58,"kind":"accessor","scope":"Foo"} +{"_type":"tag","name":"Aliased","path":"ruby-globals.rb","language":"ruby","line":63,"kind":"class","scope":null} +{"_type":"tag","name":"baz","path":"ruby-globals.rb","language":"ruby","line":67,"kind":"methodAlias","scope":"Aliased"} +{"_type":"tag","name":"bar","path":"ruby-globals.rb","language":"ruby","line":64,"kind":"method","scope":"Aliased"} +{"_type":"tag","name":"Parental","path":"ruby-globals.rb","language":"ruby","line":70,"kind":"class","scope":null} +{"_type":"tag","name":"parental_func","path":"ruby-globals.rb","language":"ruby","line":71,"kind":"method","scope":"Parental"} +{"_type":"tag","name":"Composed","path":"ruby-globals.rb","language":"ruby","line":75,"kind":"class","scope":null} +{"_type":"tag","name":"grade","path":"ruby-globals.rb","language":"ruby","line":37,"kind":"variable","scope":null} +{"_type":"tag","name":"counter","path":"ruby-globals.rb","language":"ruby","line":19,"kind":"variable","scope":null} +{"_type":"tag","name":"SOME_CONSTANT","path":"ruby-globals.rb","language":"ruby","line":1,"kind":"constant","scope":null} diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/src/ts_scip.rs b/docker-images/syntax-highlighter/crates/scip-syntax/src/ts_scip.rs index 44e49fc2b62..ba4c7f4e3ca 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/src/ts_scip.rs +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/ts_scip.rs @@ -21,9 +21,32 @@ pub fn captures_to_kind(kind: &Option<&String>) -> symbol_information::Kind { use symbol_information::Kind::*; kind.map_or(UnspecifiedKind, |kind| match kind.as_str() { + "kind.accessor" => Accessor, + "kind.class" => Class, "kind.constant" => Constant, - "kind.package" => Package, + "kind.constructor" => Constructor, + "kind.delegate" => Delegate, + "kind.enum" => Enum, + "kind.enummember" => EnumMember, + "kind.event" => Event, + "kind.field" => Field, "kind.function" => Function, + "kind.getter" => Getter, + "kind.interface" => Interface, + "kind.method" => Method, + "kind.methodalias" => MethodAlias, + "kind.methodspec" => MethodSpecification, + "kind.module" => Module, + "kind.namespace" => Namespace, + "kind.object" => Object, + "kind.package" => Package, + "kind.property" => Property, + "kind.setter" => Setter, + "kind.singletonmethod" => SingletonMethod, + "kind.struct" => Struct, + "kind.typealias" => TypeAlias, + "kind.trait" => Trait, + // "kind.implementation" => Implementation, TODO _ => UnspecifiedKind, }) } @@ -32,9 +55,32 @@ pub fn symbol_kind_to_ctags_kind(kind: &symbol_information::Kind) -> Option<&'st use symbol_information::Kind::*; match kind { + Accessor => Some("accessor"), + Class => Some("class"), Constant => Some("constant"), - Package => Some("package"), + Constructor => Some("constructor"), + Delegate => Some("delegate"), + Enum => Some("enum"), + EnumMember => Some("enumMember"), + Event => Some("event"), + Field => Some("field"), Function => Some("function"), + Getter => Some("getter"), + Interface => Some("interface"), + Method => Some("method"), + MethodAlias => Some("methodAlias"), + MethodSpecification => Some("methodSpec"), + Module => Some("module"), + Namespace => Some("namespace"), + Object => Some("object"), + Package => Some("package"), + Property => Some("property"), + Setter => Some("setter"), + SingletonMethod => Some("singletonMethod"), + Struct => Some("struct"), + TypeAlias => Some("typeAlias"), + Trait => Some("trait"), + // Implementation => Some("implementation"), TODO _ => None, } } diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/testdata/ctags-empty-scope.rs b/docker-images/syntax-highlighter/crates/scip-syntax/testdata/ctags-empty-scope.rs index 7548f3915c1..72262ca2035 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/testdata/ctags-empty-scope.rs +++ b/docker-images/syntax-highlighter/crates/scip-syntax/testdata/ctags-empty-scope.rs @@ -5,6 +5,11 @@ use scip_syntax::locals::parse_tree; use scip_treesitter_languages::parsers::BundledParser; use walkdir::WalkDir; +static LANGUAGE: &str = "Rust"; +const THRESHOLD: i32 = 10; + +trait Yay {} + #[derive(Parser)] #[command(author, version, about, long_about = None)] struct Arguments { @@ -12,6 +17,14 @@ struct Arguments { root_dir: String, } +impl Arguments { + fn parse() {} +} + +impl Yay for Arguments { + fn pog() {} +} + struct ParseTiming { pub filepath: String, pub duration: std::time::Duration, diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/testdata/globals.kt b/docker-images/syntax-highlighter/crates/scip-syntax/testdata/globals.kt index d9051321476..1a40a4b3cdb 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/testdata/globals.kt +++ b/docker-images/syntax-highlighter/crates/scip-syntax/testdata/globals.kt @@ -1,3 +1,5 @@ +package org.example + // Top level constant property const val PI = 3.14 @@ -43,6 +45,11 @@ interface MyInterface { fun interfaceMethod(): String } +object SimpleSingleton { + val answer = 42; + fun greet(name: String) = "Hello, $name!" +} + // Type alias typealias UserList = List @@ -62,11 +69,15 @@ inline class Password(val value: String) // Companion object class MyClassWithCompanion { - companion object { + companion object ConstantCompanion { const val CONSTANT = "Companion constant" } } fun `Escaped`() {} +// Multi-variable declaration val (left, right) = directions() + +// Anonymous function +fun(x: Int, y: Int): Int = x + y diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/testdata/go-globals.go b/docker-images/syntax-highlighter/crates/scip-syntax/testdata/go-globals.go index 78f2734fb22..49dc11fb56e 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/testdata/go-globals.go +++ b/docker-images/syntax-highlighter/crates/scip-syntax/testdata/go-globals.go @@ -22,6 +22,9 @@ type SomeInterface interface { Incredible() int } +type TypeDef uint8 +type TypeAlias = uint8 + // Go calls the given function in a new goroutine. // // If the function returns an error it is added to the group multierror which diff --git a/docker-images/syntax-highlighter/crates/scip-syntax/testdata/ruby-globals.rb b/docker-images/syntax-highlighter/crates/scip-syntax/testdata/ruby-globals.rb index 2797aa8a44d..3ac5bb4bc2f 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/testdata/ruby-globals.rb +++ b/docker-images/syntax-highlighter/crates/scip-syntax/testdata/ruby-globals.rb @@ -1,3 +1,5 @@ +SOME_CONSTANT = 2.718 + if true a = 1 elsif false diff --git a/docker-images/syntax-highlighter/crates/scip-treesitter-languages/Cargo.toml b/docker-images/syntax-highlighter/crates/scip-treesitter-languages/Cargo.toml index 9375655d8a7..3bb8c07d171 100644 --- a/docker-images/syntax-highlighter/crates/scip-treesitter-languages/Cargo.toml +++ b/docker-images/syntax-highlighter/crates/scip-treesitter-languages/Cargo.toml @@ -18,7 +18,7 @@ tree-sitter-highlight.workspace = true tree-sitter-c = "0.20.2" tree-sitter-c-sharp = "0.20.0" tree-sitter-cpp = "0.20.3" -tree-sitter-go = "0.19.1" +tree-sitter-go = "0.20.0" tree-sitter-java = "0.20.0" tree-sitter-javascript = "0.20.0" tree-sitter-scala = "0.20.1" diff --git a/docker-images/syntax-highlighter/crates/scip-treesitter-languages/queries/go/highlights.scm b/docker-images/syntax-highlighter/crates/scip-treesitter-languages/queries/go/highlights.scm index bf003b435fb..03fd35b9bd4 100644 --- a/docker-images/syntax-highlighter/crates/scip-treesitter-languages/queries/go/highlights.scm +++ b/docker-images/syntax-highlighter/crates/scip-treesitter-languages/queries/go/highlights.scm @@ -136,10 +136,8 @@ (package_identifier) @variable.module (type_identifier) @type -(keyed_element . (field_identifier) @identifier.attribute) +(keyed_element . (literal_element (identifier) @identifier.attribute)) ((identifier) @constant (#match? @constant "^[A-Z][A-Z\\d_]+$")) ((identifier) @constant (#eq? @constant "_")) (identifier) @variable (field_identifier) @identifier.property - - diff --git a/docker-images/syntax-highlighter/crates/sg-syntax/src/snapshots/sg_syntax__sg_treesitter__test__golang.go.snap b/docker-images/syntax-highlighter/crates/sg-syntax/src/snapshots/sg_syntax__sg_treesitter__test__golang.go.snap index eaa5059ab03..f1c81eed02e 100644 --- a/docker-images/syntax-highlighter/crates/sg-syntax/src/snapshots/sg_syntax__sg_treesitter__test__golang.go.snap +++ b/docker-images/syntax-highlighter/crates/sg-syntax/src/snapshots/sg_syntax__sg_treesitter__test__golang.go.snap @@ -1,6 +1,5 @@ --- source: crates/sg-syntax/src/sg_treesitter.rs -assertion_line: 362 expression: "snapshot_treesitter_syntax_kinds(&document, &contents)" --- package main @@ -313,9 +312,9 @@ expression: "snapshot_treesitter_syntax_kinds(&document, &contents)" func Min[T Comparable](a, b T) T { //^^^^ Keyword -// ^^^ Identifier -// ^ Identifier -// ^^^^^^^^^^ IdentifierFunction +// ^^^ IdentifierFunction +// ^ IdentifierParameter +// ^^^^^^^^^^ IdentifierType // ^ IdentifierParameter // ^ IdentifierParameter // ^ IdentifierType @@ -340,16 +339,16 @@ expression: "snapshot_treesitter_syntax_kinds(&document, &contents)" fmt.Println(Min[int](5, 10)) // 5 // ^^^ Identifier // ^^^^^^^ IdentifierFunction -// ^^^ Identifier -// ^^^ Identifier +// ^^^ IdentifierFunction +// ^^^ IdentifierBuiltinType // ^ NumericLiteral // ^^ NumericLiteral // ^^^^ Comment fmt.Println(Min[string]("a", "b")) // "a" // ^^^ Identifier // ^^^^^^^ IdentifierFunction -// ^^^ Identifier -// ^^^^^^ Identifier +// ^^^ IdentifierFunction +// ^^^^^^ IdentifierBuiltinType // ^^^ StringLiteral // ^^^ StringLiteral // ^^^^^^ Comment