Class: TypeProf::LSP::Message::Workspace::ExecuteCommand
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
::TypeProf::LSP::Message
|
|
Instance Chain:
self,
::TypeProf::LSP::Message
|
|
Inherits: |
TypeProf::LSP::Message
|
Defined in: | lib/typeprof/lsp.rb |
Constant Summary
-
METHOD =
# File 'lib/typeprof/lsp.rb', line 498"workspace/executeCommand"
::TypeProf::LSP::Message
- Inherited
Class Method Summary
::TypeProf::LSP::Message
- Inherited
Instance Method Summary
Constructor Details
This class inherits a constructor from TypeProf::LSP::Message
Instance Method Details
#run
[ GitHub ]# File 'lib/typeprof/lsp.rb', line 499
def run case @params[:command] when "typeprof.enableSignature" @server.signature_enabled = true @server.send_request("workspace/codeLens/refresh") respond(nil) when "typeprof.disableSignature" @server.signature_enabled = false @server.send_request("workspace/codeLens/refresh") respond(nil) when "typeprof.createPrototypeRBS" class_kind, class_name, sig_str = @params[:arguments] code_range = CodeRange.new( CodeLocation.new(1, 0), CodeLocation.new(1, 0), ) text = [] text << "#{ class_kind } #{ class_name.join("::") }\n" text << " #{ sig_str }\n" text << "end\n\n" text = text.join @server.send_request( "workspace/applyEdit", edit: { changes: { @server.root_uri + "/typeprof.rbs" => [ { range: code_range.to_lsp, newText: text, } ], }, }, ) do |res| code_range = CodeRange.new( CodeLocation.new(1, 0), CodeLocation.new(3, 3), # 3 = "end".size ) @server.send_request( "window/showDocument", uri: @server.root_uri + "/typeprof.rbs", takeFocus: true, selection: code_range.to_lsp, ) end respond(nil) else respond_error( code: ErrorCodes::InvalidRequest, message: "Unknown command: #{ @params[:command] }", ) end end