
Functions like `function* iterateElements() {}` would not show up in the editor's navigation outline. With this change, they do. | **Before** | **After** |-|-| |<img width="453" height="280" alt="Screenshot 2025-07-13 at 4 58 22 PM" src="https://github.com/user-attachments/assets/822f0774-bda2-4855-a6dd-80ba82fffaf3" />|<img width="564" height="373" alt="Screenshot 2025-07-13 at 4 58 55 PM" src="https://github.com/user-attachments/assets/f4f6b84f-cd26-49b7-923b-724860eb18ad" />| Note that I decided to use Zed's agent assistance features to do this PR as a sort of test run. I don't normally code with an AI assistant, but figured it might be good in this case since I'm unfamiliar with the codebase. I must say I was fairly impressed. All the changes in this PR were done by Claude Sonnet 4, though I have done a manual review to ensure the changes look sane and tested the changes by running the re-built `zed` binary with a toy project. Closes #21631 Release Notes: - Fixed JS/TS outlines to show generator functions.
123 lines
2.7 KiB
Scheme
123 lines
2.7 KiB
Scheme
(internal_module
|
|
"namespace" @context
|
|
name: (_) @name) @item
|
|
|
|
(enum_declaration
|
|
"enum" @context
|
|
name: (_) @name) @item
|
|
|
|
(type_alias_declaration
|
|
"type" @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
|
|
|
|
(export_statement
|
|
(lexical_declaration
|
|
["let" "const"] @context
|
|
(variable_declarator
|
|
name: (_) @name) @item))
|
|
|
|
(program
|
|
(lexical_declaration
|
|
["let" "const"] @context
|
|
(variable_declarator
|
|
name: (_) @name) @item))
|
|
|
|
(class_declaration
|
|
"class" @context
|
|
name: (_) @name) @item
|
|
|
|
(abstract_class_declaration
|
|
"abstract" @context
|
|
"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")
|
|
(#any-of? @_property "each")
|
|
)
|
|
arguments: (
|
|
arguments . [
|
|
(string (string_fragment) @name)
|
|
(identifier) @name
|
|
]
|
|
)
|
|
)
|
|
) @item
|
|
|
|
(comment) @annotation
|