Class: LanguageServer::Protocol::Interface::DocumentSymbol
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::DocumentSymbol
- Defined in:
- lib/language_server/protocol/interface/document_symbol.rb,
sig/language_server/protocol/interface/document_symbol.rbs
Overview
Represents programming constructs like variables, classes, interfaces etc. that appear in a document. Document symbols can be hierarchical and they have two ranges: one that encloses its definition and one that points to its most interesting range, e.g. the range of an identifier.
Instance Attribute Summary collapse
-
#attributes ⇒ Hash[Symbol, untyped]
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#children ⇒ DocumentSymbol[]
Children of this symbol, e.g.
-
#deprecated ⇒ boolean
deprecated
Deprecated.
Use tags instead
-
#detail ⇒ string
More detail for this symbol, e.g the signature of a function.
-
#initialize(name:, detail: nil, kind:, tags: nil, deprecated: nil, range:, selection_range:, children: nil) ⇒ DocumentSymbol
constructor
A new instance of DocumentSymbol.
-
#kind ⇒ SymbolKind
The kind of this symbol.
-
#name ⇒ string
The name of this symbol.
-
#range ⇒ Range
The range enclosing this symbol not including leading/trailing whitespace but everything else like comments.
-
#selection_range ⇒ Range
The range that should be selected and revealed when this symbol is being picked, e.g the name of a function.
-
#tags ⇒ SymbolTag[]
Tags for this document symbol.
- #to_hash ⇒ Hash[Symbol, untyped]
- #to_json(*args) ⇒ String
Constructor Details
#initialize(name:, detail: nil, kind:, tags: nil, deprecated: nil, range:, selection_range:, children: nil) ⇒ DocumentSymbol
Returns a new instance of DocumentSymbol.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/language_server/protocol/interface/document_symbol.rb', line 11 def initialize(name:, detail: nil, kind:, tags: nil, deprecated: nil, range:, selection_range:, children: nil) @attributes = {} @attributes[:name] = name @attributes[:detail] = detail if detail @attributes[:kind] = kind @attributes[:tags] = if @attributes[:deprecated] = deprecated if deprecated @attributes[:range] = range @attributes[:selectionRange] = selection_range @attributes[:children] = children if children @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Hash[Symbol, untyped] (readonly)
Returns the value of attribute attributes.
98 99 100 |
# File 'lib/language_server/protocol/interface/document_symbol.rb', line 98 def attributes @attributes end |
Instance Method Details
#children ⇒ DocumentSymbol[]
Children of this symbol, e.g. properties of a class.
94 95 96 |
# File 'lib/language_server/protocol/interface/document_symbol.rb', line 94 def children attributes.fetch(:children) end |
#deprecated ⇒ boolean
Use tags instead
Indicates if this symbol is deprecated.
67 68 69 |
# File 'lib/language_server/protocol/interface/document_symbol.rb', line 67 def deprecated attributes.fetch(:deprecated) end |
#detail ⇒ string
More detail for this symbol, e.g the signature of a function.
39 40 41 |
# File 'lib/language_server/protocol/interface/document_symbol.rb', line 39 def detail attributes.fetch(:detail) end |
#kind ⇒ SymbolKind
The kind of this symbol.
47 48 49 |
# File 'lib/language_server/protocol/interface/document_symbol.rb', line 47 def kind attributes.fetch(:kind) end |
#name ⇒ string
The name of this symbol. Will be displayed in the user interface and therefore must not be an empty string or a string only consisting of white spaces.
31 32 33 |
# File 'lib/language_server/protocol/interface/document_symbol.rb', line 31 def name attributes.fetch(:name) end |
#range ⇒ Range
The range enclosing this symbol not including leading/trailing whitespace but everything else like comments. This information is typically used to determine if the clients cursor is inside the symbol to reveal in the symbol in the UI.
77 78 79 |
# File 'lib/language_server/protocol/interface/document_symbol.rb', line 77 def range attributes.fetch(:range) end |
#selection_range ⇒ Range
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.
86 87 88 |
# File 'lib/language_server/protocol/interface/document_symbol.rb', line 86 def selection_range attributes.fetch(:selectionRange) end |
#tags ⇒ SymbolTag[]
Tags for this document symbol.
57 58 59 |
# File 'lib/language_server/protocol/interface/document_symbol.rb', line 57 def attributes.fetch(:tags) end |
#to_hash ⇒ Hash[Symbol, untyped]
100 101 102 |
# File 'lib/language_server/protocol/interface/document_symbol.rb', line 100 def to_hash attributes end |
#to_json(*args) ⇒ String
104 105 106 |
# File 'lib/language_server/protocol/interface/document_symbol.rb', line 104 def to_json(*args) to_hash.to_json(*args) end |