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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of WorkspaceSymbol.



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

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

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

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



77
78
79
# File 'lib/language_server/protocol/interface/workspace_symbol.rb', line 77

def attributes
  @attributes
end

Instance Method Details

#container_namestring

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)


52
53
54
# File 'lib/language_server/protocol/interface/workspace_symbol.rb', line 52

def container_name
  attributes.fetch(:containerName)
end

#dataLSPAny

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

Returns:

  • (LSPAny)


73
74
75
# File 'lib/language_server/protocol/interface/workspace_symbol.rb', line 73

def data
  attributes.fetch(:data)
end

#kindSymbolKind

The kind of this symbol.

Returns:

  • (SymbolKind)


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

def kind
  attributes.fetch(:kind)
end

#locationLocation | { uri: string; }

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

See also ‘SymbolInformation.location`.

Returns:



64
65
66
# File 'lib/language_server/protocol/interface/workspace_symbol.rb', line 64

def location
  attributes.fetch(:location)
end

#namestring

The name of this symbol.

Returns:

  • (string)


25
26
27
# File 'lib/language_server/protocol/interface/workspace_symbol.rb', line 25

def name
  attributes.fetch(:name)
end

#tags1[]

Tags for this completion item.

Returns:

  • (1[])


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

def tags
  attributes.fetch(:tags)
end

#to_hashObject



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

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



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

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