Skip to content

Commit 23e6ac0

Browse files
author
jordanbreen28
committed
(maint) - Rubocop fixes
1 parent b838eba commit 23e6ac0

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

lib/puppet-languageserver/global_queues/validation_queue.rb

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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
111102
end

lib/puppet-languageserver/message_handler.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,8 @@ def notification_textdocument_didopen(client_handler_id, json_rpc_message)
331331
def notification_textdocument_didclose(client_handler_id, json_rpc_message)
332332
PuppetLanguageServer.log_message(:info, 'Received textDocument/didClose notification.')
333333
file_uri = json_rpc_message.params['textDocument']['uri']
334-
doc_version = json_rpc_message.params['textDocument']['version']
335334
documents.remove_document(file_uri)
336-
enqueue_validation(file_uri, doc_version, client_handler_id)
335+
enqueue_validation(file_uri, nil, client_handler_id)
337336
end
338337

339338
def notification_textdocument_didchange(client_handler_id, json_rpc_message)
@@ -392,8 +391,7 @@ def unhandled_exception(error, options)
392391

393392
private
394393

395-
def enqueue_validation(file_uri, doc_version, client_handler_id)
396-
options = {}
394+
def enqueue_validation(file_uri, doc_version, client_handler_id, options = {})
397395
if documents.document_type(file_uri) == :puppetfile
398396
options[:resolve_puppetfile] = language_client.use_puppetfile_resolver
399397
options[:puppet_version] = Puppet.version

0 commit comments

Comments
 (0)