Class: Solargraph::LanguageServer::Message::Initialize
- 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
#process ⇒ Object
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 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/solargraph/language_server/message/initialize.rb', line 7 def process host.configure params['initializationOptions'] host.client_capabilities = params['capabilities'] if support_workspace_folders? host.prepare_folders params['workspaceFolders'] elsif 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 } } } } # FIXME: lsp default is utf-16, may have different position result[:capabilities][:positionEncoding] = "utf-32" if params.dig("capabilities", "general", "positionEncodings")&.include?("utf-32") 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') result[:capabilities].merge! static_folding_range unless dynamic_registration_for?('textDocument', 'foldingRange') result[:capabilities].merge! static_highlights unless dynamic_registration_for?('textDocument', 'documentHighlight') # @todo Temporarily disabled # result[:capabilities].merge! static_code_action unless dynamic_registration_for?('textDocument', 'codeAction') set_result result end |