Skip to content

Commit 2a2ec99

Browse files
author
jordanbreen28
committed
CAT-1670 - Fix undefined variable json_rpc_handler
Prior to this commit, we would see in the language server logs that we were referencing an undefined variable `json_rpc_handler`. This had knock on effects, such as registering the onTypeformatting provider, meaning this setting would not work when enabled. We now update the json_rpc_handler send message event to be consistent with the rest of the language server, and to fix the undefined variable error. The dynamically registered providers, like onTypeFormatting, will now work as expected.
1 parent f36499a commit 2a2ec99

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/puppet-languageserver/message_handler.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,12 @@ def notification_initialized(_, _json_rpc_message)
300300
# Raise a warning if the Puppet version is mismatched
301301
server_options = protocol.connection.server.server_options
302302
unless server_options[:puppet_version].nil? || server_options[:puppet_version] == Puppet.version
303-
json_rpc_handler.send_show_message_notification(
304-
LSP::MessageType::WARNING,
305-
"Unable to use Puppet version '#{server_options[:puppet_version]}' as it is not available. Using version '#{Puppet.version}' instead."
303+
protocol.encode_and_send(
304+
::PuppetEditorServices::Protocol::JsonRPCMessages.new_notification(
305+
'window/showMessage',
306+
'type' => LSP::MessageType::WARNING,
307+
'message' => "Unable to use Puppet version '#{server_options[:puppet_version]}' as it is not available. Using version '#{Puppet.version}' instead."
308+
)
306309
)
307310
end
308311

0 commit comments

Comments
 (0)