Class: LSP::DocumentSymbol

Inherits:
LSPBase
  • Object
show all
Defined in:
lib/lsp/lsp_types.rb

Overview

export interface DocumentSymbol

/**
 * 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.
 */
name: string;
/**
 * More detail for this symbol, e.g the signature of a function.
 */
detail?: string;
/**
 * The kind of this symbol.
 */
kind: SymbolKind;
/**
 * Indicates if this symbol is deprecated.
 */
deprecated?: boolean;
/**
 * The range enclosing this symbol not including leading/trailing whitespace but everything else
 * like comments. This information is typically used to determine if the the clients cursor is
 * inside the symbol to reveal in the symbol in the UI.
 */
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 the `range`.
 */
selectionRange: Range;
/**
 * Children of this symbol, e.g. properties of a class.
 */
children?: DocumentSymbol[];

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from LSPBase

#to_h, #to_json

Constructor Details

#initialize(initial_hash = nil) ⇒ DocumentSymbol

Returns a new instance of DocumentSymbol.



1160
1161
1162
1163
# File 'lib/lsp/lsp_types.rb', line 1160

def initialize(initial_hash = nil)
  super
  @optional_method_names = %i[detail deprecated children]
end

Instance Attribute Details

#childrenObject

type: string # type: string # type: SymbolKind # type: boolean # type: Range # type: Range # type: DocumentSymbol[]



1158
1159
1160
# File 'lib/lsp/lsp_types.rb', line 1158

def children
  @children
end

#deprecatedObject

type: string # type: string # type: SymbolKind # type: boolean # type: Range # type: Range # type: DocumentSymbol[]



1158
1159
1160
# File 'lib/lsp/lsp_types.rb', line 1158

def deprecated
  @deprecated
end

#detailObject

type: string # type: string # type: SymbolKind # type: boolean # type: Range # type: Range # type: DocumentSymbol[]



1158
1159
1160
# File 'lib/lsp/lsp_types.rb', line 1158

def detail
  @detail
end

#kindObject

type: string # type: string # type: SymbolKind # type: boolean # type: Range # type: Range # type: DocumentSymbol[]



1158
1159
1160
# File 'lib/lsp/lsp_types.rb', line 1158

def kind
  @kind
end

#nameObject

type: string # type: string # type: SymbolKind # type: boolean # type: Range # type: Range # type: DocumentSymbol[]



1158
1159
1160
# File 'lib/lsp/lsp_types.rb', line 1158

def name
  @name
end

#rangeObject

type: string # type: string # type: SymbolKind # type: boolean # type: Range # type: Range # type: DocumentSymbol[]



1158
1159
1160
# File 'lib/lsp/lsp_types.rb', line 1158

def range
  @range
end

#selectionRangeObject

type: string # type: string # type: SymbolKind # type: boolean # type: Range # type: Range # type: DocumentSymbol[]



1158
1159
1160
# File 'lib/lsp/lsp_types.rb', line 1158

def selectionRange
  @selectionRange
end

Instance Method Details

#from_h!(value) ⇒ Object



1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
# File 'lib/lsp/lsp_types.rb', line 1165

def from_h!(value)
  value = {} if value.nil?
  self.name = value['name']
  self.detail = value['detail']
  self.kind = value['kind'] # Unknown type
  self.deprecated = value['deprecated'] # Unknown type
  self.range = Range.new(value['range']) unless value['range'].nil?
  self.selectionRange = Range.new(value['selectionRange']) unless value['selectionRange'].nil?
  self.children = to_typed_aray(value['children'], DocumentSymbol)
  self
end