From 742a5ea19bf25cecb67489aa21b148e3f9a076b3 Mon Sep 17 00:00:00 2001 From: rvcas Date: Tue, 15 Nov 2022 17:44:27 -0500 Subject: [PATCH] feat: handle didSave notification --- crates/lsp/src/server.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/lsp/src/server.rs b/crates/lsp/src/server.rs index a9743f27..8f90592d 100644 --- a/crates/lsp/src/server.rs +++ b/crates/lsp/src/server.rs @@ -9,7 +9,9 @@ use aiken_lang::{ast::ModuleKind, parser}; use aiken_project::{config, error::Error as ProjectError}; use lsp_server::{Connection, Message}; use lsp_types::{ - notification::{DidChangeTextDocument, Notification, PublishDiagnostics, ShowMessage}, + notification::{ + DidChangeTextDocument, DidSaveTextDocument, Notification, PublishDiagnostics, ShowMessage, + }, request::{Formatting, Request}, DocumentFormattingParams, InitializeParams, TextEdit, }; @@ -153,6 +155,13 @@ impl Server { notification: lsp_server::Notification, ) -> Result<(), ServerError> { match notification.method.as_str() { + DidSaveTextDocument::METHOD => { + let params = cast_notification::(notification)?; + + self.edited.remove(params.text_document.uri.path()); + + Ok(()) + } DidChangeTextDocument::METHOD => { let params = cast_notification::(notification)?; @@ -268,7 +277,6 @@ impl Server { /// If the Aiken diagnostic cannot be converted to LSP diagnostic (due to it /// not having a location) it is stored as a message suitable for use with /// the `showMessage` notification instead. - /// fn process_diagnostic(&mut self, error: ProjectError) -> Result<(), ServerError> { let (severity, typ) = match error.severity() { Some(severity) => match severity {