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

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

Overview

Defines the capabilities provided by a language server.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(position_encoding: nil, text_document_sync: nil, notebook_document_sync: nil, completion_provider: nil, hover_provider: nil, signature_help_provider: nil, declaration_provider: nil, definition_provider: nil, type_definition_provider: nil, implementation_provider: nil, references_provider: nil, document_highlight_provider: nil, document_symbol_provider: nil, code_action_provider: nil, code_lens_provider: nil, document_link_provider: nil, color_provider: nil, workspace_symbol_provider: nil, document_formatting_provider: nil, document_range_formatting_provider: nil, document_on_type_formatting_provider: nil, rename_provider: nil, folding_range_provider: nil, selection_range_provider: nil, execute_command_provider: nil, call_hierarchy_provider: nil, linked_editing_range_provider: nil, semantic_tokens_provider: nil, moniker_provider: nil, type_hierarchy_provider: nil, inline_value_provider: nil, inlay_hint_provider: nil, diagnostic_provider: nil, workspace: nil, experimental: nil) ⇒ ServerCapabilities

Returns a new instance of ServerCapabilities.



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
46
47
48
49
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 9

def initialize(position_encoding: nil, text_document_sync: nil, notebook_document_sync: nil, completion_provider: nil, hover_provider: nil, signature_help_provider: nil, declaration_provider: nil, definition_provider: nil, type_definition_provider: nil, implementation_provider: nil, references_provider: nil, document_highlight_provider: nil, document_symbol_provider: nil, code_action_provider: nil, code_lens_provider: nil, document_link_provider: nil, color_provider: nil, workspace_symbol_provider: nil, document_formatting_provider: nil, document_range_formatting_provider: nil, document_on_type_formatting_provider: nil, rename_provider: nil, folding_range_provider: nil, selection_range_provider: nil, execute_command_provider: nil, call_hierarchy_provider: nil, linked_editing_range_provider: nil, semantic_tokens_provider: nil, moniker_provider: nil, type_hierarchy_provider: nil, inline_value_provider: nil, inlay_hint_provider: nil, diagnostic_provider: nil, workspace: nil, experimental: nil)
  @attributes = {}

  @attributes[:positionEncoding] = position_encoding if position_encoding
  @attributes[:textDocumentSync] = text_document_sync if text_document_sync
  @attributes[:notebookDocumentSync] = notebook_document_sync if notebook_document_sync
  @attributes[:completionProvider] = completion_provider if completion_provider
  @attributes[:hoverProvider] = hover_provider if hover_provider
  @attributes[:signatureHelpProvider] = signature_help_provider if signature_help_provider
  @attributes[:declarationProvider] = declaration_provider if declaration_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[:codeActionProvider] = code_action_provider if code_action_provider
  @attributes[:codeLensProvider] = code_lens_provider if code_lens_provider
  @attributes[:documentLinkProvider] = document_link_provider if document_link_provider
  @attributes[:colorProvider] = color_provider if color_provider
  @attributes[:workspaceSymbolProvider] = workspace_symbol_provider if workspace_symbol_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[:foldingRangeProvider] = folding_range_provider if folding_range_provider
  @attributes[:selectionRangeProvider] = selection_range_provider if selection_range_provider
  @attributes[:executeCommandProvider] = execute_command_provider if execute_command_provider
  @attributes[:callHierarchyProvider] = call_hierarchy_provider if call_hierarchy_provider
  @attributes[:linkedEditingRangeProvider] = linked_editing_range_provider if linked_editing_range_provider
  @attributes[:semanticTokensProvider] = semantic_tokens_provider if semantic_tokens_provider
  @attributes[:monikerProvider] = moniker_provider if moniker_provider
  @attributes[:typeHierarchyProvider] = type_hierarchy_provider if type_hierarchy_provider
  @attributes[:inlineValueProvider] = inline_value_provider if inline_value_provider
  @attributes[:inlayHintProvider] = inlay_hint_provider if inlay_hint_provider
  @attributes[:diagnosticProvider] = diagnostic_provider if diagnostic_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.



363
364
365
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 363

def attributes
  @attributes
end

Instance Method Details

#call_hierarchy_providerboolean | CallHierarchyOptions | CallHierarchyRegistrationOptions | nil

