Added more granular symbols for ts and js in outline panel. This is a bit closer to what vscode offers. <details><summary>Screenshots of current vs new</summary> <p> New: <img width="1723" height="1221" alt="image" src="https://github.com/user-attachments/assets/796d3b59-fffa-4a66-9986-f7c75e618103" /> Current: <img width="1714" height="1347" alt="image" src="https://github.com/user-attachments/assets/f7cff463-de2a-4d86-b1a6-e19f4fd8dc6e" /> Current vscode (cursor): <img width="1710" height="1177" alt="image" src="https://github.com/user-attachments/assets/31902d52-becf-4d3f-960d-7e054e00e32d" /> </p> </details> I have never touched scheme before, and pair-programmed this with ai, so please let me know if there's any glaring issues with the implementation. I just miss the outline panel in vscode very much, and would love to see this land. Happy to help with tsx/jsx as well if this is the direction you guys were thinking of taking the outline impl. Doesn't fully close https://github.com/zed-industries/zed/issues/20964 as there is no support for chained class method callbacks or `Class.prototype.method = ...` as mentioned in https://github.com/zed-industries/zed/issues/21243, but this is a step forward. Release Notes: - Improved typescript and javascript symbol outline panel
224 lines
6.1 KiB
Scheme
224 lines
6.1 KiB
Scheme
(internal_module
|
|
"namespace" @context
|
|
name: (_) @name) @item
|
|
|
|
(enum_declaration
|
|
"enum" @context
|
|
name: (_) @name) @item
|
|
|
|
(function_declaration
|
|
"async"? @context
|
|
"function" @context
|
|
name: (_) @name
|
|
parameters: (formal_parameters
|
|
"(" @context
|
|
")" @context)) @item
|
|
|
|
(generator_function_declaration
|
|
"async"? @context
|
|
"function" @context
|
|
"*" @context
|
|
name: (_) @name
|
|
parameters: (formal_parameters
|
|
"(" @context
|
|
")" @context)) @item
|
|
|
|
(interface_declaration
|
|
"interface" @context
|
|
name: (_) @name) @item
|
|
|
|
(program
|
|
(export_statement
|
|
(lexical_declaration
|
|
["let" "const"] @context
|
|
(variable_declarator
|
|
name: (identifier) @name) @item)))
|
|
|
|
; Exported array destructuring
|
|
(program
|
|
(export_statement
|
|
(lexical_declaration
|
|
["let" "const"] @context
|
|
(variable_declarator
|
|
name: (array_pattern
|
|
[
|
|
(identifier) @name @item
|
|
(assignment_pattern left: (identifier) @name @item)
|
|
(rest_pattern (identifier) @name @item)
|
|
])))))
|
|
|
|
; Exported object destructuring
|
|
(program
|
|
(export_statement
|
|
(lexical_declaration
|
|
["let" "const"] @context
|
|
(variable_declarator
|
|
name: (object_pattern
|
|
[(shorthand_property_identifier_pattern) @name @item
|
|
(pair_pattern
|
|
value: (identifier) @name @item)
|
|
(pair_pattern
|
|
value: (assignment_pattern left: (identifier) @name @item))
|
|
(rest_pattern (identifier) @name @item)])))))
|
|
|
|
(program
|
|
(lexical_declaration
|
|
["let" "const"] @context
|
|
(variable_declarator
|
|
name: (identifier) @name) @item))
|
|
|
|
; Top-level array destructuring
|
|
(program
|
|
(lexical_declaration
|
|
["let" "const"] @context
|
|
(variable_declarator
|
|
name: (array_pattern
|
|
[
|
|
(identifier) @name @item
|
|
(assignment_pattern left: (identifier) @name @item)
|
|
(rest_pattern (identifier) @name @item)
|
|
]))))
|
|
|
|
; Top-level object destructuring
|
|
(program
|
|
(lexical_declaration
|
|
["let" "const"] @context
|
|
(variable_declarator
|
|
name: (object_pattern
|
|
[(shorthand_property_identifier_pattern) @name @item
|
|
(pair_pattern
|
|
value: (identifier) @name @item)
|
|
(pair_pattern
|
|
value: (assignment_pattern left: (identifier) @name @item))
|
|
(rest_pattern (identifier) @name @item)]))))
|
|
|
|
(class_declaration
|
|
"class" @context
|
|
name: (_) @name) @item
|
|
|
|
; Method definitions in classes (not in object literals)
|
|
(class_body
|
|
(method_definition
|
|
[
|
|
"get"
|
|
"set"
|
|
"async"
|
|
"*"
|
|
"readonly"
|
|
"static"
|
|
(override_modifier)
|
|
(accessibility_modifier)
|
|
]* @context
|
|
name: (_) @name
|
|
parameters: (formal_parameters
|
|
"(" @context
|
|
")" @context)) @item)
|
|
|
|
; Object literal methods
|
|
(variable_declarator
|
|
value: (object
|
|
(method_definition
|
|
[
|
|
"get"
|
|
"set"
|
|
"async"
|
|
"*"
|
|
]* @context
|
|
name: (_) @name
|
|
parameters: (formal_parameters
|
|
"(" @context
|
|
")" @context)) @item))
|
|
|
|
(public_field_definition
|
|
[
|
|
"declare"
|
|
"readonly"
|
|
"abstract"
|
|
"static"
|
|
(accessibility_modifier)
|
|
]* @context
|
|
name: (_) @name) @item
|
|
|
|
; Add support for (node:test, bun:test and Jest) runnable
|
|
(
|
|
(call_expression
|
|
function: [
|
|
(identifier) @_name
|
|
(member_expression
|
|
object: [
|
|
(identifier) @_name
|
|
(member_expression object: (identifier) @_name)
|
|
]
|
|
)
|
|
] @context
|
|
(#any-of? @_name "it" "test" "describe" "context" "suite")
|
|
arguments: (
|
|
arguments . [
|
|
(string (string_fragment) @name)
|
|
(identifier) @name
|
|
]
|
|
)
|
|
)
|
|
) @item
|
|
|
|
; Add support for parameterized tests
|
|
(
|
|
(call_expression
|
|
function: (call_expression
|
|
function: (member_expression
|
|
object: [(identifier) @_name (member_expression object: (identifier) @_name)]
|
|
property: (property_identifier) @_property
|
|
)
|
|
(#any-of? @_name "it" "test" "describe" "context" "suite")
|
|
(#eq? @_property "each")
|
|
)
|
|
arguments: (
|
|
arguments . [
|
|
(string (string_fragment) @name)
|
|
(identifier) @name
|
|
]
|
|
)
|
|
)
|
|
) @item
|
|
|
|
; Object properties
|
|
(pair
|
|
key: [
|
|
(property_identifier) @name
|
|
(string (string_fragment) @name)
|
|
(number) @name
|
|
(computed_property_name) @name
|
|
]) @item
|
|
|
|
; Nested variables in function bodies
|
|
(statement_block
|
|
(lexical_declaration
|
|
["let" "const"] @context
|
|
(variable_declarator
|
|
name: (identifier) @name) @item))
|
|
|
|
; Nested array destructuring in functions
|
|
(statement_block
|
|
(lexical_declaration
|
|
["let" "const"] @context
|
|
(variable_declarator
|
|
name: (array_pattern
|
|
[
|
|
(identifier) @name @item
|
|
(assignment_pattern left: (identifier) @name @item)
|
|
(rest_pattern (identifier) @name @item)
|
|
]))))
|
|
|
|
; Nested object destructuring in functions
|
|
(statement_block
|
|
(lexical_declaration
|
|
["let" "const"] @context
|
|
(variable_declarator
|
|
name: (object_pattern
|
|
[(shorthand_property_identifier_pattern) @name @item
|
|
(pair_pattern value: (identifier) @name @item)
|
|
(pair_pattern value: (assignment_pattern left: (identifier) @name @item))
|
|
(rest_pattern (identifier) @name @item)]))))
|
|
|
|
(comment) @annotation
|