2
2
//! It provides an interface between the LSP protocol and the sway-lsp internals.
3
3
4
4
use crate :: {
5
+ core:: document,
5
6
handlers:: { notification, request} ,
6
7
lsp_ext:: { OnEnterParams , ShowAstParams } ,
7
8
server_state:: ServerState ,
8
9
} ;
9
10
use lsp_types:: {
10
11
CodeActionParams , CodeActionResponse , CodeLens , CodeLensParams , CompletionParams ,
11
12
CompletionResponse , DidChangeTextDocumentParams , DidChangeWatchedFilesParams ,
12
- DidOpenTextDocumentParams , DidSaveTextDocumentParams , DocumentFormattingParams ,
13
- DocumentHighlight , DocumentHighlightParams , DocumentSymbolParams , DocumentSymbolResponse ,
14
- GotoDefinitionParams , GotoDefinitionResponse , Hover , HoverParams , InitializeParams ,
15
- InitializeResult , InitializedParams , InlayHint , InlayHintParams , PrepareRenameResponse ,
16
- RenameParams , SemanticTokensParams , SemanticTokensResult , TextDocumentIdentifier ,
17
- TextDocumentPositionParams , TextEdit , WorkspaceEdit ,
13
+ DidCloseTextDocumentParams , DidOpenTextDocumentParams , DidSaveTextDocumentParams ,
14
+ DocumentFormattingParams , DocumentHighlight , DocumentHighlightParams , DocumentSymbolParams ,
15
+ DocumentSymbolResponse , GotoDefinitionParams , GotoDefinitionResponse , Hover , HoverParams ,
16
+ InitializeParams , InitializeResult , InitializedParams , InlayHint , InlayHintParams ,
17
+ PrepareRenameResponse , RenameParams , SemanticTokensParams , SemanticTokensResult ,
18
+ TextDocumentIdentifier , TextDocumentPositionParams , TextEdit , WorkspaceEdit ,
18
19
} ;
19
20
use tower_lsp:: { jsonrpc:: Result , LanguageServer } ;
20
21
@@ -38,6 +39,12 @@ impl LanguageServer for ServerState {
38
39
}
39
40
}
40
41
42
+ async fn did_close ( & self , params : DidCloseTextDocumentParams ) {
43
+ if let Err ( err) = document:: remove_dirty_flag ( & params. text_document . uri ) {
44
+ tracing:: error!( "{}" , err. to_string( ) ) ;
45
+ }
46
+ }
47
+
41
48
async fn did_change ( & self , params : DidChangeTextDocumentParams ) {
42
49
if let Err ( err) = notification:: handle_did_change_text_document ( self , params) . await {
43
50
tracing:: error!( "{}" , err. to_string( ) ) ;
0 commit comments