Class: LSP::CodeLens

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

Overview

export interface CodeLens

/**
 * The range in which this code lens is valid. Should only span a single line.
 */
range: Range;
/**
 * The command this code lens represents.
 */
command?: Command;
/**
 * An data entry field that is preserved on a code lens item between
 * a [CodeLensRequest](#CodeLensRequest) and a [CodeLensResolveRequest]
 * (#CodeLensResolveRequest)
 */
data?: any;

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from LSPBase

#to_h, #to_json

Constructor Details

#initialize(initial_hash = nil) ⇒ CodeLens

Returns a new instance of CodeLens.



1286
1287
1288
1289
# File 'lib/lsp/lsp_types.rb', line 1286

def initialize(initial_hash = nil)
  super
  @optional_method_names = i[command data]
end

Instance Attribute Details

#commandObject

type: Range # type: Command # type: any



1284
1285
1286
# File 'lib/lsp/lsp_types.rb', line 1284

def command
  @command
end

#dataObject

type: Range # type: Command # type: any



1284
1285
1286
# File 'lib/lsp/lsp_types.rb', line 1284

def data
  @data
end

#rangeObject

type: Range # type: Command # type: any



1284
1285
1286
# File 'lib/lsp/lsp_types.rb', line 1284

def range
  @range
end

Instance Method Details

#from_h!(value) ⇒ Object



1291
1292
1293
1294
1295
1296
1297
# File 'lib/lsp/lsp_types.rb', line 1291

def from_h!(value)
  value = {} if value.nil?
  self.range = Range.new(value['range']) unless value['range'].nil?
  self.command = Command.new(value['command']) unless value['command'].nil?
  self.data = value['data']
  self
end