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

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

Overview

Since:

  • 3.17.0

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.

Since:

  • 3.17.0



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

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)

Since:

  • 3.17.0



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

def attributes
  @attributes
end

Instance Method Details

#dataLSPAny | nil

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 | nil)

Since:

  • 3.17.0



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

def data
  attributes.fetch(:data)
end

#detailstring | nil

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

Returns:

  • (string | nil)

Since:

  • 3.17.0



51
52
53
# File 'lib/language_server/protocol/interface/type_hierarchy_item.rb', line 51

def detail
  attributes.fetch(:detail)
end

#kindSymbolKind

The kind of this item.

Returns:

  • (SymbolKind)

Since:

  • 3.17.0



35
36
37
# File 'lib/language_server/protocol/interface/type_hierarchy_item.rb', line 35

def kind
  attributes.fetch(:kind)
end

#namestring

The name of this item.

Returns:

  • (string)

Since:

  • 3.17.0



27
28
29
# File 'lib/language_server/protocol/interface/type_hierarchy_item.rb', line 27

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:

Since:

  • 3.17.0



68
69
70
# File 'lib/language_server/protocol/interface/type_hierarchy_item.rb', line 68

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:

Since:

  • 3.17.0



78
79
80
# File 'lib/language_server/protocol/interface/type_hierarchy_item.rb', line 78

def selection_range
  attributes.fetch(:selectionRange)
end

#tagsSymbolTag[] | nil

Tags for this item.

Returns:

  • (SymbolTag[] | nil)

Since:

  • 3.17.0



43
44
45
# File 'lib/language_server/protocol/interface/type_hierarchy_item.rb', line 43

def tags
  attributes.fetch(:tags)
end

#to_hashObject

Since:

  • 3.17.0



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

def to_hash
  attributes
end

#to_json(*args) ⇒ Object

Since:

  • 3.17.0



99
100
101
# File 'lib/language_server/protocol/interface/type_hierarchy_item.rb', line 99

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

#uriDocumentUri

The resource identifier of this item.

Returns:

  • (DocumentUri)

Since:

  • 3.17.0



59
60
61
# File 'lib/language_server/protocol/interface/type_hierarchy_item.rb', line 59

def uri
  attributes.fetch(:uri)
end