Sha256: 6ab101c3bee8c0dab55d2affbd08d11105263b76a336314e75bc630a8f5bc882

Contents?: true

Size: 1.43 KB

Versions: 9

Compression:

Stored size: 1.43 KB

Contents

# typed: strict
# frozen_string_literal: true

require "ruby_lsp/listeners/document_symbol"

module RubyLsp
  module Requests
    # The [document
    # symbol](https://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.
    class DocumentSymbol < Request
      extend T::Sig

      class << self
        extend T::Sig

        sig { returns(Interface::DocumentSymbolOptions) }
        def provider
          Interface::DocumentSymbolOptions.new
        end
      end

      sig { params(uri: URI::Generic, dispatcher: Prism::Dispatcher).void }
      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

      sig { override.returns(T::Array[Interface::DocumentSymbol]) }
      def perform
        @response_builder.response
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ruby-lsp-0.20.1 lib/ruby_lsp/requests/document_symbol.rb
ruby-lsp-0.20.0 lib/ruby_lsp/requests/document_symbol.rb
ruby-lsp-0.19.1 lib/ruby_lsp/requests/document_symbol.rb
ruby-lsp-0.19.0 lib/ruby_lsp/requests/document_symbol.rb
ruby-lsp-0.18.4 lib/ruby_lsp/requests/document_symbol.rb
ruby-lsp-0.18.3 lib/ruby_lsp/requests/document_symbol.rb
ruby-lsp-0.18.2 lib/ruby_lsp/requests/document_symbol.rb
ruby-lsp-0.18.1 lib/ruby_lsp/requests/document_symbol.rb
ruby-lsp-0.18.0 lib/ruby_lsp/requests/document_symbol.rb