
An alternative might be to adjust the logic to not nest items when their ranges are the same, but then clicking them doesn't work properly / moving the cursor does not change which is selected. This could probably be made to work with some extra logic there, but it seems overkill. The downside of fixing it at the query level is that other parts of the declaration are not inside the item range. This seems to be fine for single line declarations - the nearest outline item is highlighted. However, if a part of the declaration is not included in an item range and is on its own line, then no outline item is highlighted. Release Notes: - Outline Panel: Fixed nesting of var and field declarations with multiple identifiers in Go and C++ C++ before: <img width="743" height="227" alt="image" src="https://github.com/user-attachments/assets/af1a1d76-ecdc-4999-ae9c-95591726ccca" /> C++ after: <img width="795" height="250" alt="image" src="https://github.com/user-attachments/assets/49667ed3-e088-48b3-a9f0-6a119b5e7648" /> Go before: <img width="859" height="306" alt="image" src="https://github.com/user-attachments/assets/ecc7530a-ca16-4f37-b8d1-60687f178b12" /> Go after: <img width="900" height="334" alt="image" src="https://github.com/user-attachments/assets/d741cfb0-59e5-4d27-bd6a-f422204dc972" />
119 lines
2.8 KiB
Scheme
119 lines
2.8 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
|
|
; Multiple names may be exported - @item is on the declarator to keep
|
|
; ranges distinct.
|
|
(variable_declarator
|
|
name: (_) @name) @item)))
|
|
|
|
(program
|
|
(lexical_declaration
|
|
["let" "const"] @context
|
|
; Multiple names may be defined - @item is on the declarator to keep
|
|
; ranges distinct.
|
|
(variable_declarator
|
|
name: (_) @name) @item))
|
|
|
|
(class_declaration
|
|
"class" @context
|
|
name: (_) @name) @item
|
|
|
|
(method_definition
|
|
[
|
|
"get"
|
|
"set"
|
|
"async"
|
|
"*"
|
|
"readonly"
|
|
"static"
|
|
(override_modifier)
|
|
(accessibility_modifier)
|
|
]* @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
|
|
|
|
(comment) @annotation
|