Class: LanguageServer::Protocol::Interface::ServerCapabilities

Inherits:
Object
  • Object
show all
Defined in:
lib/language_server/protocol/interface/server_capabilities.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text_document_sync: nil, hover_provider: nil, completion_provider: nil, signature_help_provider: nil, definition_provider: nil, type_definition_provider: nil, implementation_provider: nil, references_provider: nil, document_highlight_provider: nil, document_symbol_provider: nil, workspace_symbol_provider: nil, code_action_provider: nil, code_lens_provider: nil, document_formatting_provider: nil, document_range_formatting_provider: nil, document_on_type_formatting_provider: nil, rename_provider: nil, document_link_provider: nil, color_provider: nil, folding_range_provider: nil, execute_command_provider: nil, workspace: nil, experimental: nil) ⇒ ServerCapabilities

Returns a new instance of ServerCapabilities.



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
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 5

def initialize(text_document_sync: nil, hover_provider: nil, completion_provider: nil, signature_help_provider: nil, definition_provider: nil, type_definition_provider: nil, implementation_provider: nil, references_provider: nil, document_highlight_provider: nil, document_symbol_provider: nil, workspace_symbol_provider: nil, code_action_provider: nil, code_lens_provider: nil, document_formatting_provider: nil, document_range_formatting_provider: nil, document_on_type_formatting_provider: nil, rename_provider: nil, document_link_provider: nil, color_provider: nil, folding_range_provider: nil, execute_command_provider: nil, workspace: nil, experimental: nil)
  @attributes = {}

  @attributes[:textDocumentSync] = text_document_sync if text_document_sync
  @attributes[:hoverProvider] = hover_provider if hover_provider
  @attributes[:completionProvider] = completion_provider if completion_provider
  @attributes[:signatureHelpProvider] = signature_help_provider if signature_help_provider
  @attributes[:definitionProvider] = definition_provider if definition_provider
  @attributes[:typeDefinitionProvider] = type_definition_provider if type_definition_provider
  @attributes[:implementationProvider] = implementation_provider if implementation_provider
  @attributes[:referencesProvider] = references_provider if references_provider
  @attributes[:documentHighlightProvider] = document_highlight_provider if document_highlight_provider
  @attributes[:documentSymbolProvider] = document_symbol_provider if document_symbol_provider
  @attributes[:workspaceSymbolProvider] = workspace_symbol_provider if workspace_symbol_provider
  @attributes[:codeActionProvider] = code_action_provider if code_action_provider
  @attributes[:codeLensProvider] = code_lens_provider if code_lens_provider
  @attributes[:documentFormattingProvider] = document_formatting_provider if document_formatting_provider
  @attributes[:documentRangeFormattingProvider] = document_range_formatting_provider if document_range_formatting_provider
  @attributes[:documentOnTypeFormattingProvider] = document_on_type_formatting_provider if document_on_type_formatting_provider
  @attributes[:renameProvider] = rename_provider if rename_provider
  @attributes[:documentLinkProvider] = document_link_provider if document_link_provider
  @attributes[:colorProvider] = color_provider if color_provider
  @attributes[:foldingRangeProvider] = folding_range_provider if folding_range_provider
  @attributes[:executeCommandProvider] = execute_command_provider if execute_command_provider
  @attributes[:workspace] = workspace if workspace
  @attributes[:experimental] = experimental if experimental

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



232
233
234
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 232

def attributes
  @attributes
end

Instance Method Details

#code_action_providerboolean | CodeActionOptions