The server provides call hierarchy support.

Returns:

Since:

  • 3.16.0



273
274
275
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 273

def call_hierarchy_provider
  attributes.fetch(:callHierarchyProvider)
end

#code_action_providerboolean | CodeActionOptions | nil

The server provides code actions. CodeActionOptions may only be specified if the client states that it supports codeActionLiteralSupport in its initial initialize request.

Returns:



173
174
175
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 173

def code_action_provider
  attributes.fetch(:codeActionProvider)
end

#code_lens_providerCodeLensOptions | nil

The server provides code lens.

Returns:



181
182
183
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 181

def code_lens_provider
  attributes.fetch(:codeLensProvider)
end

#color_providerboolean | DocumentColorOptions | DocumentColorRegistrationOptions | nil

The server provides color provider support.



197
198
199
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 197

def color_provider
  attributes.fetch(:colorProvider)
end

#completion_providerCompletionOptions | nil

The server provides completion support.

Returns:



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

def completion_provider
  attributes.fetch(:completionProvider)
end

#declaration_providerboolean | DeclarationOptions | DeclarationRegistrationOptions | nil

The server provides Goto Declaration support.

Returns:



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

def declaration_provider
  attributes.fetch(:declarationProvider)
end

#definition_providerboolean | DefinitionOptions | nil

The server provides goto definition support.

Returns:



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

def definition_provider
  attributes.fetch(:definitionProvider)
end

#diagnostic_providerDiagnosticOptions | DiagnosticRegistrationOptions | nil

The server has support for pull model diagnostics.

Returns:

Since:

  • 3.17.0



343
344
345
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 343

def diagnostic_provider
  attributes.fetch(:diagnosticProvider)
end

#document_formatting_providerboolean | DocumentFormattingOptions | nil

The server provides document formatting.

Returns:



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

def document_formatting_provider
  attributes.fetch(:documentFormattingProvider)
end

#document_highlight_providerboolean | DocumentHighlightOptions | nil

The server provides document highlight support.

Returns:



155
156
157
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 155

def document_highlight_provider
  attributes.fetch(:documentHighlightProvider)
end

The server provides document link support.

Returns:



189
190
191
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 189

def document_link_provider
  attributes.fetch(:documentLinkProvider)
end

#document_on_type_formatting_providerDocumentOnTypeFormattingOptions | nil

The server provides document formatting on typing.



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

def document_on_type_formatting_provider
  attributes.fetch(:documentOnTypeFormattingProvider)
end

#document_range_formatting_providerboolean | DocumentRangeFormattingOptions | nil

The server provides document range formatting.

Returns:



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

def document_range_formatting_provider
  attributes.fetch(:documentRangeFormattingProvider)
end

#document_symbol_providerboolean | DocumentSymbolOptions | nil

The server provides document symbol support.

Returns:



163
164
165
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 163

def document_symbol_provider
  attributes.fetch(:documentSymbolProvider)
end

#execute_command_providerExecuteCommandOptions | nil

The server provides execute command support.

Returns:



263
264
265
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 263

def execute_command_provider
  attributes.fetch(:executeCommandProvider)
end

#experimentalT | nil

Experimental server capabilities.

Returns:

  • (T | nil)


359
360
361
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 359

def experimental
  attributes.fetch(:experimental)
end

#folding_range_providerboolean | FoldingRangeOptions | FoldingRangeRegistrationOptions | nil

The server provides folding provider support.



247
248
249
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 247

def folding_range_provider
  attributes.fetch(:foldingRangeProvider)
end

#hover_providerboolean | HoverOptions | nil

The server provides hover support.

Returns:



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

def hover_provider
  attributes.fetch(:hoverProvider)
end

#implementation_providerboolean | ImplementationOptions | ImplementationRegistrationOptions | nil

The server provides Goto Implementation support.



139
140
141
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 139

def implementation_provider
  attributes.fetch(:implementationProvider)
end

#inlay_hint_providerboolean | InlayHintOptions | InlayHintRegistrationOptions | nil

The server provides inlay hints.

Returns:

Since:

  • 3.17.0



333
334
335
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 333

def inlay_hint_provider
  attributes.fetch(:inlayHintProvider)
