zeta2: Parse imports via Tree-sitter queries + improve zeta retrieval-stats (#39735)
Release Notes: - N/A --------- Co-authored-by: Max <max@zed.dev> Co-authored-by: Agus <agus@zed.dev> Co-authored-by: Oleksiy <oleksiy@zed.dev>
This commit is contained in:
co-authored by
Max
Agus
Oleksiy
parent
5fd187769d
commit
bcef3b5010
@@ -17,3 +17,4 @@ brackets = [
|
||||
]
|
||||
debuggers = ["CodeLLDB", "GDB"]
|
||||
documentation_comment = { start = "/*", prefix = "* ", end = "*/", tab_size = 1 }
|
||||
import_path_strip_regex = "^<|>$"
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
(preproc_include
|
||||
path: [
|
||||
(
|
||||
(system_lib_string) @source @wildcard
|
||||
(#strip! @source "[<>]"))
|
||||
(string_literal (string_content) @source @wildcard)
|
||||
]) @import
|
||||
@@ -17,3 +17,4 @@ brackets = [
|
||||
]
|
||||
debuggers = ["CodeLLDB", "GDB"]
|
||||
documentation_comment = { start = "/*", prefix = "* ", end = "*/", tab_size = 1 }
|
||||
import_path_strip_regex = "^<|>$"
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
(preproc_include
|
||||
path: [
|
||||
((system_lib_string) @source @wildcard)
|
||||
(string_literal (string_content) @source @wildcard)
|
||||
]) @import
|
||||
@@ -0,0 +1,14 @@
|
||||
(import_spec
|
||||
name: [
|
||||
(dot)
|
||||
(package_identifier)
|
||||
]
|
||||
path: (interpreted_string_literal
|
||||
(interpreted_string_literal_content) @namespace)
|
||||
) @wildcard @import
|
||||
|
||||
(import_spec
|
||||
!name
|
||||
path: (interpreted_string_literal
|
||||
(interpreted_string_literal_content) @namespace)
|
||||
) @wildcard @import
|
||||
@@ -23,6 +23,7 @@ tab_size = 2
|
||||
scope_opt_in_language_servers = ["tailwindcss-language-server", "emmet-language-server"]
|
||||
prettier_parser_name = "babel"
|
||||
debuggers = ["JavaScript"]
|
||||
import_path_strip_regex = "(?:/index)?\\.[jt]s$"
|
||||
|
||||
[jsx_tag_auto_close]
|
||||
open_tag_node_name = "jsx_opening_element"
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
(import_statement
|
||||
import_clause: (import_clause
|
||||
[
|
||||
(identifier) @name
|
||||
(named_imports
|
||||
(import_specifier
|
||||
name: (_) @name
|
||||
alias: (_)? @alias))
|
||||
])
|
||||
source: (string (string_fragment) @source)) @import
|
||||
|
||||
(import_statement
|
||||
!import_clause
|
||||
source: (string (string_fragment) @source @wildcard)) @import
|
||||
@@ -35,3 +35,4 @@ decrease_indent_patterns = [
|
||||
{ pattern = "^\\s*except\\b.*:\\s*(#.*)?", valid_after = ["try", "except"] },
|
||||
{ pattern = "^\\s*finally\\b.*:\\s*(#.*)?", valid_after = ["try", "except", "else"] },
|
||||
]
|
||||
import_path_strip_regex = "/__init__\\.py$"
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
(import_statement
|
||||
name: [
|
||||
(dotted_name
|
||||
((identifier) @namespace ".")*
|
||||
(identifier) @namespace .)
|
||||
(aliased_import
|
||||
name: (dotted_name
|
||||
((identifier) @namespace ".")*
|
||||
(identifier) @namespace .))
|
||||
]) @wildcard @import
|
||||
|
||||
(import_from_statement
|
||||
module_name: [
|
||||
(dotted_name
|
||||
((identifier) @namespace ".")*
|
||||
(identifier) @namespace .)
|
||||
(relative_import
|
||||
(dotted_name
|
||||
((identifier) @namespace ".")*
|
||||
(identifier) @namespace .)?)
|
||||
]
|
||||
(wildcard_import)? @wildcard
|
||||
name: [
|
||||
(dotted_name
|
||||
((identifier) @namespace ".")*
|
||||
(identifier) @name .)
|
||||
(aliased_import
|
||||
name: (dotted_name
|
||||
((identifier) @namespace ".")*
|
||||
(identifier) @name .)
|
||||
alias: (identifier) @alias)
|
||||
]?) @import
|
||||
@@ -17,3 +17,5 @@ brackets = [
|
||||
collapsed_placeholder = " /* ... */ "
|
||||
debuggers = ["CodeLLDB", "GDB"]
|
||||
documentation_comment = { start = "/*", prefix = "* ", end = "*/", tab_size = 1 }
|
||||
ignored_import_segments = ["crate", "super"]
|
||||
import_path_strip_regex = "/(lib|mod)\\.rs$"
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
(use_declaration) @import
|
||||
|
||||
(scoped_use_list
|
||||
path: (_) @namespace
|
||||
list: (_) @list)
|
||||
|
||||
(scoped_identifier
|
||||
path: (_) @namespace
|
||||
name: (identifier) @name)
|
||||
|
||||
(use_list (identifier) @name)
|
||||
|
||||
(use_declaration (identifier) @name)
|
||||
|
||||
(use_as_clause
|
||||
path: (scoped_identifier
|
||||
path: (_) @namespace
|
||||
name: (_) @name)
|
||||
alias: (_) @alias)
|
||||
|
||||
(use_as_clause
|
||||
path: (identifier) @name
|
||||
alias: (_) @alias)
|
||||
|
||||
(use_wildcard
|
||||
(_)? @namespace
|
||||
"*" @wildcard)
|
||||
@@ -0,0 +1,14 @@
|
||||
(import_statement
|
||||
import_clause: (import_clause
|
||||
[
|
||||
(identifier) @name
|
||||
(named_imports
|
||||
(import_specifier
|
||||
name: (_) @name
|
||||
alias: (_)? @alias))
|
||||
])
|
||||
source: (string (string_fragment) @source)) @import
|
||||
|
||||
(import_statement
|
||||
!import_clause
|
||||
source: (string (string_fragment) @source @wildcard)) @import
|
||||
@@ -22,6 +22,7 @@ prettier_parser_name = "typescript"
|
||||
tab_size = 2
|
||||
debuggers = ["JavaScript"]
|
||||
scope_opt_in_language_servers = ["tailwindcss-language-server"]
|
||||
import_path_strip_regex = "(?:/index)?\\.[jt]s$"
|
||||
|
||||
[overrides.string]
|
||||
completion_query_characters = ["-", "."]
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
(import_statement
|
||||
import_clause: (import_clause
|
||||
[
|
||||
(identifier) @name
|
||||
(named_imports
|
||||
(import_specifier
|
||||
name: (_) @name
|
||||
alias: (_)? @alias))
|
||||
(namespace_import) @wildcard
|
||||
])
|
||||
source: (string (string_fragment) @source)) @import
|
||||
|
||||
(import_statement
|
||||
!source
|
||||
import_clause: (import_require_clause
|
||||
source: (string (string_fragment) @source))) @wildcard @import
|
||||
|
||||
(import_statement
|
||||
!import_clause
|
||||
source: (string (string_fragment) @source)) @wildcard @import
|
||||
Reference in New Issue
Block a user