mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 05:44:56 +00:00
[ty] Optimize "workspace symbols" retrieval
Basically, this splits the implementation into two pieces: the first piece does the traversal and finds *all* symbols across the workspace. The second piece does filtering based on a user provided query string. Only the first piece is cached by Salsa. This brings warm "workspace symbols" requests down from 500-600ms to 100-200ms.
This commit is contained in:
parent
8ead02e0b1
commit
fb2d0af18c
5 changed files with 51 additions and 30 deletions
|
@ -8,7 +8,7 @@ pub fn document_symbols_with_options(
|
|||
file: File,
|
||||
options: &SymbolsOptions,
|
||||
) -> Vec<SymbolInfo> {
|
||||
symbols_for_file(db, file, options)
|
||||
symbols_for_file(db, file, options).cloned().collect()
|
||||
}
|
||||
|
||||
/// Get all document symbols for a file (hierarchical by default).
|
||||
|
@ -94,13 +94,13 @@ class MyClass:
|
|||
class_var = 100
|
||||
typed_class_var: str = 'class_typed'
|
||||
annotated_class_var: float
|
||||
|
||||
|
||||
def __init__(self):
|
||||
self.instance_var = 0
|
||||
|
||||
|
||||
def public_method(self):
|
||||
return self.instance_var
|
||||
|
||||
|
||||
def _private_method(self):
|
||||
pass
|
||||
|
||||
|
@ -256,10 +256,10 @@ def standalone_function():
|
|||
"
|
||||
class OuterClass:
|
||||
OUTER_CONSTANT = 100
|
||||
|
||||
|
||||
def outer_method(self):
|
||||
return self.OUTER_CONSTANT
|
||||
|
||||
|
||||
class InnerClass:
|
||||
def inner_method(self):
|
||||
pass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue