1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 15:24:46 -05:00

perf(lsp): fix redundant walk when collecting tsc code lenses (#20974)

This commit is contained in:
Nayeem Rahman 2023-10-25 21:51:02 +01:00 committed by GitHub
parent be97170a19
commit 79a9f2a77c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -427,6 +427,11 @@ async fn collect_tsc(
line_index: Arc<LineIndex>, line_index: Arc<LineIndex>,
navigation_tree: &NavigationTree, navigation_tree: &NavigationTree,
) -> Result<Vec<lsp::CodeLens>, AnyError> { ) -> Result<Vec<lsp::CodeLens>, AnyError> {
if !workspace_settings.code_lens.implementations
&& !workspace_settings.code_lens.references
{
return Ok(vec![]);
}
let code_lenses = Rc::new(RefCell::new(Vec::new())); let code_lenses = Rc::new(RefCell::new(Vec::new()));
navigation_tree.walk(&|i, mp| { navigation_tree.walk(&|i, mp| {
let mut code_lenses = code_lenses.borrow_mut(); let mut code_lenses = code_lenses.borrow_mut();