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

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

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.

Parameters:

  • name: (String)
  • kind: (Object)
  • tags: (Array[untyped]) (defaults to: nil)
  • detail: (String) (defaults to: nil)
  • uri: (String)
  • range: (Object)
  • selection_range: (Object)
  • data: (Object) (defaults to: nil)

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

#attributesHash[Symbol, untyped] (readonly)

Returns:

  • (Hash[Symbol, untyped])

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

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)

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

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

Returns:

  • (string)

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 TypeHierarchyItem.range `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[]

Tags for this item.

Returns:

  • (SymbolTag[])

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

Returns:

  • (Hash[Symbol, untyped])

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) ⇒ String

Parameters:

  • (Object)

Returns:

  • (String)

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