Class: RubyLsp::Requests::DocumentSymbol
- Extended by:
- T::Sig
- Defined in:
- lib/ruby_lsp/requests/document_symbol.rb
Overview

The [document symbol](microsoft.github.io/language-server-protocol/specification#textDocument_documentSymbol) request informs the editor of all the important symbols, such as classes, variables, and methods, defined in a file. With this information, the editor can populate breadcrumbs, file outline and allow for fuzzy symbol searches.
In VS Code, fuzzy symbol search can be accessed by opening the command palette and inserting an ‘@` symbol.
# Example
“‘ruby class Person # –> document symbol: class
attr_reader :age # --> document symbol: field
def initialize
@age = 0 # --> document symbol: variable
end
def age # --> document symbol: method
end
end “‘
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(uri, dispatcher) ⇒ DocumentSymbol
constructor
A new instance of DocumentSymbol.
- #perform ⇒ Object
Constructor Details
#initialize(uri, dispatcher) ⇒ DocumentSymbol
Returns a new instance of DocumentSymbol.
44 45 46 47 48 49 50 51 52 |
# File 'lib/ruby_lsp/requests/document_symbol.rb', line 44 def initialize(uri, dispatcher) super() @response_builder = T.let(ResponseBuilders::DocumentSymbol.new, ResponseBuilders::DocumentSymbol) Listeners::DocumentSymbol.new(@response_builder, uri, dispatcher) Addon.addons.each do |addon| addon.create_document_symbol_listener(@response_builder, dispatcher) end end |
Class Method Details
.provider ⇒ Object
38 39 40 |
# File 'lib/ruby_lsp/requests/document_symbol.rb', line 38 def provider Interface::DocumentSymbolOptions.new end |
Instance Method Details
#perform ⇒ Object
55 56 57 |
# File 'lib/ruby_lsp/requests/document_symbol.rb', line 55 def perform @response_builder.response end |