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

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

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

Returns a new instance of BaseSymbolInformation.

Parameters:

  • name: (String)
  • kind: (Object)
  • tags: (Array[untyped]) (defaults to: nil)
  • container_name: (String) (defaults to: nil)


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

#attributesHash[Symbol, untyped] (readonly)

Returns the value of attribute attributes.

Returns:

  • (Hash[Symbol, untyped])


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

def attributes
  @attributes
end

Instance Method Details

#container_namestring

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.

Returns:

  • (string)


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.

Returns:

  • (SymbolKind)


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.

Returns:

  • (string)


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

def name
  attributes.fetch(:name)
end

#tagsSymbolTag[]

Tags for this symbol.

Returns:

  • (SymbolTag[])

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_hashHash[Symbol, untyped]

Returns:

  • (Hash[Symbol, untyped])


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

def to_hash
  attributes
end

#to_json(*args) ⇒ String

Parameters:

  • (Object)

Returns:

  • (String)


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