end

#inline_value_providerboolean | InlineValueOptions | InlineValueRegistrationOptions | nil

The server provides inline values.

Returns:

Since:

  • 3.17.0



323
324
325
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 323

def inline_value_provider
  attributes.fetch(:inlineValueProvider)
end

#linked_editing_range_providerboolean | LinkedEditingRangeOptions | LinkedEditingRangeRegistrationOptions | nil

The server provides linked editing range support.

Returns:

Since:

  • 3.16.0



283
284
285
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 283

def linked_editing_range_provider
  attributes.fetch(:linkedEditingRangeProvider)
end

#moniker_providerboolean | MonikerOptions | MonikerRegistrationOptions | nil

The server provides moniker support.

Returns:

Since:

  • 3.16.0



303
304
305
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 303

def moniker_provider
  attributes.fetch(:monikerProvider)
end

#notebook_document_syncNotebookDocumentSyncOptions | NotebookDocumentSyncRegistrationOptions | nil

Defines how notebook documents are synced.



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

def notebook_document_sync
  attributes.fetch(:notebookDocumentSync)
end

#position_encodingPositionEncodingKind | nil

The position encoding the server picked from the encodings offered by the client via the client capability general.positionEncodings.

If the client didn’t provide any position encodings the only valid value that a server can return is ‘utf-16’.

If omitted it defaults to ‘utf-16’.

Returns:

  • (PositionEncodingKind | nil)

Since:

  • 3.17.0



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

def position_encoding
  attributes.fetch(:positionEncoding)
end

#references_providerboolean | ReferenceOptions | nil

The server provides find references support.

Returns:



147
148
149
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 147

def references_provider
  attributes.fetch(:referencesProvider)
end

#rename_providerboolean | RenameOptions | nil

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

Returns:



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

def rename_provider
  attributes.fetch(:renameProvider)
end

#selection_range_providerboolean | SelectionRangeOptions | SelectionRangeRegistrationOptions | nil

The server provides selection range support.



255
256
257
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 255

def selection_range_provider
  attributes.fetch(:selectionRangeProvider)
end

#semantic_tokens_providerSemanticTokensOptions | SemanticTokensRegistrationOptions | nil

The server provides semantic tokens support.

Returns:

Since:

  • 3.16.0



293
294
295
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 293

def semantic_tokens_provider
  attributes.fetch(:semanticTokensProvider)
end

#signature_help_providerSignatureHelpOptions | nil

The server provides signature help support.

Returns:



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

def signature_help_provider
  attributes.fetch(:signatureHelpProvider)
end

#text_document_syncTextDocumentSyncOptions | TextDocumentSyncKind | nil

Defines how text documents are synced. Is either a detailed structure defining each notification or for backwards compatibility the TextDocumentSyncKind number.

Returns:



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

def text_document_sync
  attributes.fetch(:textDocumentSync)
end

#to_hashObject



365
366
367
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 365

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



369
370
371
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 369

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

#type_definition_providerboolean | TypeDefinitionOptions | TypeDefinitionRegistrationOptions | nil

The server provides Goto Type Definition support.



131
132
133
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 131

def type_definition_provider
  attributes.fetch(:typeDefinitionProvider)
end

#type_hierarchy_providerboolean | TypeHierarchyOptions | TypeHierarchyRegistrationOptions | nil

The server provides type hierarchy support.

Returns:

Since:

  • 3.17.0



313
314
315
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 313

def type_hierarchy_provider
  attributes.fetch(:typeHierarchyProvider)
end

#workspace{ workspaceFolders:WorkspaceFoldersServerCapabilities, fileOperations:FileOperationOptions } | nil

Workspace specific server capabilities.

Returns:

  • ({ workspaceFolders:WorkspaceFoldersServerCapabilities, fileOperations:FileOperationOptions } | nil)


351
352
353
# File 'lib/language_server/protocol/interface/server_capabilities.rb', line 351

def workspace
  attributes.fetch(:workspace)
end

#workspace_symbol_providerboolean | WorkspaceSymbolOptions | nil

The server provides workspace symbol support.

Returns:



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

def workspace_symbol_provider
  attributes.fetch(:workspaceSymbolProvider)
end