Skip to content

Commit

Permalink
Do not store edit events for non-package.json files
Browse files Browse the repository at this point in the history
  • Loading branch information
osiewicz committed Dec 3, 2024
1 parent 1cde69b commit cccbe6e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<str> = change.text.into();
Expand All @@ -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<str> = params.text_document.text.into();
self.file_contents
Expand Down

0 comments on commit cccbe6e

Please sign in to comment.