Class: LanguageServer::Protocol::Interface::WorkspaceSymbol

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

Overview

A special workspace symbol that supports locations without a range.

See also SymbolInformation.

Since:

  • 3.17.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(location:, data: nil, name:, kind:, tags: nil, container_name: nil) ⇒ WorkspaceSymbol

Returns a new instance of WorkspaceSymbol.

Since:

  • 3.17.0



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/language_server/protocol/interface/workspace_symbol.rb', line 12

def initialize(location:, data: nil, name:, kind:, tags: nil, container_name: nil)
  @attributes = {}

  @attributes[:location] = location
  @attributes[:data] = data if data
  @attributes[:name] = name
  @attributes[:kind] = kind
  @attributes[:tags] = tags if tags
  @attributes[:containerName] = container_name if container_name

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Since:

  • 3.17.0



83
84
85
# File 'lib/language_server/protocol/interface/workspace_symbol.rb', line 83

def attributes
  @attributes
end

Instance Method Details

#container_namestring | nil

The name of the symbol containing this symbol. This information is for user interface purposes (e.g. to render a qualifier in the user interface if necessary). It can’t be used to re-infer a hierarchy for the document symbols.

Returns:

  • (string | nil)

Since:

  • 3.17.0



79
80
81
# File 'lib/language_server/protocol/interface/workspace_symbol.rb', line 79

def container_name
  attributes.fetch(:containerName)
end

#dataLSPAny | nil

A data entry field that is preserved on a workspace symbol between a workspace symbol request and a workspace symbol resolve request.

Returns:

  • (LSPAny | nil)

Since:

  • 3.17.0



42
43
44
# File 'lib/language_server/protocol/interface/workspace_symbol.rb', line 42

def data
  attributes.fetch(:data)
end

#kindSymbolKind

The kind of this symbol.

Returns:

  • (SymbolKind)

Since:

  • 3.17.0



58
59
60
# File 'lib/language_server/protocol/interface/workspace_symbol.rb', line 58

def kind
  attributes.fetch(:kind)
end

#locationLocation | { uri:DocumentUri }

The location of the symbol. Whether a server is allowed to return a location without a range depends on the client capability workspace.symbol.resolveSupport.

See SymbolInformation#location for more details.

Returns:

Since:

  • 3.17.0



33
34
35
# File 'lib/language_server/protocol/interface/workspace_symbol.rb', line 33

def location
  attributes.fetch(:location)
end

#namestring

The name of this symbol.

Returns:

  • (string)

Since:

  • 3.17.0



50
51
52
# File 'lib/language_server/protocol/interface/workspace_symbol.rb', line 50

def name
  attributes.fetch(:name)
end

#tagsSymbolTag[] | nil

Tags for this symbol.

Returns:

  • (SymbolTag[] | nil)

Since:

  • 3.16.0



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

def tags
  attributes.fetch(:tags)
end

#to_hashObject

Since:

  • 3.17.0



85
86
87
# File 'lib/language_server/protocol/interface/workspace_symbol.rb', line 85

def to_hash
  attributes
end

#to_json(*args) ⇒ Object

Since:

  • 3.17.0



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

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