Class: Solargraph::LanguageServer::Message::Workspace::WorkspaceSymbol

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

Instance Attribute Summary

Attributes inherited from Base

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

Instance Method Summary collapse

Methods included from UriHelpers

decode, encode, 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



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/solargraph/language_server/message/workspace/workspace_symbol.rb', line 6

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