Class: LanguageServer::Protocol::Interface::TypeHierarchyItem

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, kind:, tags: nil, detail: nil, uri:, range:, selection_range:, data: nil) ⇒ TypeHierarchyItem

Returns a new instance of TypeHierarchyItem.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/language_server/protocol/interface/type_hierarchy_item.rb', line 5

def initialize(name:, kind:, tags: nil, detail: nil, uri:, range:, selection_range:, data: nil)
  @attributes = {}

  @attributes[:name] = name
  @attributes[:kind] = kind
  @attributes[:tags] = tags if tags
  @attributes[:detail] = detail if detail
  @attributes[:uri] = uri
  @attributes[:range] = range
  @attributes[:selectionRange] = selection_range
  @attributes[:data] = data if data

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



90
91
92
# File 'lib/language_server/protocol/interface/type_hierarchy_item.rb', line 90

def attributes
  @attributes
end

Instance Method Details

#dataLSPAny

A data entry field that is preserved between a type hierarchy prepare and supertypes or subtypes requests. It could also be used to identify the type hierarchy in the server, helping improve the performance on resolving supertypes and subtypes.

Returns:

  • (LSPAny)


86
87
88
# File 'lib/language_server/protocol/interface/type_hierarchy_item.rb', line 86

def data
  attributes.fetch(:data)
end

#detailstring

More detail for this item, e.g. the signature of a function.

Returns:

  • (string)


48
49
50
# File 'lib/language_server/protocol/interface/type_hierarchy_item.rb', line 48

def detail
  attributes.fetch(:detail)
end

#kindSymbolKind

The kind of this item.

Returns:

  • (SymbolKind)


32
33
34
# File 'lib/language_server/protocol/interface/type_hierarchy_item.rb', line 32

def kind
  attributes.fetch(:kind)
end

#namestring

The name of this item.

Returns:

  • (string)


24
25
26
# File 'lib/language_server/protocol/interface/type_hierarchy_item.rb', line 24

def name
  attributes.fetch(:name)
end

#rangeRange

The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code.

Returns:



65
66
67
# File 'lib/language_server/protocol/interface/type_hierarchy_item.rb', line 65

def range
  attributes.fetch(:range)
end

#selection_rangeRange

The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function. Must be contained by the [‘range`](#TypeHierarchyItem.range).

Returns:



75
76
77
# File 'lib/language_server/protocol/interface/type_hierarchy_item.rb', line 75

def selection_range
  attributes.fetch(:selectionRange)
end

#tags1[]

Tags for this item.

Returns:

  • (1[])


40
41
42
# File 'lib/language_server/protocol/interface/type_hierarchy_item.rb', line 40

def tags
  attributes.fetch(:tags)
end

#to_hashObject



92
93
94
# File 'lib/language_server/protocol/interface/type_hierarchy_item.rb', line 92

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



96
97
98
# File 'lib/language_server/protocol/interface/type_hierarchy_item.rb', line 96

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

#uristring

The resource identifier of this item.

Returns:

  • (string)


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

def uri
  attributes.fetch(:uri)
end