Skip to content

Commit 3848f10

Browse files
committed
(GH-53) Respond to 'textDocument/didClose' notification
The didClose notification is sent when a user closes a text file in the editor. This commit updates the language server to remove the document from the local document store when the user closes the document.
1 parent 04d6ccc commit 3848f10

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

server/lib/puppet-languageserver/message_router.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ def receive_notification(method, params)
131131
documents.set_document(file_uri, content)
132132
reply_diagnostics(file_uri, PuppetLanguageServer::DocumentValidator.validate(content))
133133

134+
when 'textDocument/didClose'
135+
PuppetLanguageServer.log_message(:info, 'Received textDocument/didClose notification.')
136+
file_uri = params['textDocument']['uri']
137+
documents.remove_document(file_uri)
138+
134139
when 'textDocument/didChange'
135140
PuppetLanguageServer.log_message(:info, 'Received textDocument/didChange notification.')
136141
file_uri = params['textDocument']['uri']

0 commit comments

Comments
 (0)