class LanguageServer::Protocol::Interface::CodeLens

A code lens represents a command that should be shown along with source text, like the number of references, a way to run tests, etc.

A code lens is unresolved when no command is associated to it. For performance reasons the creation of a code lens and resolving should be done in two stages.

Attributes

attributes[R]

Public Class Methods

new(range:, command: nil, data: nil) click to toggle source
# File lib/language_server/protocol/interface/code_lens.rb, line 13
def initialize(range:, command: nil, data: nil)
  @attributes = {}

  @attributes[:range] = range
  @attributes[:command] = command if command
  @attributes[:data] = data if data

  @attributes.freeze
end

Public Instance Methods

command() click to toggle source

The command this code lens represents.

@return [Command]

# File lib/language_server/protocol/interface/code_lens.rb, line 36
def command
  attributes.fetch(:command)
end
data() click to toggle source

A data entry field that is preserved on a code lens item between a code lens and a code lens resolve request.

@return [any]

# File lib/language_server/protocol/interface/code_lens.rb, line 45
def data
  attributes.fetch(:data)
end
range() click to toggle source

The range in which this code lens is valid. Should only span a single line.

@return [Range]

# File lib/language_server/protocol/interface/code_lens.rb, line 28
def range
  attributes.fetch(:range)
end
to_hash() click to toggle source
# File lib/language_server/protocol/interface/code_lens.rb, line 51
def to_hash
  attributes
end
to_json(*args) click to toggle source
# File lib/language_server/protocol/interface/code_lens.rb, line 55
def to_json(*args)
  to_hash.to_json(*args)
end