From eb2f011f6d60b0eec48dde116dc8227622042ac0 Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Tue, 24 Oct 2023 14:44:27 -0700 Subject: [PATCH 01/11] Update c sharp --- .../scip-syntax/queries/c_sharp/scip-tags.scm | 28 ++++---- .../crates/scip-syntax/src/lib.rs | 2 +- ...yntax__test__scip_snapshot_globals.cs.snap | 71 +++++++++---------- ...yntax__test__tags_snapshot_globals.cs.snap | 40 +++++++++++ .../crates/scip-syntax/src/ts_scip.rs | 14 ++++ 5 files changed, 103 insertions(+), 52 deletions(-) create mode 100644 docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_globals.cs.snap 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 83473586d784..e977d4b2b3f9 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.method) 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 ea2eced085e1..d34756774124 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/src/lib.rs +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/lib.rs @@ -102,7 +102,7 @@ mod test { generate_tags_and_snapshot!(Scip, test_scip_python_comp, "python-repo-comp.py"); 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__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 ddf3e5aee992..63ae0c7ba165 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(Method) 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__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 000000000000..3ec64211052b --- /dev/null +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_globals.cs.snap @@ -0,0 +1,40 @@ +--- +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":"enumerator","scope":"Longer.Namespace.Class.Swag"} +{"_type":"tag","name":"Socks","path":"globals.cs","language":"c_sharp","line":61,"kind":"enumerator","scope":"Longer.Namespace.Class.Swag"} +{"_type":"tag","name":"Sweater","path":"globals.cs","language":"c_sharp","line":60,"kind":"enumerator","scope":"Longer.Namespace.Class.Swag"} +{"_type":"tag","name":"Shirt","path":"globals.cs","language":"c_sharp","line":59,"kind":"enumerator","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":"enumerator","scope":"Longer.Namespace.Class.ZigFeatureSet"} +{"_type":"tag","name":"CoolCommunity","path":"globals.cs","language":"c_sharp","line":74,"kind":"enumerator","scope":"Longer.Namespace.Class.ZigFeatureSet"} +{"_type":"tag","name":"BuildSystem","path":"globals.cs","language":"c_sharp","line":73,"kind":"enumerator","scope":"Longer.Namespace.Class.ZigFeatureSet"} +{"_type":"tag","name":"Comptime","path":"globals.cs","language":"c_sharp","line":72,"kind":"enumerator","scope":"Longer.Namespace.Class.ZigFeatureSet"} +{"_type":"tag","name":"Errors","path":"globals.cs","language":"c_sharp","line":71,"kind":"enumerator","scope":"Longer.Namespace.Class.ZigFeatureSet"} +{"_type":"tag","name":"None","path":"globals.cs","language":"c_sharp","line":70,"kind":"enumerator","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":"method","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/ts_scip.rs b/docker-images/syntax-highlighter/crates/scip-syntax/src/ts_scip.rs index 8b4d41937923..2cea483772d8 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,12 +21,19 @@ 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.class" => Class, "kind.constant" => Constant, + "kind.constructor" => Constructor, + "kind.enum" => Enum, + "kind.enummember" => EnumMember, + "kind.event" => Event, "kind.field" => Field, "kind.function" => Function, "kind.interface" => Interface, "kind.method" => Method, + "kind.namespace" => Namespace, "kind.package" => Package, + "kind.property" => Property, "kind.struct" => Struct, "kind.typealias" => TypeAlias, _ => UnspecifiedKind, @@ -37,12 +44,19 @@ pub fn symbol_kind_to_ctags_kind(kind: &symbol_information::Kind) -> Option<&'st use symbol_information::Kind::*; match kind { + Class => Some("class"), Constant => Some("constant"), + Constructor => Some("constructor"), + Enum => Some("enum"), + EnumMember => Some("enumerator"), + Event => Some("event"), Field => Some("field"), Function => Some("function"), Interface => Some("interface"), Method => Some("method"), + Namespace => Some("namespace"), Package => Some("package"), + Property => Some("property"), Struct => Some("struct"), TypeAlias => Some("typealias"), _ => None, From aa8d8d4d58b21df0e5b841a48fc1f85d745c2598 Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Tue, 24 Oct 2023 15:53:59 -0700 Subject: [PATCH 02/11] Update python --- .../scip-syntax/queries/python/scip-tags.scm | 15 ++++----- .../crates/scip-syntax/src/lib.rs | 2 +- ...yntax__test__scip_snapshot_globals.py.snap | 32 +++++++++---------- ...st__scip_snapshot_python-repo-comp.py.snap | 12 +++---- ...yntax__test__tags_snapshot_globals.py.snap | 29 +++++++++++++++++ 5 files changed, 59 insertions(+), 31 deletions(-) create mode 100644 docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_globals.py.snap 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 a9d9ac87fc3b..9bec77b3d891 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/src/lib.rs b/docker-images/syntax-highlighter/crates/scip-syntax/src/lib.rs index d34756774124..d1e498907a1c 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/src/lib.rs +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/lib.rs @@ -98,7 +98,7 @@ 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!(Scip, test_scip_java, "globals.java"); generate_tags_and_snapshot!(Scip, test_scip_typescript, "globals.ts"); 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 cd53bdc2c3ea..95269707bb23 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(Field) scip-ctags Bruh#__init__(). +// ^^^^^^^^ definition(Method) scip-ctags Bruh#__init__(). pass def dab(): -// ^^^ definition(Field) 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(Field) scip-ctags SomeAsyncStuffs#__init__(). +// ^^^^^^^^ definition(Method) scip-ctags SomeAsyncStuffs#__init__(). pass def __aiter__(self): -// ^^^^^^^^^ definition(Field) scip-ctags SomeAsyncStuffs#__aiter__(). +// ^^^^^^^^^ definition(Method) scip-ctags SomeAsyncStuffs#__aiter__(). pass async def __anext__(self): -// ^^^^^^^^^ definition(Field) 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(Field) scip-ctags ClassWithDecorators#static_method(). +// ^^^^^^^^^^^^^ definition(Method) scip-ctags ClassWithDecorators#static_method(). print("hello") @classmethod def class_method(cls): -// ^^^^^^^^^^^^ definition(Field) 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(Field) 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_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 a50321612ff4..927241779012 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(Field) scip-ctags RemoteCollector#__init__(). +// ^^^^^^^^ definition(Method) scip-ctags RemoteCollector#__init__(). self.sock = sock self._debug = debug def _log(self, *args): -// ^^^^ definition(Field) 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(Field) 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(Field) 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(Field) 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__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 000000000000..ecc662705083 --- /dev/null +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_globals.py.snap @@ -0,0 +1,29 @@ +--- +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} + From 5a2ffc4a94a1e9357c516a55e808aceb8792f6ff Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Tue, 24 Oct 2023 16:29:54 -0700 Subject: [PATCH 03/11] Update ruby --- .../scip-syntax/queries/ruby/scip-tags.scm | 19 ++-- .../crates/scip-syntax/src/lib.rs | 1 + ...__test__scip_snapshot_ruby-globals.rb.snap | 101 ++++++++++++++++++ ...__test__tags_snapshot_ruby-globals.rb.snap | 24 +++++ .../crates/scip-syntax/src/ts_scip.rs | 2 + .../scip-syntax/testdata/ruby-globals.rb | 2 + 6 files changed, 141 insertions(+), 8 deletions(-) create mode 100644 docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__scip_snapshot_ruby-globals.rb.snap create mode 100644 docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_ruby-globals.rb.snap 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 ce51f7486f3e..7db44943c280 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,33 +1,36 @@ -(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.method) @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.property)) (#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.property)) (#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.property)) (#eq? @_attr_writer "attr_writer") (#transform! ":(.*)" "$1=")) ;; alias_method :baz, :bar ((call - method: (identifier) @_alias_method + method: (identifier) @_alias_method @kind.method arguments: (argument_list . (simple_symbol) @descriptor.method)) 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 d1e498907a1c..f36e89006500 100644 --- a/docker-images/syntax-highlighter/crates/scip-syntax/src/lib.rs +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/lib.rs @@ -100,6 +100,7 @@ mod test { generate_tags_and_snapshot!(Scip, test_scip_zig, "globals.zig"); 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!(All, test_tags_csharp, test_scip_csharp, "globals.cs"); 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 000000000000..7c14640590ac --- /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(Method) 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(Method) scip-ctags MyModule/MyClass#woo(). + end + end + end + + class Foo +// ^^^ definition(Class) scip-ctags Foo# + attr_accessor :bar +// ^^^^ definition(Property) scip-ctags Foo#`bar=`(). +// ^^^^ definition(Property) scip-ctags Foo#bar(). + attr_reader :baz +// ^^^^ definition(Property) scip-ctags Foo#baz(). + attr_writer :qux +// ^^^^ definition(Property) 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(Method) 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__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 000000000000..f61b9d1fe39f --- /dev/null +++ b/docker-images/syntax-highlighter/crates/scip-syntax/src/snapshots/scip_syntax__test__tags_snapshot_ruby-globals.rb.snap @@ -0,0 +1,24 @@ +--- +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":"method","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":"method","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":"property","scope":"Foo"} +{"_type":"tag","name":"baz","path":"ruby-globals.rb","language":"ruby","line":59,"kind":"property","scope":"Foo"} +{"_type":"tag","name":"bar=","path":"ruby-globals.rb","language":"ruby","line":58,"kind":"property","scope":"Foo"} +{"_type":"tag","name":"bar","path":"ruby-globals.rb","language":"ruby","line":58,"kind":"property","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":"method","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 2cea483772d8..04e1b3850a74 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 @@ -31,6 +31,7 @@ pub fn captures_to_kind(kind: &Option<&String>) -> symbol_information::Kind { "kind.function" => Function, "kind.interface" => Interface, "kind.method" => Method, + "kind.module" => Module, "kind.namespace" => Namespace, "kind.package" => Package, "kind.property" => Property, @@ -54,6 +55,7 @@ pub fn symbol_kind_to_ctags_kind(kind: &symbol_information::Kind) -> Option<&'st Function => Some("function"), Interface => Some("interface"), Method => Some("method"), + Module => Some("module"), Namespace => Some("namespace"), Package => Some("package"), Property => Some("property"), 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 2797aa8a44d6..3ac5bb4bc2f8 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 From 996f7d5763e616bfbc97e87323c7adfbd46afa97 Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Wed, 25 Oct 2023 07:45:47 -0700 Subject: [PATCH 04/11] Emit enummember instead of enumerator --- .../syntax-highlighter/crates/scip-syntax/src/ts_scip.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 04e1b3850a74..8f2a428358a2 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 @@ -49,7 +49,7 @@ pub fn symbol_kind_to_ctags_kind(kind: &symbol_information::Kind) -> Option<&'st Constant => Some("constant"), Constructor => Some("constructor"), Enum => Some("enum"), - EnumMember => Some("enumerator"), + EnumMember => Some("enummember"), Event => Some("event"), Field => Some("field"), Function => Some("function"), From 0da7f124b1458c32ca261d6b33dac48fa58e5892 Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Wed, 25 Oct 2023 09:28:56 -0700 Subject: [PATCH 05/11] Update snapshots --- ...yntax__test__tags_snapshot_globals.cs.snap | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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 index 3ec64211052b..028247c7ecba 100644 --- 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 @@ -10,17 +10,17 @@ expression: "String::from_utf8_lossy(buf_writer.buffer())" {"_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":"enumerator","scope":"Longer.Namespace.Class.Swag"} -{"_type":"tag","name":"Socks","path":"globals.cs","language":"c_sharp","line":61,"kind":"enumerator","scope":"Longer.Namespace.Class.Swag"} -{"_type":"tag","name":"Sweater","path":"globals.cs","language":"c_sharp","line":60,"kind":"enumerator","scope":"Longer.Namespace.Class.Swag"} -{"_type":"tag","name":"Shirt","path":"globals.cs","language":"c_sharp","line":59,"kind":"enumerator","scope":"Longer.Namespace.Class.Swag"} +{"_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":"enumerator","scope":"Longer.Namespace.Class.ZigFeatureSet"} -{"_type":"tag","name":"CoolCommunity","path":"globals.cs","language":"c_sharp","line":74,"kind":"enumerator","scope":"Longer.Namespace.Class.ZigFeatureSet"} -{"_type":"tag","name":"BuildSystem","path":"globals.cs","language":"c_sharp","line":73,"kind":"enumerator","scope":"Longer.Namespace.Class.ZigFeatureSet"} -{"_type":"tag","name":"Comptime","path":"globals.cs","language":"c_sharp","line":72,"kind":"enumerator","scope":"Longer.Namespace.Class.ZigFeatureSet"} -{"_type":"tag","name":"Errors","path":"globals.cs","language":"c_sharp","line":71,"kind":"enumerator","scope":"Longer.Namespace.Class.ZigFeatureSet"} -{"_type":"tag","name":"None","path":"globals.cs","language":"c_sharp","line":70,"kind":"enumerator","scope":"Longer.Namespace.Class.ZigFeatureSet"} +{"_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"} From 063dee5af34ce25659b81cf21ab95d58bffbc642 Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Wed, 25 Oct 2023 09:34:50 -0700 Subject: [PATCH 06/11] Update SCIP dependency --- docker-images/syntax-highlighter/Cargo.lock | 5 +++-- docker-images/syntax-highlighter/Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docker-images/syntax-highlighter/Cargo.lock b/docker-images/syntax-highlighter/Cargo.lock index f30578325b96..31c602fa8520 100644 --- a/docker-images/syntax-highlighter/Cargo.lock +++ b/docker-images/syntax-highlighter/Cargo.lock @@ -1837,8 +1837,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", ] diff --git a/docker-images/syntax-highlighter/Cargo.toml b/docker-images/syntax-highlighter/Cargo.toml index 1d08f898da74..d0a6082d4a78 100644 --- a/docker-images/syntax-highlighter/Cargo.toml +++ b/docker-images/syntax-highlighter/Cargo.toml @@ -64,7 +64,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" From aa72f9c391ca6879af0310ba7f171889ffa81e34 Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Wed, 25 Oct 2023 10:09:46 -0700 Subject: [PATCH 07/11] Use new SCIP kinds --- .../scip-syntax/queries/c_sharp/scip-tags.scm | 2 +- .../crates/scip-syntax/queries/ruby/scip-tags.scm | 12 ++++++------ ...cip_syntax__test__scip_snapshot_globals.cs.snap | 2 +- ...yntax__test__scip_snapshot_ruby-globals.rb.snap | 14 +++++++------- ...cip_syntax__test__tags_snapshot_globals.cs.snap | 2 +- ...yntax__test__tags_snapshot_ruby-globals.rb.snap | 14 +++++++------- .../crates/scip-syntax/src/ts_scip.rs | 12 ++++++++++++ 7 files changed, 35 insertions(+), 23 deletions(-) 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 e977d4b2b3f9..29e2159d615c 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 @@ -15,4 +15,4 @@ (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.method) +(delegate_declaration name: (identifier) @descriptor.method @kind.delegate) 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 7db44943c280..a009c41b93c2 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 @@ -5,35 +5,35 @@ (class name: (_) @descriptor.type @kind.class) @scope (method name: (_) @descriptor.method @kind.method) @local -(singleton_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 @kind.property)) + 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 @kind.property)) + 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 @kind.property)) + arguments: (argument_list (simple_symbol) @descriptor.method @kind.setter)) (#eq? @_attr_writer "attr_writer") (#transform! ":(.*)" "$1=")) ;; alias_method :baz, :bar ((call - method: (identifier) @_alias_method @kind.method + method: (identifier) @_alias_method @descriptor.method @kind.methodalias arguments: (argument_list . - (simple_symbol) @descriptor.method)) + (simple_symbol))) (#eq? @_alias_method "alias_method") (#transform! ":(.*)" "$1")) 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 63ae0c7ba165..f819463a8435 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 @@ -62,7 +62,7 @@ expression: dumped } delegate int MyDelegate(); -// ^^^^^^^^^^ definition(Method) scip-ctags `Longer.Namespace`/Class#MyDelegate(). +// ^^^^^^^^^^ definition(Delegate) scip-ctags `Longer.Namespace`/Class#MyDelegate(). public event ChangedEventHandler Changed; // ^^^^^^^ definition(Event) scip-ctags `Longer.Namespace`/Class#Changed. 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 index 7c14640590ac..e2777449ac6d 100644 --- 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 @@ -51,7 +51,7 @@ expression: dumped module MyModule // ^^^^^^^^ definition(Module) scip-ctags MyModule/ def self.abc(base) -// ^^^ definition(Method) scip-ctags MyModule/abc(). +// ^^^ definition(SingletonMethod) scip-ctags MyModule/abc(). end class MyClass @@ -61,7 +61,7 @@ expression: dumped end def self.woo(base) -// ^^^ definition(Method) scip-ctags MyModule/MyClass#woo(). +// ^^^ definition(SingletonMethod) scip-ctags MyModule/MyClass#woo(). end end end @@ -69,12 +69,12 @@ expression: dumped class Foo // ^^^ definition(Class) scip-ctags Foo# attr_accessor :bar -// ^^^^ definition(Property) scip-ctags Foo#`bar=`(). -// ^^^^ definition(Property) scip-ctags Foo#bar(). +// ^^^^ definition(Accessor) scip-ctags Foo#`bar=`(). +// ^^^^ definition(Accessor) scip-ctags Foo#bar(). attr_reader :baz -// ^^^^ definition(Property) scip-ctags Foo#baz(). +// ^^^^ definition(Getter) scip-ctags Foo#baz(). attr_writer :qux -// ^^^^ definition(Property) scip-ctags Foo#`qux=`(). +// ^^^^ definition(Setter) scip-ctags Foo#`qux=`(). end class Aliased @@ -84,7 +84,7 @@ expression: dumped end alias_method :baz, :bar -// ^^^^ definition(Method) scip-ctags Aliased#baz(). +// ^^^^^^^^^^^^ definition(MethodAlias) scip-ctags Aliased#alias_method(). end class Parental 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 index 028247c7ecba..4ea7a6af7839 100644 --- 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 @@ -27,7 +27,7 @@ expression: "String::from_utf8_lossy(buf_writer.buffer())" {"_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":"method","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"} 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 index f61b9d1fe39f..ff9cc7375b0c 100644 --- 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 @@ -4,16 +4,16 @@ 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":"method","scope":"MyModule.MyClass"} +{"_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":"method","scope":"MyModule"} +{"_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":"property","scope":"Foo"} -{"_type":"tag","name":"baz","path":"ruby-globals.rb","language":"ruby","line":59,"kind":"property","scope":"Foo"} -{"_type":"tag","name":"bar=","path":"ruby-globals.rb","language":"ruby","line":58,"kind":"property","scope":"Foo"} -{"_type":"tag","name":"bar","path":"ruby-globals.rb","language":"ruby","line":58,"kind":"property","scope":"Foo"} +{"_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":"method","scope":"Aliased"} +{"_type":"tag","name":"alias_method","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"} 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 8f2a428358a2..ef0ea7273396 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,20 +21,26 @@ 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.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.module" => Module, "kind.namespace" => Namespace, "kind.package" => Package, "kind.property" => Property, + "kind.setter" => Setter, + "kind.singletonmethod" => SingletonMethod, "kind.struct" => Struct, "kind.typealias" => TypeAlias, _ => UnspecifiedKind, @@ -45,20 +51,26 @@ 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"), 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"), Module => Some("module"), Namespace => Some("namespace"), Package => Some("package"), Property => Some("property"), + Setter => Some("setter"), + SingletonMethod => Some("singletonMethod"), Struct => Some("struct"), TypeAlias => Some("typealias"), _ => None, From da77286417a43797a19d3fffa1950d932ac98f18 Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Wed, 25 Oct 2023 10:10:35 -0700 Subject: [PATCH 08/11] Always return kinds in camel case --- .../syntax-highlighter/crates/scip-syntax/src/ts_scip.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 ef0ea7273396..e352ac99d160 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 @@ -57,7 +57,7 @@ pub fn symbol_kind_to_ctags_kind(kind: &symbol_information::Kind) -> Option<&'st Constructor => Some("constructor"), Delegate => Some("delegate"), Enum => Some("enum"), - EnumMember => Some("enummember"), + EnumMember => Some("enumMember"), Event => Some("event"), Field => Some("field"), Function => Some("function"), @@ -72,7 +72,7 @@ pub fn symbol_kind_to_ctags_kind(kind: &symbol_information::Kind) -> Option<&'st Setter => Some("setter"), SingletonMethod => Some("singletonMethod"), Struct => Some("struct"), - TypeAlias => Some("typealias"), + TypeAlias => Some("typeAlias"), _ => None, } } From f77f71779ea5f102fa24ea0784e5bf57eda44037 Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Wed, 25 Oct 2023 10:13:56 -0700 Subject: [PATCH 09/11] Fix ruby method alias --- .../scip-syntax/queries/ruby/scip-tags.scm | 4 ++-- ...yntax__test__tags_snapshot_globals.cs.snap | 20 +++++++++---------- ...ax__test__tags_snapshot_go-globals.go.snap | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) 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 a009c41b93c2..daa1283a618f 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 @@ -30,10 +30,10 @@ ;; alias_method :baz, :bar ((call - method: (identifier) @_alias_method @descriptor.method @kind.methodalias + method: (identifier) @_alias_method arguments: (argument_list . - (simple_symbol))) + (simple_symbol) @descriptor.method @kind.methodalias)) (#eq? @_alias_method "alias_method") (#transform! ":(.*)" "$1")) 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 index 4ea7a6af7839..4dfff617ec6e 100644 --- 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 @@ -10,17 +10,17 @@ expression: "String::from_utf8_lossy(buf_writer.buffer())" {"_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":"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":"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"} 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 fc21d28b608c..f2982df74200 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 @@ -19,6 +19,6 @@ expression: "String::from_utf8_lossy(buf_writer.buffer())" {"_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"} +{"_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"} From c5499e75077e2d0384e9d56f12ad0a69788d591c Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Wed, 25 Oct 2023 10:14:49 -0700 Subject: [PATCH 10/11] Update snapshots --- .../scip_syntax__test__scip_snapshot_ruby-globals.rb.snap | 2 +- .../scip_syntax__test__tags_snapshot_ruby-globals.rb.snap | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 index e2777449ac6d..32f7e79273c3 100644 --- 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 @@ -84,7 +84,7 @@ expression: dumped end alias_method :baz, :bar -// ^^^^^^^^^^^^ definition(MethodAlias) scip-ctags Aliased#alias_method(). +// ^^^^ definition(MethodAlias) scip-ctags Aliased#baz(). end class Parental 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 index ff9cc7375b0c..441b9ee0641f 100644 --- 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 @@ -13,7 +13,7 @@ expression: "String::from_utf8_lossy(buf_writer.buffer())" {"_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":"alias_method","path":"ruby-globals.rb","language":"ruby","line":67,"kind":"methodAlias","scope":"Aliased"} +{"_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"} From 42721f81d0010fd90d24a7194c209178abae4861 Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Wed, 25 Oct 2023 10:32:30 -0700 Subject: [PATCH 11/11] Update Cargo.lock --- .../syntax-highlighter/Cargo.Bazel.lock | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/docker-images/syntax-highlighter/Cargo.Bazel.lock b/docker-images/syntax-highlighter/Cargo.Bazel.lock index 7ad584782e2b..d551f1025c91 100644 --- a/docker-images/syntax-highlighter/Cargo.Bazel.lock +++ b/docker-images/syntax-highlighter/Cargo.Bazel.lock @@ -1,5 +1,5 @@ { - "checksum": "a30200fddef89273f32721d5e5e6b1e44a4d56104443ffb9e2bc722f6ca165ab", + "checksum": "288db33db039b863e97c43a6dc03bbb6fe334ab97e11d52e00b63dd3e6c17487", "crates": { "addr2line 0.20.0": { "name": "addr2line", @@ -10125,16 +10125,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": [ @@ -10163,7 +10160,7 @@ "selects": {} }, "edition": "2021", - "version": "0.1.1" + "version": "0.3.1" }, "license": "Apache-2.0" }, @@ -10264,7 +10261,7 @@ "target": "rustc_hash" }, { - "id": "scip 0.1.1", + "id": "scip 0.3.1", "target": "scip" }, { @@ -10322,7 +10319,7 @@ "target": "protobuf" }, { - "id": "scip 0.1.1", + "id": "scip 0.3.1", "target": "scip" }, { @@ -10382,7 +10379,7 @@ "target": "protobuf" }, { - "id": "scip 0.1.1", + "id": "scip 0.3.1", "target": "scip" } ], @@ -10429,7 +10426,7 @@ "target": "lazy_static" }, { - "id": "scip 0.1.1", + "id": "scip 0.3.1", "target": "scip" }, { @@ -10907,7 +10904,7 @@ "target": "rocket" }, { - "id": "scip 0.1.1", + "id": "scip 0.3.1", "target": "scip" }, { @@ -11774,7 +11771,7 @@ "target": "rustyline" }, { - "id": "scip 0.1.1", + "id": "scip 0.3.1", "target": "scip" }, {