Class: LanguageServer::Protocol::Interface::BaseSymbolInformation

Inherits:
Object
  • Object
show all
Defined in:
lib/language_server/protocol/interface/base_symbol_information.rb

Overview

A base for all symbol information.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, kind:, tags: nil, container_name: nil) ⇒ BaseSymbolInformation



8
9
10
11
12
13
14
15
16
17
# File 'lib/language_server/protocol/interface/base_symbol_information.rb', line 8

def initialize(name:, kind:, tags: nil, container_name: nil)
  @attributes = {}

  @attributes[:name] = name
  @attributes[:kind] = kind
  @attributes[:tags] = tags if tags
  @attributes[:containerName] = container_name if container_name

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



56
57
58
# File 'lib/language_server/protocol/interface/base_symbol_information.rb', line 56

def attributes
  @attributes
end

Instance Method Details

#container_namestring | nil

The name of the symbol containing this symbol. This information is for user interface purposes (e.g. to render a qualifier in the user interface if necessary). It can’t be used to re-infer a hierarchy for the document symbols.



52
53
54
# File 'lib/language_server/protocol/interface/base_symbol_information.rb', line 52

def container_name
  attributes.fetch(:containerName)
end

#kindSymbolKind

The kind of this symbol.



31
32
33
# File 'lib/language_server/protocol/interface/base_symbol_information.rb', line 31

def kind
  attributes.fetch(:kind)
end

#namestring

The name of this symbol.



23
24
25
# File 'lib/language_server/protocol/interface/base_symbol_information.rb', line 23

def name
  attributes.fetch(:name)
end

#tagsSymbolTag[] | nil

Tags for this symbol.

Since:

  • 3.16.0



41
42
43
# File 'lib/language_server/protocol/interface/base_symbol_information.rb', line 41

def tags
  attributes.fetch(:tags)
end

#to_hashObject



58
59
60
# File 'lib/language_server/protocol/interface/base_symbol_information.rb', line 58

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



62
63
64
# File 'lib/language_server/protocol/interface/base_symbol_information.rb', line 62

def to_json(*args)
  to_hash.to_json(*args)
end