Class: Solargraph::LanguageServer::Message::Initialize

Inherits:
Base
  • Object
show all
Defined in:
lib/solargraph/language_server/message/initialize.rb

Instance Attribute Summary

Attributes inherited from Base

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

Instance Method Summary collapse

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



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/solargraph/language_server/message/initialize.rb', line 5

def process
  host.configure params['initializationOptions']
  if params['rootUri']
    host.prepare UriHelpers.uri_to_file(params['rootUri'])
  else
    host.prepare params['rootPath']
  end
  result = {
    capabilities: {
      textDocumentSync: 2, # @todo What should this be?
      workspace: {
        workspaceFolders: {
          supported: true,
          changeNotifications: true
        }
      }
    }
  }
  result[:capabilities].merge! static_completion unless dynamic_registration_for?('textDocument', 'completion')
  result[:capabilities].merge! static_signature_help unless dynamic_registration_for?('textDocument', 'signatureHelp')
  # result[:capabilities].merge! static_on_type_formatting unless dynamic_registration_for?('textDocument', 'onTypeFormatting')
  result[:capabilities].merge! static_hover unless dynamic_registration_for?('textDocument', 'hover')
  result[:capabilities].merge! static_document_formatting unless dynamic_registration_for?('textDocument', 'formatting')
  result[:capabilities].merge! static_document_symbols unless dynamic_registration_for?('textDocument', 'documentSymbol')
  result[:capabilities].merge! static_definitions unless dynamic_registration_for?('textDocument', 'definition')
  result[:capabilities].merge! static_rename unless dynamic_registration_for?('textDocument', 'rename')
  result[:capabilities].merge! static_references unless dynamic_registration_for?('textDocument', 'references')
  result[:capabilities].merge! static_workspace_symbols unless dynamic_registration_for?('workspace', 'symbol')
  set_result result
end