Class: LSP::Command

Inherits:
LSPBase show all
Defined in:
lib/lsp/lsp_types.rb

Overview

export interface Command { /** * Title of the command, like save. / title: string; /* * The identifier of the actual command handler. / command: string; /* * Arguments that the command handler should be * invoked with. */ arguments?: any; }

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from LSPBase

#to_h, #to_json

Constructor Details

#initialize(initial_hash = nil) ⇒ Command

Returns a new instance of Command.



343
344
345
346
# File 'lib/lsp/lsp_types.rb', line 343

def initialize(initial_hash = nil)
  super
  @optional_method_names = %i[arguments]
end

Instance Attribute Details

#argumentsObject

type: string # type: string # type: any



341
342
343
# File 'lib/lsp/lsp_types.rb', line 341

def arguments
  @arguments
end

#commandObject

type: string # type: string # type: any



341
342
343
# File 'lib/lsp/lsp_types.rb', line 341

def command
  @command
end

#titleObject

type: string # type: string # type: any



341
342
343
# File 'lib/lsp/lsp_types.rb', line 341

def title
  @title
end

Instance Method Details

#from_h!(value) ⇒ Object



348
349
350
351
352
353
354
# File 'lib/lsp/lsp_types.rb', line 348

def from_h!(value)
  value = {} if value.nil?
  self.title = value['title']
  self.command = value['command']
  self.arguments = value['arguments'].map { |val| val } unless value['arguments'].nil?
  self
end