@@ -35,16 +35,16 @@ def execute_job(job_object)
3535 session_state = session_state_from_connection_id ( job_object . connection_id )
3636 document_store = session_state . nil? ? nil : session_state . documents
3737 raise "Document store is not available for connection id #{ job_object . connection_id } " unless document_store
38-
38+
3939 # Check if the document still exists
4040 doc = document_store . get_document ( job_object . file_uri )
4141 unless doc
4242 # Send an empty diagnostics message to clear the diagnostics
43- send_remove_diagnostic ( job_object . connection_id , job_object . file_uri , nil )
43+ send_diagnostics ( job_object . connection_id , job_object . file_uri , [ ] )
4444 PuppetLanguageServer . log_message ( :debug , "#{ self . class . name } : Ignoring #{ job_object . file_uri } as it is has been removed." )
4545 return
4646 end
47-
47+
4848 # Check if the document is the latest version
4949 content = document_store . document_content ( job_object . file_uri , job_object . doc_version )
5050 unless content
@@ -97,15 +97,6 @@ def send_diagnostics(connection_id, file_uri, diagnostics)
9797 ::PuppetEditorServices ::Protocol ::JsonRPCMessages . new_notification ( 'textDocument/publishDiagnostics' , 'uri' => file_uri , 'diagnostics' => diagnostics )
9898 )
9999 end
100-
101- def send_remove_diagnostic ( connection_id , file_uri , diagnostics )
102- connection = PuppetEditorServices ::Server . current_server . connection ( connection_id )
103- return if connection . nil?
104-
105- connection . protocol . encode_and_send (
106- ::PuppetEditorServices ::Protocol ::JsonRPCMessages . new_notification ( 'textDocument/publishDiagnostics' , 'uri' => file_uri , 'diagnostics' => [ ] )
107- )
108- end
109100 end
110101 end
111102end
0 commit comments