1 2 3 4 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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567
|
#pragma once
#include "LibLsp/lsp/method_type.h"
#include <stdexcept>
#include "LibLsp/JsonRpc/message.h"
#include "LibLsp/lsp/lsDocumentUri.h"
#include "LibLsp/lsp/lsAny.h"
#include "InitializeParams.h"
#include "LibLsp/lsp/textDocument/SemanticTokens.h"
extern void Reflect(Reader&, std::pair<optional<lsTextDocumentSyncKind>, optional<lsTextDocumentSyncOptions>>&);
//
// Code Action options.
//
struct CodeActionOptions : WorkDoneProgressOptions
{
//
// CodeActionKinds that this server may return.
//
// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server
// may list out every specific kind they provide.
//
typedef std::string CodeActionKind;
std::vector<CodeActionKind> codeActionKinds;
MAKE_SWAP_METHOD(CodeActionOptions, workDoneProgress, codeActionKinds);
};
MAKE_REFLECT_STRUCT(CodeActionOptions, workDoneProgress, codeActionKinds)
struct CodeLensOptions : WorkDoneProgressOptions
{
//
// Code lens has a resolve provider as well.
//
optional<bool> resolveProvider;
MAKE_SWAP_METHOD(CodeLensOptions, workDoneProgress, resolveProvider);
};
MAKE_REFLECT_STRUCT(CodeLensOptions, workDoneProgress, resolveProvider)
// Format document on type options
struct lsDocumentOnTypeFormattingOptions : WorkDoneProgressOptions
{
// A character on which formatting should be triggered, like `}`.
std::string firstTriggerCharacter;
// More trigger characters.
std::vector<std::string> moreTriggerCharacter;
MAKE_SWAP_METHOD(lsDocumentOnTypeFormattingOptions, workDoneProgress, firstTriggerCharacter, moreTriggerCharacter);
};
MAKE_REFLECT_STRUCT(lsDocumentOnTypeFormattingOptions, workDoneProgress, firstTriggerCharacter, moreTriggerCharacter);
struct RenameOptions : WorkDoneProgressOptions
{
//
// Renames should be checked and tested before being executed.
//
optional<bool> prepareProvider;
MAKE_SWAP_METHOD(RenameOptions, workDoneProgress, prepareProvider);
};
MAKE_REFLECT_STRUCT(RenameOptions, workDoneProgress, prepareProvider)
struct DocumentFilter
{
//
// A language id, like `typescript`.
//
optional<std::string> language;
//
// A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
//
optional<std::string> scheme;
//
// A glob pattern, like `*.{ts,js}`.
//
// Glob patterns can have the following syntax:
// - `*` to match one or more characters in a path segment
// - `?` to match on one character in a path segment
// - `**` to match any number of path segments, including none
// - `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}
// matches all TypeScript and JavaScript files)
// - `[]` to declare a range of characters to match in a path segment
// (e.g., `example.[0-9]` to match on `example.0`, `example.1`,...)
// - `[!...]` to negate a range of characters to match in a path segment
// (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but
// not `example.0`)
//
optional<std::string> pattern;
MAKE_SWAP_METHOD(DocumentFilter, language, scheme, pattern)
};
MAKE_REFLECT_STRUCT(DocumentFilter, language, scheme, pattern)
//A document selector is the combination of one or more document filters.
using DocumentSelector = std::vector<DocumentFilter>;
// Document link options
struct lsDocumentLinkOptions : WorkDoneProgressOptions
{
// Document links have a resolve provider as well.
optional<bool> resolveProvider;
MAKE_SWAP_METHOD(lsDocumentLinkOptions, workDoneProgress, resolveProvider);
};
MAKE_REFLECT_STRUCT(lsDocumentLinkOptions, workDoneProgress, resolveProvider);
// Execute command options.
struct lsExecuteCommandOptions : WorkDoneProgressOptions
{
// The commands to be executed on the server
std::vector<std::string> commands;
MAKE_SWAP_METHOD(lsExecuteCommandOptions, workDoneProgress, commands);
};
MAKE_REFLECT_STRUCT(lsExecuteCommandOptions, workDoneProgress, commands);
struct TextDocumentRegistrationOptions
{
//
// A document selector to identify the scope of the registration. If set to null
// the document selector provided on the client side will be used.
//
optional<DocumentSelector> documentSelector;
MAKE_SWAP_METHOD(TextDocumentRegistrationOptions, documentSelector);
};
MAKE_REFLECT_STRUCT(TextDocumentRegistrationOptions, documentSelector);
//
// Static registration options to be returned in the initialize request.
//
struct StaticRegistrationOptions : public TextDocumentRegistrationOptions
{
//
// The id used to register the request. The id can be used to deregister
// the request again. See also Registration#id.
//
optional<std::string> id;
MAKE_SWAP_METHOD(StaticRegistrationOptions, documentSelector, id)
};
MAKE_REFLECT_STRUCT(StaticRegistrationOptions, documentSelector, id)
//
// The server supports workspace folder.
//
// Since 3.6.0
//
struct WorkspaceFoldersOptions
{
//
// The server has support for workspace folders
//
optional<bool> supported;
//
// Whether the server wants to receive workspace folder
// change notifications.
//
// If a string is provided, the string is treated as an ID
// under which the notification is registered on the client
// side. The ID can be used to unregister for these events
// using the `client/unregisterCapability` request.
//
optional<std::pair<optional<std::string>, optional<bool>>> changeNotifications;
MAKE_SWAP_METHOD(WorkspaceFoldersOptions, supported, changeNotifications);
};
MAKE_REFLECT_STRUCT(WorkspaceFoldersOptions, supported, changeNotifications);
//
// A pattern kind describing if a glob pattern matches a file a folder or
// both.
//
// @since 3.16.0
//
enum lsFileOperationPatternKind
{
file,
folder
};
MAKE_REFLECT_TYPE_PROXY(lsFileOperationPatternKind)
//
// Matching options for the file operation pattern.
//
// @since 3.16.0
//
struct lsFileOperationPatternOptions
{
//
// The pattern should be matched ignoring casing.
//
optional<bool> ignoreCase;
MAKE_SWAP_METHOD(lsFileOperationPatternOptions, ignoreCase)
};
MAKE_REFLECT_STRUCT(lsFileOperationPatternOptions, ignoreCase)
//
// A pattern to describe in which file operation requests or notifications
// the server is interested in.
//
// @since 3.16.0
//
struct lsFileOperationPattern
{
//
// The glob pattern to match. Glob patterns can have the following syntax:
// - `*` to match one or more characters in a path segment
// - `?` to match on one character in a path segment
// - `**` to match any number of path segments, including none
// - `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}`
// matches all TypeScript and JavaScript files)
// - `[]` to declare a range of characters to match in a path segment
// (e.g., `example.[0-9]` to match on `example.0`, `example.1`,...)
// - `[!...]` to negate a range of characters to match in a path segment
// (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but
// not `example.0`)
//
std::string glob;
//
// Whether to match files or folders with this pattern.
//
// Matches both if undefined.
//
optional<lsFileOperationPatternKind> matches;
//
// Additional options used during matching.
//
optional<lsFileOperationPatternOptions> options;
MAKE_SWAP_METHOD(lsFileOperationPattern, glob, matches, options)
};
MAKE_REFLECT_STRUCT(lsFileOperationPattern, glob, matches, options)
//
// A filter to describe in which file operation requests or notifications
// the server is interested in.
//
// @since 3.16.0
//
struct lsFileOperationFilter
{
//
// A Uri like `file` or `untitled`.
//
optional<std::string> scheme;
//
// The actual file operation pattern.
//
optional<lsFileOperationPattern> pattern;
MAKE_SWAP_METHOD(lsFileOperationFilter, scheme, pattern)
};
MAKE_REFLECT_STRUCT(lsFileOperationFilter, scheme, pattern)
//
// The options to register for file operations.
//
// @since 3.16.0
//
struct lsFileOperationRegistrationOptions
{
//
// The actual filters.
//
optional<std::vector<lsFileOperationFilter>> filters;
MAKE_SWAP_METHOD(lsFileOperationRegistrationOptions, filters)
};
MAKE_REFLECT_STRUCT(lsFileOperationRegistrationOptions, filters)
struct WorkspaceServerCapabilities
{
//
// The server supports workspace folder.
//
// Since 3.6.0
//
WorkspaceFoldersOptions workspaceFolders;
//
// The server is interested in file notifications/requests.
//
// @since 3.16.0
//
struct lsFileOperations
{
//
// The server is interested in receiving didCreateFiles
// notifications.
//
optional<lsFileOperationRegistrationOptions> didCreate;
//
// The server is interested in receiving willCreateFiles requests.
//
optional<lsFileOperationRegistrationOptions> willCreate;
//
// The server is interested in receiving didRenameFiles
// notifications.
//
optional<lsFileOperationRegistrationOptions> didRename;
//
// The server is interested in receiving willRenameFiles requests.
//
optional<lsFileOperationRegistrationOptions> willRename;
//
// The server is interested in receiving didDeleteFiles file
// notifications.
//
optional<lsFileOperationRegistrationOptions> didDelete;
//
// The server is interested in receiving willDeleteFiles file
// requests.
//
optional<lsFileOperationRegistrationOptions> willDelete;
MAKE_SWAP_METHOD(lsFileOperations, didCreate, willCreate, didRename, willRename, didDelete, willDelete)
};
optional<lsFileOperations> fileOperations;
MAKE_SWAP_METHOD(WorkspaceServerCapabilities, workspaceFolders, fileOperations)
};
MAKE_REFLECT_STRUCT(WorkspaceServerCapabilities, workspaceFolders, fileOperations)
MAKE_REFLECT_STRUCT(
WorkspaceServerCapabilities::lsFileOperations, didCreate, willCreate, didRename, willRename, didDelete, willDelete
)
//
// Semantic highlighting server capabilities.
//
// <p>
// <b>Note:</b> the <a href=
// "https://github.com/Microsoft/vscode-languageserver-node/pull/367">{@code textDocument/semanticHighlighting}
// language feature</a> is not yet part of the official LSP specification.
//
struct SemanticHighlightingServerCapabilities
{
//
// A "lookup table" of semantic highlighting <a href="https://manual.macromates.com/en/language_grammars">TextMate scopes</a>
// supported by the language server. If not defined or empty, then the server does not support the semantic highlighting
// feature. Otherwise, clients should reuse this "lookup table" when receiving semantic highlighting notifications from
// the server.
//
std::vector<std::vector<std::string>> scopes;
MAKE_SWAP_METHOD(SemanticHighlightingServerCapabilities, scopes)
};
MAKE_REFLECT_STRUCT(SemanticHighlightingServerCapabilities, scopes)
struct SemanticTokensServerFull
{
//
// The server supports deltas for full documents.
//
bool delta = false;
MAKE_SWAP_METHOD(SemanticTokensServerFull, delta)
};
MAKE_REFLECT_STRUCT(SemanticTokensServerFull, delta)
struct SemanticTokensWithRegistrationOptions
{
SemanticTokensLegend legend;
//
// Server supports providing semantic tokens for a specific range
// of a document.
//
optional<std::pair<optional<bool>, optional<lsp::Any>>> range;
//
// Server supports providing semantic tokens for a full document.
//
optional<std::pair<optional<bool>, optional<SemanticTokensServerFull>>> full;
//
// A document selector to identify the scope of the registration. If set to null
// the document selector provided on the client side will be used.
//
optional<std::vector<DocumentFilter>> documentSelector;
//
// The id used to register the request. The id can be used to deregister
// the request again. See also Registration#id.
//
optional<std::string> id;
MAKE_SWAP_METHOD(SemanticTokensWithRegistrationOptions, legend, range, full, documentSelector, id)
};
MAKE_REFLECT_STRUCT(SemanticTokensWithRegistrationOptions, legend, range, full, documentSelector, id)
using DocumentColorOptions = WorkDoneProgressOptions;
using FoldingRangeOptions = WorkDoneProgressOptions;
struct InlayHintOptions : WorkDoneProgressOptions
{
/**
* The server provides support to resolve additional
* information for an inlay hint item.
*/
optional<bool> resolveProvider;
MAKE_SWAP_METHOD(InlayHintOptions, workDoneProgress, resolveProvider);
};
MAKE_REFLECT_STRUCT(InlayHintOptions, workDoneProgress, resolveProvider)
struct lsServerCapabilities
{
// Defines how text documents are synced. Is either a detailed structure
// defining each notification or for backwards compatibility the
// TextDocumentSyncKind number.
optional<std::pair<optional<lsTextDocumentSyncKind>, optional<lsTextDocumentSyncOptions>>> textDocumentSync;
// The server provides hover support.
optional<bool> hoverProvider;
// The server provides completion support.
optional<lsCompletionOptions> completionProvider;
// The server provides signature help support.
optional<lsSignatureHelpOptions> signatureHelpProvider;
// The server provides goto definition support.
optional<std::pair<optional<bool>, optional<WorkDoneProgressOptions>>> definitionProvider;
//
// The server provides Goto Type Definition support.
//
// Since 3.6.0
//
optional<std::pair<optional<bool>, optional<StaticRegistrationOptions>>> typeDefinitionProvider;
// The server provides implementation support.
optional<std::pair<optional<bool>, optional<StaticRegistrationOptions>>> implementationProvider;
// The server provides find references support.
optional<std::pair<optional<bool>, optional<WorkDoneProgressOptions>>> referencesProvider;
// The server provides document highlight support.
optional<std::pair<optional<bool>, optional<WorkDoneProgressOptions>>> documentHighlightProvider;
// The server provides document symbol support.
optional<std::pair<optional<bool>, optional<WorkDoneProgressOptions>>> documentSymbolProvider;
// The server provides workspace symbol support.
optional<std::pair<optional<bool>, optional<WorkDoneProgressOptions>>> workspaceSymbolProvider;
// The server provides code actions.
optional<std::pair<optional<bool>, optional<CodeActionOptions>>> codeActionProvider;
// The server provides code lens.
optional<CodeLensOptions> codeLensProvider;
// The server provides document formatting.
optional<std::pair<optional<bool>, optional<WorkDoneProgressOptions>>> documentFormattingProvider;
// The server provides document range formatting.
optional<std::pair<optional<bool>, optional<WorkDoneProgressOptions>>> documentRangeFormattingProvider;
// The server provides document formatting on typing.
optional<lsDocumentOnTypeFormattingOptions> documentOnTypeFormattingProvider;
// The server provides rename support.
optional<std::pair<optional<bool>, optional<RenameOptions>>> renameProvider;
// The server provides document link support.
optional<lsDocumentLinkOptions> documentLinkProvider;
//
// The server provides color provider support.
//
// @since 3.6.0
//
optional<std::pair<optional<bool>, optional<DocumentColorOptions>>> colorProvider;
//
// The server provides folding provider support.
//
// @since 3.10.0
//
optional<std::pair<optional<bool>, optional<FoldingRangeOptions>>> foldingRangeProvider;
// The server provides execute command support.
optional<lsExecuteCommandOptions> executeCommandProvider;
//
// Workspace specific server capabilities
//
optional<WorkspaceServerCapabilities> workspace;
//
// Semantic highlighting server capabilities.
//
optional<SemanticHighlightingServerCapabilities> semanticHighlighting;
//
// Server capability for calculating super- and subtype hierarchies.
// The LS supports the type hierarchy language feature, if this capability is set to {@code true}.
//
// <p>
// <b>Note:</b> the <a href=
// "https://github.com/Microsoft/vscode-languageserver-node/pull/426">{@code textDocument/typeHierarchy}
// language feature</a> is not yet part of the official LSP specification.
//
optional<std::pair<optional<bool>, optional<StaticRegistrationOptions>>> typeHierarchyProvider;
//
// The server provides Call Hierarchy support.
//
optional<std::pair<optional<bool>, optional<StaticRegistrationOptions>>> callHierarchyProvider;
//
// The server provides selection range support.
//
// Since 3.15.0
//
optional<std::pair<optional<bool>, optional<StaticRegistrationOptions>>> selectionRangeProvider;
//
// The server provides linked editing range support.
//
// Since 3.16.0
//
optional<std::pair<optional<bool>, optional<StaticRegistrationOptions>>> linkedEditingRangeProvider;
//
// The server provides semantic tokens support.
//
// Since 3.16.0
//
optional<SemanticTokensWithRegistrationOptions> semanticTokensProvider;
//
// Whether server provides moniker support.
//
// Since 3.16.0
//
optional<std::pair<optional<bool>, optional<StaticRegistrationOptions>>> monikerProvider;
/**
* The server provides inlay hints.
*
* @since 3.17.0
*/
optional<std::pair<optional<bool>, optional<InlayHintOptions>>> inlayHintProvider;
optional<lsp::Any> experimental;
MAKE_SWAP_METHOD(
lsServerCapabilities, textDocumentSync, hoverProvider, completionProvider, signatureHelpProvider,
definitionProvider, typeDefinitionProvider, implementationProvider, referencesProvider,
documentHighlightProvider, documentSymbolProvider, workspaceSymbolProvider, codeActionProvider,
codeLensProvider, documentFormattingProvider, documentRangeFormattingProvider, documentOnTypeFormattingProvider,
renameProvider, documentLinkProvider, executeCommandProvider, workspace, semanticHighlighting,
typeHierarchyProvider, callHierarchyProvider, selectionRangeProvider, experimental, colorProvider,
foldingRangeProvider, linkedEditingRangeProvider, monikerProvider, semanticTokensProvider
)
};
MAKE_REFLECT_STRUCT(
lsServerCapabilities, textDocumentSync, hoverProvider, completionProvider, signatureHelpProvider,
definitionProvider, typeDefinitionProvider, implementationProvider, referencesProvider, documentHighlightProvider,
documentSymbolProvider, workspaceSymbolProvider, codeActionProvider, codeLensProvider, documentFormattingProvider,
documentRangeFormattingProvider, documentOnTypeFormattingProvider, renameProvider, documentLinkProvider,
executeCommandProvider, workspace, semanticHighlighting, typeHierarchyProvider, callHierarchyProvider,
selectionRangeProvider, experimental, colorProvider, foldingRangeProvider, linkedEditingRangeProvider,
monikerProvider, semanticTokensProvider
)
|