From cccbe6ee1f6e3a1e281d0568f7735516af006df3 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Wed, 4 Dec 2024 00:06:10 +0100 Subject: [PATCH] Do not store edit events for non-package.json files --- src/main.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.rs b/src/main.rs index cdfc3d5..d3c246c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -67,6 +67,9 @@ impl LanguageServer for Backend { } async fn did_change(&self, params: DidChangeTextDocumentParams) { + if !params.text_document.uri.path().ends_with("package.json") { + return; + } if let Some(change) = params.content_changes.into_iter().next() { let mut parser = Self::get_parser(); let text: Arc = change.text.into(); @@ -91,6 +94,9 @@ impl LanguageServer for Backend { } async fn did_open(&self, params: DidOpenTextDocumentParams) { + if !params.text_document.uri.path().ends_with("package.json") { + return; + } let mut parser = Self::get_parser(); let text: Arc = params.text_document.text.into(); self.file_contents