From 79a9f2a77c1c517282a0e3ac77f8a1252b6c50b9 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Wed, 25 Oct 2023 21:51:02 +0100 Subject: [PATCH] perf(lsp): fix redundant walk when collecting tsc code lenses (#20974) --- cli/lsp/code_lens.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cli/lsp/code_lens.rs b/cli/lsp/code_lens.rs index d0885294fe..9da50a12fd 100644 --- a/cli/lsp/code_lens.rs +++ b/cli/lsp/code_lens.rs @@ -427,6 +427,11 @@ async fn collect_tsc( line_index: Arc, navigation_tree: &NavigationTree, ) -> Result, AnyError> { + if !workspace_settings.code_lens.implementations + && !workspace_settings.code_lens.references + { + return Ok(vec![]); + } let code_lenses = Rc::new(RefCell::new(Vec::new())); navigation_tree.walk(&|i, mp| { let mut code_lenses = code_lenses.borrow_mut();