Class: Solargraph::LanguageServer::Message::TextDocument::DocumentSymbol

Inherits:
Base
  • Object
show all
Includes:
UriHelpers
Defined in:
lib/solargraph/language_server/message/text_document/document_symbol.rb

Instance Attribute Summary

Attributes inherited from Base

#error, #host, #id, #method, #params, #request, #result

Instance Method Summary collapse

Methods included from UriHelpers

file_to_uri, uri_to_file

Methods inherited from Base

#initialize, #post_initialize, #send_response, #set_error, #set_result

Constructor Details

This class inherits a constructor from Solargraph::LanguageServer::Message::Base

Instance Method Details

#processObject


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/solargraph/language_server/message/text_document/document_symbol.rb', line 4

def process
  pins = host.document_symbols params['textDocument']['uri']
  info = pins.map do |pin|
    result = {
      name: pin.name,
      containerName: pin.namespace,
      kind: pin.symbol_kind,
      location: {
        uri: file_to_uri(pin.location.filename),
        range: pin.location.range.to_hash
      },
      deprecated: pin.deprecated?
    }
    result
  end
  set_result info
end