The server provides code actions. The ‘CodeActionOptions` return type is only valid if the client signals code action literal support via the property `textDocument.codeAction.codeActionLiteralSupport`.

Returns:



134
135
136
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 134

def code_action_provider
  attributes.fetch(:codeActionProvider)
end

#code_lens_providerCodeLensOptions

The server provides code lens.

Returns:



142
143
144
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 142

def code_lens_provider
  attributes.fetch(:codeLensProvider)
end

#color_providerboolean | ColorProviderOptions | (ColorProviderOptions & TextDocumentRegistrationOptions & Static...]

The server provides color provider support.

Since 3.6.0

Returns:



194
195
196
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 194

def color_provider
  attributes.fetch(:colorProvider)
end

#completion_providerCompletionOptions

The server provides completion support.

Returns:



56
57
58
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 56

def completion_provider
  attributes.fetch(:completionProvider)
end

#definition_providerboolean

The server provides goto definition support.

Returns:

  • (boolean)


72
73
74
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 72

def definition_provider
  attributes.fetch(:definitionProvider)
end

#document_formatting_providerboolean

The server provides document formatting.

Returns:

  • (boolean)


150
151
152
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 150

def document_formatting_provider
  attributes.fetch(:documentFormattingProvider)
end

#document_highlight_providerboolean

The server provides document highlight support.

Returns:

  • (boolean)


108
109
110
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 108

def document_highlight_provider
  attributes.fetch(:documentHighlightProvider)
end

The server provides document link support.

Returns:



184
185
186
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 184

def document_link_provider
  attributes.fetch(:documentLinkProvider)
end

#document_on_type_formatting_providerDocumentOnTypeFormattingOptions

The server provides document formatting on typing.



166
167
168
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 166

def document_on_type_formatting_provider
  attributes.fetch(:documentOnTypeFormattingProvider)
end

#document_range_formatting_providerboolean

The server provides document range formatting.

Returns:

  • (boolean)


158
159
160
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 158

def document_range_formatting_provider
  attributes.fetch(:documentRangeFormattingProvider)
end

#document_symbol_providerboolean

The server provides document symbol support.

Returns:

  • (boolean)


116
117
118
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 116

def document_symbol_provider
  attributes.fetch(:documentSymbolProvider)
end

#execute_command_providerExecuteCommandOptions

The server provides execute command support.



212
213
214
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 212

def execute_command_provider
  attributes.fetch(:executeCommandProvider)
end

#experimentalany

Experimental server capabilities.

Returns:

  • (any)


228
229
230
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 228

def experimental
  attributes.fetch(:experimental)
end

#folding_range_providerboolean | FoldingRangeProviderOptions | (FoldingRangeProviderOptions & TextDocumentRegistrationOp...]

The server provides folding provider support.

Since 3.10.0

Returns:



204
205
206
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 204

def folding_range_provider
  attributes.fetch(:foldingRangeProvider)
end

#hover_providerboolean

The server provides hover support.

Returns:

  • (boolean)


48
49
50
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 48

def hover_provider
  attributes.fetch(:hoverProvider)
end

#implementation_providerboolean | (TextDocumentRegistrationOptions & StaticRegistrationOptions)

The server provides Goto Implementation support.

Since 3.6.0



92
93
94
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 92

def implementation_provider
  attributes.fetch(:implementationProvider)
end

#references_providerboolean

The server provides find references support.

Returns:

  • (boolean)


100
101
102
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 100

def references_provider
  attributes.fetch(:referencesProvider)
end

#rename_providerboolean | RenameOptions

The server provides rename support. RenameOptions may only be specified if the client states that it supports ‘prepareSupport` in its initial `initialize` request.

Returns:



176
177
178
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 176

def rename_provider
  attributes.fetch(:renameProvider)
end

#signature_help_providerSignatureHelpOptions

The server provides signature help support.



64
65
66
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 64

def signature_help_provider
  attributes.fetch(:signatureHelpProvider)
end

#text_document_syncnumber | TextDocumentSyncOptions

Defines how text documents are synced. Is either a detailed structure defining each notification or for backwards compatibility the TextDocumentSyncKind number. If omitted it defaults to ‘TextDocumentSyncKind.None`.

Returns:



40
41
42
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 40

def text_document_sync
  attributes.fetch(:textDocumentSync)
end

#to_hashObject



234
235
236
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 234

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



238
239
240
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 238

def to_json(*args)
  to_hash.to_json(*args)
end

#type_definition_providerboolean | (TextDocumentRegistrationOptions & StaticRegistrationOptions)

The server provides Goto Type Definition support.

Since 3.6.0



82
83
84
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 82

def type_definition_provider
  attributes.fetch(:typeDefinitionProvider)
end

#workspace{ workspaceFolders?: { supported?: boolean; changeNotifications?: string | boolean; }; }

Workspace specific server capabilities

Returns:

  • ({ workspaceFolders?: { supported?: boolean; changeNotifications?: string | boolean; }; })


220
221
222
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 220

def workspace
  attributes.fetch(:workspace)
end

#workspace_symbol_providerboolean

The server provides workspace symbol support.

Returns:

  • (boolean)


124
125
126
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 124

def workspace_symbol_provider
  attributes.fetch(:workspaceSymbolProvider)
end