From 6db0396c837ec89e2fafed57ef7658505e4a09a1 Mon Sep 17 00:00:00 2001 From: Danny Tuppeny Date: Thu, 9 Jul 2020 17:18:07 +0000 Subject: [PATCH] Regenerate code from v3.15 LSP spec Commit v3.15 of LSP spec + regen generated code Change-Id: Ic0823063791900f347e1ff1f2242a6e4e6ed8ca6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153778 Reviewed-by: Brian Wilkerson --- .../lib/lsp_protocol/protocol_generated.dart | 15268 ++++++++++++---- .../lsp/handlers/handler_code_actions.dart | 5 +- .../src/lsp/handlers/handler_completion.dart | 6 +- .../handlers/handler_completion_resolve.dart | 4 + .../src/lsp/handlers/handler_initialize.dart | 16 +- .../lib/src/lsp/lsp_analysis_server.dart | 3 +- .../lib/src/lsp/lsp_socket_server.dart | 9 +- pkg/analysis_server/lib/src/lsp/mapping.dart | 10 +- .../lib/src/lsp/notification_manager.dart | 4 +- .../src/lsp/server_capabilities_computer.dart | 91 +- .../lib/src/lsp/source_edits.dart | 60 +- .../test/lsp/cancel_request_test.dart | 2 + .../test/lsp/completion_test.dart | 2 + .../test/lsp/document_changes_test.dart | 21 +- .../test/lsp/file_modification_test.dart | 16 +- .../test/lsp/initialization_test.dart | 2 + pkg/analysis_server/test/lsp/rename_test.dart | 3 +- .../test/lsp/server_abstract.dart | 108 +- pkg/analysis_server/test/lsp/server_test.dart | 7 +- .../tool/lsp_spec/generated_classes_test.dart | 10 +- .../test/tool/lsp_spec/json_test.dart | 24 +- .../tool/lsp_spec/generate_all.dart | 2 +- .../tool/lsp_spec/lsp_specification.md | 3646 ++-- 23 files changed, 14040 insertions(+), 5279 deletions(-) diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart b/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart index 39e2e89d2ad..bb3efa233f5 100644 --- a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart +++ b/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart @@ -280,16 +280,20 @@ class ClientCapabilities implements ToJsonable { static const jsonHandler = LspJsonHandler(ClientCapabilities.canParse, ClientCapabilities.fromJson); - ClientCapabilities(this.workspace, this.textDocument, this.experimental); + ClientCapabilities( + this.workspace, this.textDocument, this.window, this.experimental); static ClientCapabilities fromJson(Map json) { final workspace = json['workspace'] != null - ? WorkspaceClientCapabilities.fromJson(json['workspace']) + ? ClientCapabilitiesWorkspace.fromJson(json['workspace']) : null; final textDocument = json['textDocument'] != null ? TextDocumentClientCapabilities.fromJson(json['textDocument']) : null; + final window = json['window'] != null + ? ClientCapabilitiesWindow.fromJson(json['window']) + : null; final experimental = json['experimental']; - return ClientCapabilities(workspace, textDocument, experimental); + return ClientCapabilities(workspace, textDocument, window, experimental); } /// Experimental client capabilities. @@ -298,8 +302,11 @@ class ClientCapabilities implements ToJsonable { /// Text document specific client capabilities. final TextDocumentClientCapabilities textDocument; + /// Window specific client capabilities. + final ClientCapabilitiesWindow window; + /// Workspace specific client capabilities. - final WorkspaceClientCapabilities workspace; + final ClientCapabilitiesWorkspace workspace; Map toJson() { var __result = {}; @@ -309,6 +316,9 @@ class ClientCapabilities implements ToJsonable { if (textDocument != null) { __result['textDocument'] = textDocument; } + if (window != null) { + __result['window'] = window; + } if (experimental != null) { __result['experimental'] = experimental; } @@ -320,9 +330,9 @@ class ClientCapabilities implements ToJsonable { reporter.push('workspace'); try { if (obj['workspace'] != null && - !(WorkspaceClientCapabilities.canParse( + !(ClientCapabilitiesWorkspace.canParse( obj['workspace'], reporter))) { - reporter.reportError('must be of type WorkspaceClientCapabilities'); + reporter.reportError('must be of type ClientCapabilitiesWorkspace'); return false; } } finally { @@ -340,6 +350,16 @@ class ClientCapabilities implements ToJsonable { } finally { reporter.pop(); } + reporter.push('window'); + try { + if (obj['window'] != null && + !(ClientCapabilitiesWindow.canParse(obj['window'], reporter))) { + reporter.reportError('must be of type ClientCapabilitiesWindow'); + return false; + } + } finally { + reporter.pop(); + } reporter.push('experimental'); try { if (obj['experimental'] != null && !(true)) { @@ -362,6 +382,7 @@ class ClientCapabilities implements ToJsonable { other.runtimeType == ClientCapabilities) { return workspace == other.workspace && textDocument == other.textDocument && + window == other.window && experimental == other.experimental && true; } @@ -373,6 +394,7 @@ class ClientCapabilities implements ToJsonable { var hash = 0; hash = JenkinsSmiHash.combine(hash, workspace.hashCode); hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); + hash = JenkinsSmiHash.combine(hash, window.hashCode); hash = JenkinsSmiHash.combine(hash, experimental.hashCode); return JenkinsSmiHash.finish(hash); } @@ -381,6 +403,308 @@ class ClientCapabilities implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } +class ClientCapabilitiesWindow implements ToJsonable { + static const jsonHandler = LspJsonHandler( + ClientCapabilitiesWindow.canParse, ClientCapabilitiesWindow.fromJson); + + ClientCapabilitiesWindow(this.workDoneProgress); + static ClientCapabilitiesWindow fromJson(Map json) { + final workDoneProgress = json['workDoneProgress']; + return ClientCapabilitiesWindow(workDoneProgress); + } + + /// Whether client supports handling progress notifications. If set servers + /// are allowed to report in `workDoneProgress` property in the request + /// specific server capabilities. + /// + /// Since 3.15.0 + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type ClientCapabilitiesWindow'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is ClientCapabilitiesWindow && + other.runtimeType == ClientCapabilitiesWindow) { + return workDoneProgress == other.workDoneProgress && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class ClientCapabilitiesWorkspace implements ToJsonable { + static const jsonHandler = LspJsonHandler( + ClientCapabilitiesWorkspace.canParse, + ClientCapabilitiesWorkspace.fromJson); + + ClientCapabilitiesWorkspace( + this.applyEdit, + this.workspaceEdit, + this.didChangeConfiguration, + this.didChangeWatchedFiles, + this.symbol, + this.executeCommand, + this.workspaceFolders, + this.configuration); + static ClientCapabilitiesWorkspace fromJson(Map json) { + final applyEdit = json['applyEdit']; + final workspaceEdit = json['workspaceEdit'] != null + ? WorkspaceEditClientCapabilities.fromJson(json['workspaceEdit']) + : null; + final didChangeConfiguration = json['didChangeConfiguration'] != null + ? DidChangeConfigurationClientCapabilities.fromJson( + json['didChangeConfiguration']) + : null; + final didChangeWatchedFiles = json['didChangeWatchedFiles'] != null + ? DidChangeWatchedFilesClientCapabilities.fromJson( + json['didChangeWatchedFiles']) + : null; + final symbol = json['symbol'] != null + ? WorkspaceSymbolClientCapabilities.fromJson(json['symbol']) + : null; + final executeCommand = json['executeCommand'] != null + ? ExecuteCommandClientCapabilities.fromJson(json['executeCommand']) + : null; + final workspaceFolders = json['workspaceFolders']; + final configuration = json['configuration']; + return ClientCapabilitiesWorkspace( + applyEdit, + workspaceEdit, + didChangeConfiguration, + didChangeWatchedFiles, + symbol, + executeCommand, + workspaceFolders, + configuration); + } + + /// The client supports applying batch edits to the workspace by supporting + /// the request 'workspace/applyEdit' + final bool applyEdit; + + /// The client supports `workspace/configuration` requests. + /// + /// Since 3.6.0 + final bool configuration; + + /// Capabilities specific to the `workspace/didChangeConfiguration` + /// notification. + final DidChangeConfigurationClientCapabilities didChangeConfiguration; + + /// Capabilities specific to the `workspace/didChangeWatchedFiles` + /// notification. + final DidChangeWatchedFilesClientCapabilities didChangeWatchedFiles; + + /// Capabilities specific to the `workspace/executeCommand` request. + final ExecuteCommandClientCapabilities executeCommand; + + /// Capabilities specific to the `workspace/symbol` request. + final WorkspaceSymbolClientCapabilities symbol; + + /// Capabilities specific to `WorkspaceEdit`s + final WorkspaceEditClientCapabilities workspaceEdit; + + /// The client has support for workspace folders. + /// + /// Since 3.6.0 + final bool workspaceFolders; + + Map toJson() { + var __result = {}; + if (applyEdit != null) { + __result['applyEdit'] = applyEdit; + } + if (workspaceEdit != null) { + __result['workspaceEdit'] = workspaceEdit; + } + if (didChangeConfiguration != null) { + __result['didChangeConfiguration'] = didChangeConfiguration; + } + if (didChangeWatchedFiles != null) { + __result['didChangeWatchedFiles'] = didChangeWatchedFiles; + } + if (symbol != null) { + __result['symbol'] = symbol; + } + if (executeCommand != null) { + __result['executeCommand'] = executeCommand; + } + if (workspaceFolders != null) { + __result['workspaceFolders'] = workspaceFolders; + } + if (configuration != null) { + __result['configuration'] = configuration; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('applyEdit'); + try { + if (obj['applyEdit'] != null && !(obj['applyEdit'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workspaceEdit'); + try { + if (obj['workspaceEdit'] != null && + !(WorkspaceEditClientCapabilities.canParse( + obj['workspaceEdit'], reporter))) { + reporter + .reportError('must be of type WorkspaceEditClientCapabilities'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('didChangeConfiguration'); + try { + if (obj['didChangeConfiguration'] != null && + !(DidChangeConfigurationClientCapabilities.canParse( + obj['didChangeConfiguration'], reporter))) { + reporter.reportError( + 'must be of type DidChangeConfigurationClientCapabilities'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('didChangeWatchedFiles'); + try { + if (obj['didChangeWatchedFiles'] != null && + !(DidChangeWatchedFilesClientCapabilities.canParse( + obj['didChangeWatchedFiles'], reporter))) { + reporter.reportError( + 'must be of type DidChangeWatchedFilesClientCapabilities'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('symbol'); + try { + if (obj['symbol'] != null && + !(WorkspaceSymbolClientCapabilities.canParse( + obj['symbol'], reporter))) { + reporter + .reportError('must be of type WorkspaceSymbolClientCapabilities'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('executeCommand'); + try { + if (obj['executeCommand'] != null && + !(ExecuteCommandClientCapabilities.canParse( + obj['executeCommand'], reporter))) { + reporter + .reportError('must be of type ExecuteCommandClientCapabilities'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workspaceFolders'); + try { + if (obj['workspaceFolders'] != null && + !(obj['workspaceFolders'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('configuration'); + try { + if (obj['configuration'] != null && !(obj['configuration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type ClientCapabilitiesWorkspace'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is ClientCapabilitiesWorkspace && + other.runtimeType == ClientCapabilitiesWorkspace) { + return applyEdit == other.applyEdit && + workspaceEdit == other.workspaceEdit && + didChangeConfiguration == other.didChangeConfiguration && + didChangeWatchedFiles == other.didChangeWatchedFiles && + symbol == other.symbol && + executeCommand == other.executeCommand && + workspaceFolders == other.workspaceFolders && + configuration == other.configuration && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, applyEdit.hashCode); + hash = JenkinsSmiHash.combine(hash, workspaceEdit.hashCode); + hash = JenkinsSmiHash.combine(hash, didChangeConfiguration.hashCode); + hash = JenkinsSmiHash.combine(hash, didChangeWatchedFiles.hashCode); + hash = JenkinsSmiHash.combine(hash, symbol.hashCode); + hash = JenkinsSmiHash.combine(hash, executeCommand.hashCode); + hash = JenkinsSmiHash.combine(hash, workspaceFolders.hashCode); + hash = JenkinsSmiHash.combine(hash, configuration.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + /// A code action represents a change that can be performed in code, e.g. to fix /// a problem or to refactor code. /// @@ -390,7 +714,8 @@ class CodeAction implements ToJsonable { static const jsonHandler = LspJsonHandler(CodeAction.canParse, CodeAction.fromJson); - CodeAction(this.title, this.kind, this.diagnostics, this.edit, this.command) { + CodeAction(this.title, this.kind, this.diagnostics, this.isPreferred, + this.edit, this.command) { if (title == null) { throw 'title is required but was not provided'; } @@ -403,11 +728,12 @@ class CodeAction implements ToJsonable { ?.map((item) => item != null ? Diagnostic.fromJson(item) : null) ?.cast() ?.toList(); + final isPreferred = json['isPreferred']; final edit = json['edit'] != null ? WorkspaceEdit.fromJson(json['edit']) : null; final command = json['command'] != null ? Command.fromJson(json['command']) : null; - return CodeAction(title, kind, diagnostics, edit, command); + return CodeAction(title, kind, diagnostics, isPreferred, edit, command); } /// A command this code action executes. If a code action provides an edit and @@ -420,6 +746,15 @@ class CodeAction implements ToJsonable { /// The workspace edit this code action performs. final WorkspaceEdit edit; + /// Marks this as a preferred action. Preferred actions are used by the `auto + /// fix` command and can be targeted by keybindings. + /// + /// A quick fix should be marked preferred if it properly addresses the + /// underlying error. A refactoring should be marked preferred if it is the + /// most reasonable choice of actions to take. + /// @since 3.15.0 + final bool isPreferred; + /// The kind of the code action. /// /// Used to filter code actions. @@ -437,6 +772,9 @@ class CodeAction implements ToJsonable { if (diagnostics != null) { __result['diagnostics'] = diagnostics; } + if (isPreferred != null) { + __result['isPreferred'] = isPreferred; + } if (edit != null) { __result['edit'] = edit; } @@ -487,6 +825,15 @@ class CodeAction implements ToJsonable { } finally { reporter.pop(); } + reporter.push('isPreferred'); + try { + if (obj['isPreferred'] != null && !(obj['isPreferred'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } reporter.push('edit'); try { if (obj['edit'] != null && @@ -521,6 +868,7 @@ class CodeAction implements ToJsonable { kind == other.kind && listEqual(diagnostics, other.diagnostics, (Diagnostic a, Diagnostic b) => a == b) && + isPreferred == other.isPreferred && edit == other.edit && command == other.command && true; @@ -534,6 +882,7 @@ class CodeAction implements ToJsonable { hash = JenkinsSmiHash.combine(hash, title.hashCode); hash = JenkinsSmiHash.combine(hash, kind.hashCode); hash = JenkinsSmiHash.combine(hash, lspHashCode(diagnostics)); + hash = JenkinsSmiHash.combine(hash, isPreferred.hashCode); hash = JenkinsSmiHash.combine(hash, edit.hashCode); hash = JenkinsSmiHash.combine(hash, command.hashCode); return JenkinsSmiHash.finish(hash); @@ -543,6 +892,278 @@ class CodeAction implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } +class CodeActionClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + CodeActionClientCapabilities.canParse, + CodeActionClientCapabilities.fromJson); + + CodeActionClientCapabilities(this.dynamicRegistration, + this.codeActionLiteralSupport, this.isPreferredSupport); + static CodeActionClientCapabilities fromJson(Map json) { + final dynamicRegistration = json['dynamicRegistration']; + final codeActionLiteralSupport = json['codeActionLiteralSupport'] != null + ? CodeActionClientCapabilitiesCodeActionLiteralSupport.fromJson( + json['codeActionLiteralSupport']) + : null; + final isPreferredSupport = json['isPreferredSupport']; + return CodeActionClientCapabilities( + dynamicRegistration, codeActionLiteralSupport, isPreferredSupport); + } + + /// The client supports code action literals as a valid response of the + /// `textDocument/codeAction` request. + /// @since 3.8.0 + final CodeActionClientCapabilitiesCodeActionLiteralSupport + codeActionLiteralSupport; + + /// Whether code action supports dynamic registration. + final bool dynamicRegistration; + + /// Whether code action supports the `isPreferred` property. @since 3.15.0 + final bool isPreferredSupport; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + if (codeActionLiteralSupport != null) { + __result['codeActionLiteralSupport'] = codeActionLiteralSupport; + } + if (isPreferredSupport != null) { + __result['isPreferredSupport'] = isPreferredSupport; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('codeActionLiteralSupport'); + try { + if (obj['codeActionLiteralSupport'] != null && + !(CodeActionClientCapabilitiesCodeActionLiteralSupport.canParse( + obj['codeActionLiteralSupport'], reporter))) { + reporter.reportError( + 'must be of type CodeActionClientCapabilitiesCodeActionLiteralSupport'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('isPreferredSupport'); + try { + if (obj['isPreferredSupport'] != null && + !(obj['isPreferredSupport'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type CodeActionClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is CodeActionClientCapabilities && + other.runtimeType == CodeActionClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && + codeActionLiteralSupport == other.codeActionLiteralSupport && + isPreferredSupport == other.isPreferredSupport && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + hash = JenkinsSmiHash.combine(hash, codeActionLiteralSupport.hashCode); + hash = JenkinsSmiHash.combine(hash, isPreferredSupport.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class CodeActionClientCapabilitiesCodeActionKind implements ToJsonable { + static const jsonHandler = LspJsonHandler( + CodeActionClientCapabilitiesCodeActionKind.canParse, + CodeActionClientCapabilitiesCodeActionKind.fromJson); + + CodeActionClientCapabilitiesCodeActionKind(this.valueSet) { + if (valueSet == null) { + throw 'valueSet is required but was not provided'; + } + } + static CodeActionClientCapabilitiesCodeActionKind fromJson( + Map json) { + final valueSet = json['valueSet'] + ?.map((item) => item != null ? CodeActionKind.fromJson(item) : null) + ?.cast() + ?.toList(); + return CodeActionClientCapabilitiesCodeActionKind(valueSet); + } + + /// The code action kind values the client supports. When this property exists + /// the client also guarantees that it will handle values outside its set + /// gracefully and falls back to a default value when unknown. + final List valueSet; + + Map toJson() { + var __result = {}; + __result['valueSet'] = + valueSet ?? (throw 'valueSet is required but was not set'); + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('valueSet'); + try { + if (!obj.containsKey('valueSet')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['valueSet'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!((obj['valueSet'] is List && + (obj['valueSet'] + .every((item) => CodeActionKind.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError( + 'must be of type CodeActionClientCapabilitiesCodeActionKind'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is CodeActionClientCapabilitiesCodeActionKind && + other.runtimeType == CodeActionClientCapabilitiesCodeActionKind) { + return listEqual(valueSet, other.valueSet, + (CodeActionKind a, CodeActionKind b) => a == b) && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, lspHashCode(valueSet)); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class CodeActionClientCapabilitiesCodeActionLiteralSupport + implements ToJsonable { + static const jsonHandler = LspJsonHandler( + CodeActionClientCapabilitiesCodeActionLiteralSupport.canParse, + CodeActionClientCapabilitiesCodeActionLiteralSupport.fromJson); + + CodeActionClientCapabilitiesCodeActionLiteralSupport(this.codeActionKind) { + if (codeActionKind == null) { + throw 'codeActionKind is required but was not provided'; + } + } + static CodeActionClientCapabilitiesCodeActionLiteralSupport fromJson( + Map json) { + final codeActionKind = json['codeActionKind'] != null + ? CodeActionClientCapabilitiesCodeActionKind.fromJson( + json['codeActionKind']) + : null; + return CodeActionClientCapabilitiesCodeActionLiteralSupport(codeActionKind); + } + + /// The code action kind is supported with the following value set. + final CodeActionClientCapabilitiesCodeActionKind codeActionKind; + + Map toJson() { + var __result = {}; + __result['codeActionKind'] = + codeActionKind ?? (throw 'codeActionKind is required but was not set'); + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('codeActionKind'); + try { + if (!obj.containsKey('codeActionKind')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['codeActionKind'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(CodeActionClientCapabilitiesCodeActionKind.canParse( + obj['codeActionKind'], reporter))) { + reporter.reportError( + 'must be of type CodeActionClientCapabilitiesCodeActionKind'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError( + 'must be of type CodeActionClientCapabilitiesCodeActionLiteralSupport'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is CodeActionClientCapabilitiesCodeActionLiteralSupport && + other.runtimeType == + CodeActionClientCapabilitiesCodeActionLiteralSupport) { + return codeActionKind == other.codeActionKind && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, codeActionKind.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + /// Contains additional diagnostic information about the context in which a code /// action is run. class CodeActionContext implements ToJsonable { @@ -566,7 +1187,12 @@ class CodeActionContext implements ToJsonable { return CodeActionContext(diagnostics, only); } - /// An array of diagnostics. + /// An array of diagnostics known on the client side overlapping the range + /// provided to the `textDocument/codeAction` request. They are provided so + /// that the server knows which errors are currently presented to the user for + /// the given range. There is no guarantee that these accurately reflect the + /// error state of the resource. The primary parameter to compute code actions + /// is the provided range. final List diagnostics; /// Requested kind of actions to return. @@ -649,7 +1275,7 @@ class CodeActionContext implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -/// A set of predefined code action kinds +/// A set of predefined code action kinds. class CodeActionKind { const CodeActionKind(this._value); const CodeActionKind.fromJson(this._value); @@ -663,13 +1289,13 @@ class CodeActionKind { /// Empty kind. static const Empty = CodeActionKind(''); - /// Base kind for quickfix actions: 'quickfix' + /// Base kind for quickfix actions: 'quickfix'. static const QuickFix = CodeActionKind('quickfix'); - /// Base kind for refactoring actions: 'refactor' + /// Base kind for refactoring actions: 'refactor'. static const Refactor = CodeActionKind('refactor'); - /// Base kind for refactoring extraction actions: 'refactor.extract' + /// Base kind for refactoring extraction actions: 'refactor.extract'. /// /// Example extract actions: /// @@ -680,7 +1306,7 @@ class CodeActionKind { /// - ... static const RefactorExtract = CodeActionKind('refactor.extract'); - /// Base kind for refactoring inline actions: 'refactor.inline' + /// Base kind for refactoring inline actions: 'refactor.inline'. /// /// Example inline actions: /// @@ -690,7 +1316,7 @@ class CodeActionKind { /// - ... static const RefactorInline = CodeActionKind('refactor.inline'); - /// Base kind for refactoring rewrite actions: 'refactor.rewrite' + /// Base kind for refactoring rewrite actions: 'refactor.rewrite'. /// /// Example rewrite actions: /// @@ -702,12 +1328,12 @@ class CodeActionKind { /// - ... static const RefactorRewrite = CodeActionKind('refactor.rewrite'); - /// Base kind for source actions: `source` + /// Base kind for source actions: `source`. /// /// Source code actions apply to the entire file. static const Source = CodeActionKind('source'); - /// Base kind for an organize imports source action: `source.organizeImports` + /// Base kind for an organize imports source action: `source.organizeImports`. static const SourceOrganizeImports = CodeActionKind('source.organizeImports'); Object toJson() => _value; @@ -721,12 +1347,11 @@ class CodeActionKind { bool operator ==(Object o) => o is CodeActionKind && o._value == _value; } -/// Code Action options. -class CodeActionOptions implements ToJsonable { +class CodeActionOptions implements WorkDoneProgressOptions, ToJsonable { static const jsonHandler = LspJsonHandler(CodeActionOptions.canParse, CodeActionOptions.fromJson); - CodeActionOptions(this.codeActionKinds); + CodeActionOptions(this.codeActionKinds, this.workDoneProgress); static CodeActionOptions fromJson(Map json) { if (CodeActionRegistrationOptions.canParse(json, nullLspJsonReporter)) { return CodeActionRegistrationOptions.fromJson(json); @@ -735,7 +1360,8 @@ class CodeActionOptions implements ToJsonable { ?.map((item) => item != null ? CodeActionKind.fromJson(item) : null) ?.cast() ?.toList(); - return CodeActionOptions(codeActionKinds); + final workDoneProgress = json['workDoneProgress']; + return CodeActionOptions(codeActionKinds, workDoneProgress); } /// CodeActionKinds that this server may return. @@ -743,12 +1369,16 @@ class CodeActionOptions implements ToJsonable { /// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or /// the server may list out every specific kind they provide. final List codeActionKinds; + final bool workDoneProgress; Map toJson() { var __result = {}; if (codeActionKinds != null) { __result['codeActionKinds'] = codeActionKinds; } + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } return __result; } @@ -766,6 +1396,16 @@ class CodeActionOptions implements ToJsonable { } finally { reporter.pop(); } + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type CodeActionOptions'); @@ -778,6 +1418,7 @@ class CodeActionOptions implements ToJsonable { if (other is CodeActionOptions && other.runtimeType == CodeActionOptions) { return listEqual(codeActionKinds, other.codeActionKinds, (CodeActionKind a, CodeActionKind b) => a == b) && + workDoneProgress == other.workDoneProgress && true; } return false; @@ -787,6 +1428,7 @@ class CodeActionOptions implements ToJsonable { int get hashCode { var hash = 0; hash = JenkinsSmiHash.combine(hash, lspHashCode(codeActionKinds)); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); return JenkinsSmiHash.finish(hash); } @@ -795,11 +1437,13 @@ class CodeActionOptions implements ToJsonable { } /// Params for the CodeActionRequest -class CodeActionParams implements ToJsonable { +class CodeActionParams + implements WorkDoneProgressParams, PartialResultParams, ToJsonable { static const jsonHandler = LspJsonHandler(CodeActionParams.canParse, CodeActionParams.fromJson); - CodeActionParams(this.textDocument, this.range, this.context) { + CodeActionParams(this.textDocument, this.range, this.context, + this.workDoneToken, this.partialResultToken) { if (textDocument == null) { throw 'textDocument is required but was not provided'; } @@ -818,18 +1462,40 @@ class CodeActionParams implements ToJsonable { final context = json['context'] != null ? CodeActionContext.fromJson(json['context']) : null; - return CodeActionParams(textDocument, range, context); + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + final partialResultToken = json['partialResultToken'] is num + ? Either2.t1(json['partialResultToken']) + : (json['partialResultToken'] is String + ? Either2.t2(json['partialResultToken']) + : (json['partialResultToken'] == null + ? null + : (throw '''${json['partialResultToken']} was not one of (num, String)'''))); + return CodeActionParams( + textDocument, range, context, workDoneToken, partialResultToken); } /// Context carrying additional information. final CodeActionContext context; + /// An optional token that a server can use to report partial results (e.g. + /// streaming) to the client. + final Either2 partialResultToken; + /// The range for which the command was invoked. final Range range; /// The document in which the command was invoked. final TextDocumentIdentifier textDocument; + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + Map toJson() { var __result = {}; __result['textDocument'] = @@ -837,6 +1503,12 @@ class CodeActionParams implements ToJsonable { __result['range'] = range ?? (throw 'range is required but was not set'); __result['context'] = context ?? (throw 'context is required but was not set'); + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } + if (partialResultToken != null) { + __result['partialResultToken'] = partialResultToken; + } return __result; } @@ -893,6 +1565,28 @@ class CodeActionParams implements ToJsonable { } finally { reporter.pop(); } + reporter.push('workDoneToken'); + try { + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('partialResultToken'); + try { + if (obj['partialResultToken'] != null && + !((obj['partialResultToken'] is num || + obj['partialResultToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type CodeActionParams'); @@ -906,6 +1600,8 @@ class CodeActionParams implements ToJsonable { return textDocument == other.textDocument && range == other.range && context == other.context && + workDoneToken == other.workDoneToken && + partialResultToken == other.partialResultToken && true; } return false; @@ -917,6 +1613,8 @@ class CodeActionParams implements ToJsonable { hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); hash = JenkinsSmiHash.combine(hash, range.hashCode); hash = JenkinsSmiHash.combine(hash, context.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); + hash = JenkinsSmiHash.combine(hash, partialResultToken.hashCode); return JenkinsSmiHash.finish(hash); } @@ -930,7 +1628,8 @@ class CodeActionRegistrationOptions CodeActionRegistrationOptions.canParse, CodeActionRegistrationOptions.fromJson); - CodeActionRegistrationOptions(this.documentSelector, this.codeActionKinds); + CodeActionRegistrationOptions( + this.documentSelector, this.codeActionKinds, this.workDoneProgress); static CodeActionRegistrationOptions fromJson(Map json) { final documentSelector = json['documentSelector'] ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) @@ -940,7 +1639,9 @@ class CodeActionRegistrationOptions ?.map((item) => item != null ? CodeActionKind.fromJson(item) : null) ?.cast() ?.toList(); - return CodeActionRegistrationOptions(documentSelector, codeActionKinds); + final workDoneProgress = json['workDoneProgress']; + return CodeActionRegistrationOptions( + documentSelector, codeActionKinds, workDoneProgress); } /// CodeActionKinds that this server may return. @@ -952,6 +1653,7 @@ class CodeActionRegistrationOptions /// 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. final List documentSelector; + final bool workDoneProgress; Map toJson() { var __result = {}; @@ -959,6 +1661,9 @@ class CodeActionRegistrationOptions if (codeActionKinds != null) { __result['codeActionKinds'] = codeActionKinds; } + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } return __result; } @@ -992,6 +1697,16 @@ class CodeActionRegistrationOptions } finally { reporter.pop(); } + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type CodeActionRegistrationOptions'); @@ -1007,6 +1722,7 @@ class CodeActionRegistrationOptions (DocumentFilter a, DocumentFilter b) => a == b) && listEqual(codeActionKinds, other.codeActionKinds, (CodeActionKind a, CodeActionKind b) => a == b) && + workDoneProgress == other.workDoneProgress && true; } return false; @@ -1017,6 +1733,7 @@ class CodeActionRegistrationOptions var hash = 0; hash = JenkinsSmiHash.combine(hash, lspHashCode(documentSelector)); hash = JenkinsSmiHash.combine(hash, lspHashCode(codeActionKinds)); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); return JenkinsSmiHash.finish(hash); } @@ -1139,25 +1856,92 @@ class CodeLens implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -/// Code Lens options. -class CodeLensOptions implements ToJsonable { +class CodeLensClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + CodeLensClientCapabilities.canParse, CodeLensClientCapabilities.fromJson); + + CodeLensClientCapabilities(this.dynamicRegistration); + static CodeLensClientCapabilities fromJson(Map json) { + final dynamicRegistration = json['dynamicRegistration']; + return CodeLensClientCapabilities(dynamicRegistration); + } + + /// Whether code lens supports dynamic registration. + final bool dynamicRegistration; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type CodeLensClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is CodeLensClientCapabilities && + other.runtimeType == CodeLensClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class CodeLensOptions implements WorkDoneProgressOptions, ToJsonable { static const jsonHandler = LspJsonHandler(CodeLensOptions.canParse, CodeLensOptions.fromJson); - CodeLensOptions(this.resolveProvider); + CodeLensOptions(this.resolveProvider, this.workDoneProgress); static CodeLensOptions fromJson(Map json) { + if (CodeLensRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return CodeLensRegistrationOptions.fromJson(json); + } final resolveProvider = json['resolveProvider']; - return CodeLensOptions(resolveProvider); + final workDoneProgress = json['workDoneProgress']; + return CodeLensOptions(resolveProvider, workDoneProgress); } /// Code lens has a resolve provider as well. final bool resolveProvider; + final bool workDoneProgress; Map toJson() { var __result = {}; if (resolveProvider != null) { __result['resolveProvider'] = resolveProvider; } + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } return __result; } @@ -1173,6 +1957,16 @@ class CodeLensOptions implements ToJsonable { } finally { reporter.pop(); } + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type CodeLensOptions'); @@ -1183,7 +1977,9 @@ class CodeLensOptions implements ToJsonable { @override bool operator ==(Object other) { if (other is CodeLensOptions && other.runtimeType == CodeLensOptions) { - return resolveProvider == other.resolveProvider && true; + return resolveProvider == other.resolveProvider && + workDoneProgress == other.workDoneProgress && + true; } return false; } @@ -1192,6 +1988,7 @@ class CodeLensOptions implements ToJsonable { int get hashCode { var hash = 0; hash = JenkinsSmiHash.combine(hash, resolveProvider.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); return JenkinsSmiHash.finish(hash); } @@ -1199,11 +1996,13 @@ class CodeLensOptions implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -class CodeLensParams implements ToJsonable { +class CodeLensParams + implements WorkDoneProgressParams, PartialResultParams, ToJsonable { static const jsonHandler = LspJsonHandler(CodeLensParams.canParse, CodeLensParams.fromJson); - CodeLensParams(this.textDocument) { + CodeLensParams( + this.textDocument, this.workDoneToken, this.partialResultToken) { if (textDocument == null) { throw 'textDocument is required but was not provided'; } @@ -1212,16 +2011,43 @@ class CodeLensParams implements ToJsonable { final textDocument = json['textDocument'] != null ? TextDocumentIdentifier.fromJson(json['textDocument']) : null; - return CodeLensParams(textDocument); + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + final partialResultToken = json['partialResultToken'] is num + ? Either2.t1(json['partialResultToken']) + : (json['partialResultToken'] is String + ? Either2.t2(json['partialResultToken']) + : (json['partialResultToken'] == null + ? null + : (throw '''${json['partialResultToken']} was not one of (num, String)'''))); + return CodeLensParams(textDocument, workDoneToken, partialResultToken); } + /// An optional token that a server can use to report partial results (e.g. + /// streaming) to the client. + final Either2 partialResultToken; + /// The document to request code lens for. final TextDocumentIdentifier textDocument; + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + Map toJson() { var __result = {}; __result['textDocument'] = textDocument ?? (throw 'textDocument is required but was not set'); + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } + if (partialResultToken != null) { + __result['partialResultToken'] = partialResultToken; + } return __result; } @@ -1244,6 +2070,28 @@ class CodeLensParams implements ToJsonable { } finally { reporter.pop(); } + reporter.push('workDoneToken'); + try { + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('partialResultToken'); + try { + if (obj['partialResultToken'] != null && + !((obj['partialResultToken'] is num || + obj['partialResultToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type CodeLensParams'); @@ -1254,7 +2102,10 @@ class CodeLensParams implements ToJsonable { @override bool operator ==(Object other) { if (other is CodeLensParams && other.runtimeType == CodeLensParams) { - return textDocument == other.textDocument && true; + return textDocument == other.textDocument && + workDoneToken == other.workDoneToken && + partialResultToken == other.partialResultToken && + true; } return false; } @@ -1263,6 +2114,8 @@ class CodeLensParams implements ToJsonable { int get hashCode { var hash = 0; hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); + hash = JenkinsSmiHash.combine(hash, partialResultToken.hashCode); return JenkinsSmiHash.finish(hash); } @@ -1271,19 +2124,22 @@ class CodeLensParams implements ToJsonable { } class CodeLensRegistrationOptions - implements TextDocumentRegistrationOptions, ToJsonable { + implements TextDocumentRegistrationOptions, CodeLensOptions, ToJsonable { static const jsonHandler = LspJsonHandler( CodeLensRegistrationOptions.canParse, CodeLensRegistrationOptions.fromJson); - CodeLensRegistrationOptions(this.resolveProvider, this.documentSelector); + CodeLensRegistrationOptions( + this.documentSelector, this.resolveProvider, this.workDoneProgress); static CodeLensRegistrationOptions fromJson(Map json) { - final resolveProvider = json['resolveProvider']; final documentSelector = json['documentSelector'] ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) ?.cast() ?.toList(); - return CodeLensRegistrationOptions(resolveProvider, documentSelector); + final resolveProvider = json['resolveProvider']; + final workDoneProgress = json['workDoneProgress']; + return CodeLensRegistrationOptions( + documentSelector, resolveProvider, workDoneProgress); } /// A document selector to identify the scope of the registration. If set to @@ -1292,28 +2148,22 @@ class CodeLensRegistrationOptions /// Code lens has a resolve provider as well. final bool resolveProvider; + final bool workDoneProgress; Map toJson() { var __result = {}; + __result['documentSelector'] = documentSelector; if (resolveProvider != null) { __result['resolveProvider'] = resolveProvider; } - __result['documentSelector'] = documentSelector; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } return __result; } static bool canParse(Object obj, LspJsonReporter reporter) { if (obj is Map) { - reporter.push('resolveProvider'); - try { - if (obj['resolveProvider'] != null && - !(obj['resolveProvider'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } reporter.push('documentSelector'); try { if (!obj.containsKey('documentSelector')) { @@ -1330,6 +2180,26 @@ class CodeLensRegistrationOptions } finally { reporter.pop(); } + reporter.push('resolveProvider'); + try { + if (obj['resolveProvider'] != null && + !(obj['resolveProvider'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type CodeLensRegistrationOptions'); @@ -1341,9 +2211,10 @@ class CodeLensRegistrationOptions bool operator ==(Object other) { if (other is CodeLensRegistrationOptions && other.runtimeType == CodeLensRegistrationOptions) { - return resolveProvider == other.resolveProvider && - listEqual(documentSelector, other.documentSelector, + return listEqual(documentSelector, other.documentSelector, (DocumentFilter a, DocumentFilter b) => a == b) && + resolveProvider == other.resolveProvider && + workDoneProgress == other.workDoneProgress && true; } return false; @@ -1352,8 +2223,9 @@ class CodeLensRegistrationOptions @override int get hashCode { var hash = 0; - hash = JenkinsSmiHash.combine(hash, resolveProvider.hashCode); hash = JenkinsSmiHash.combine(hash, lspHashCode(documentSelector)); + hash = JenkinsSmiHash.combine(hash, resolveProvider.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); return JenkinsSmiHash.finish(hash); } @@ -1725,11 +2597,13 @@ class ColorPresentation implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -class ColorPresentationParams implements ToJsonable { +class ColorPresentationParams + implements WorkDoneProgressParams, PartialResultParams, ToJsonable { static const jsonHandler = LspJsonHandler( ColorPresentationParams.canParse, ColorPresentationParams.fromJson); - ColorPresentationParams(this.textDocument, this.color, this.range) { + ColorPresentationParams(this.textDocument, this.color, this.range, + this.workDoneToken, this.partialResultToken) { if (textDocument == null) { throw 'textDocument is required but was not provided'; } @@ -1746,24 +2620,52 @@ class ColorPresentationParams implements ToJsonable { : null; final color = json['color'] != null ? Color.fromJson(json['color']) : null; final range = json['range'] != null ? Range.fromJson(json['range']) : null; - return ColorPresentationParams(textDocument, color, range); + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + final partialResultToken = json['partialResultToken'] is num + ? Either2.t1(json['partialResultToken']) + : (json['partialResultToken'] is String + ? Either2.t2(json['partialResultToken']) + : (json['partialResultToken'] == null + ? null + : (throw '''${json['partialResultToken']} was not one of (num, String)'''))); + return ColorPresentationParams( + textDocument, color, range, workDoneToken, partialResultToken); } /// The color information to request presentations for. final Color color; + /// An optional token that a server can use to report partial results (e.g. + /// streaming) to the client. + final Either2 partialResultToken; + /// The range where the color would be inserted. Serves as a context. final Range range; /// The text document. final TextDocumentIdentifier textDocument; + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + Map toJson() { var __result = {}; __result['textDocument'] = textDocument ?? (throw 'textDocument is required but was not set'); __result['color'] = color ?? (throw 'color is required but was not set'); __result['range'] = range ?? (throw 'range is required but was not set'); + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } + if (partialResultToken != null) { + __result['partialResultToken'] = partialResultToken; + } return __result; } @@ -1820,6 +2722,28 @@ class ColorPresentationParams implements ToJsonable { } finally { reporter.pop(); } + reporter.push('workDoneToken'); + try { + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('partialResultToken'); + try { + if (obj['partialResultToken'] != null && + !((obj['partialResultToken'] is num || + obj['partialResultToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type ColorPresentationParams'); @@ -1834,6 +2758,8 @@ class ColorPresentationParams implements ToJsonable { return textDocument == other.textDocument && color == other.color && range == other.range && + workDoneToken == other.workDoneToken && + partialResultToken == other.partialResultToken && true; } return false; @@ -1845,48 +2771,8 @@ class ColorPresentationParams implements ToJsonable { hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); hash = JenkinsSmiHash.combine(hash, color.hashCode); hash = JenkinsSmiHash.combine(hash, range.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -/// Color provider options. -class ColorProviderOptions implements ToJsonable { - static const jsonHandler = LspJsonHandler( - ColorProviderOptions.canParse, ColorProviderOptions.fromJson); - - static ColorProviderOptions fromJson(Map json) { - return ColorProviderOptions(); - } - - Map toJson() { - var __result = {}; - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - return true; - } else { - reporter.reportError('must be of type ColorProviderOptions'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is ColorProviderOptions && - other.runtimeType == ColorProviderOptions) { - return true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); + hash = JenkinsSmiHash.combine(hash, partialResultToken.hashCode); return JenkinsSmiHash.finish(hash); } @@ -2012,6 +2898,481 @@ class Command implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } +class CompletionClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + CompletionClientCapabilities.canParse, + CompletionClientCapabilities.fromJson); + + CompletionClientCapabilities(this.dynamicRegistration, this.completionItem, + this.completionItemKind, this.contextSupport); + static CompletionClientCapabilities fromJson(Map json) { + final dynamicRegistration = json['dynamicRegistration']; + final completionItem = json['completionItem'] != null + ? CompletionClientCapabilitiesCompletionItem.fromJson( + json['completionItem']) + : null; + final completionItemKind = json['completionItemKind'] != null + ? CompletionClientCapabilitiesCompletionItemKind.fromJson( + json['completionItemKind']) + : null; + final contextSupport = json['contextSupport']; + return CompletionClientCapabilities(dynamicRegistration, completionItem, + completionItemKind, contextSupport); + } + + /// The client supports the following `CompletionItem` specific capabilities. + final CompletionClientCapabilitiesCompletionItem completionItem; + final CompletionClientCapabilitiesCompletionItemKind completionItemKind; + + /// The client supports to send additional context information for a + /// `textDocument/completion` request. + final bool contextSupport; + + /// Whether completion supports dynamic registration. + final bool dynamicRegistration; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + if (completionItem != null) { + __result['completionItem'] = completionItem; + } + if (completionItemKind != null) { + __result['completionItemKind'] = completionItemKind; + } + if (contextSupport != null) { + __result['contextSupport'] = contextSupport; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('completionItem'); + try { + if (obj['completionItem'] != null && + !(CompletionClientCapabilitiesCompletionItem.canParse( + obj['completionItem'], reporter))) { + reporter.reportError( + 'must be of type CompletionClientCapabilitiesCompletionItem'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('completionItemKind'); + try { + if (obj['completionItemKind'] != null && + !(CompletionClientCapabilitiesCompletionItemKind.canParse( + obj['completionItemKind'], reporter))) { + reporter.reportError( + 'must be of type CompletionClientCapabilitiesCompletionItemKind'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('contextSupport'); + try { + if (obj['contextSupport'] != null && !(obj['contextSupport'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type CompletionClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is CompletionClientCapabilities && + other.runtimeType == CompletionClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && + completionItem == other.completionItem && + completionItemKind == other.completionItemKind && + contextSupport == other.contextSupport && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + hash = JenkinsSmiHash.combine(hash, completionItem.hashCode); + hash = JenkinsSmiHash.combine(hash, completionItemKind.hashCode); + hash = JenkinsSmiHash.combine(hash, contextSupport.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class CompletionClientCapabilitiesCompletionItem implements ToJsonable { + static const jsonHandler = LspJsonHandler( + CompletionClientCapabilitiesCompletionItem.canParse, + CompletionClientCapabilitiesCompletionItem.fromJson); + + CompletionClientCapabilitiesCompletionItem( + this.snippetSupport, + this.commitCharactersSupport, + this.documentationFormat, + this.deprecatedSupport, + this.preselectSupport, + this.tagSupport); + static CompletionClientCapabilitiesCompletionItem fromJson( + Map json) { + final snippetSupport = json['snippetSupport']; + final commitCharactersSupport = json['commitCharactersSupport']; + final documentationFormat = json['documentationFormat'] + ?.map((item) => item != null ? MarkupKind.fromJson(item) : null) + ?.cast() + ?.toList(); + final deprecatedSupport = json['deprecatedSupport']; + final preselectSupport = json['preselectSupport']; + final tagSupport = json['tagSupport'] != null + ? CompletionClientCapabilitiesTagSupport.fromJson(json['tagSupport']) + : null; + return CompletionClientCapabilitiesCompletionItem( + snippetSupport, + commitCharactersSupport, + documentationFormat, + deprecatedSupport, + preselectSupport, + tagSupport); + } + + /// Client supports commit characters on a completion item. + final bool commitCharactersSupport; + + /// Client supports the deprecated property on a completion item. + final bool deprecatedSupport; + + /// Client supports the follow content formats for the documentation property. + /// The order describes the preferred format of the client. + final List documentationFormat; + + /// Client supports the preselect property on a completion item. + final bool preselectSupport; + + /// Client supports snippets as insert text. + /// + /// A snippet can define tab stops and placeholders with `$1`, `$2` and + /// `${3:foo}`. `$0` defines the final tab stop, it defaults to the end of the + /// snippet. Placeholders with equal identifiers are linked, that is typing in + /// one will update others too. + final bool snippetSupport; + + /// Client supports the tag property on a completion item. Clients supporting + /// tags have to handle unknown tags gracefully. Clients especially need to + /// preserve unknown tags when sending a completion item back to the server in + /// a resolve call. + /// @since 3.15.0 + final CompletionClientCapabilitiesTagSupport tagSupport; + + Map toJson() { + var __result = {}; + if (snippetSupport != null) { + __result['snippetSupport'] = snippetSupport; + } + if (commitCharactersSupport != null) { + __result['commitCharactersSupport'] = commitCharactersSupport; + } + if (documentationFormat != null) { + __result['documentationFormat'] = documentationFormat; + } + if (deprecatedSupport != null) { + __result['deprecatedSupport'] = deprecatedSupport; + } + if (preselectSupport != null) { + __result['preselectSupport'] = preselectSupport; + } + if (tagSupport != null) { + __result['tagSupport'] = tagSupport; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('snippetSupport'); + try { + if (obj['snippetSupport'] != null && !(obj['snippetSupport'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('commitCharactersSupport'); + try { + if (obj['commitCharactersSupport'] != null && + !(obj['commitCharactersSupport'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('documentationFormat'); + try { + if (obj['documentationFormat'] != null && + !((obj['documentationFormat'] is List && + (obj['documentationFormat'] + .every((item) => MarkupKind.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('deprecatedSupport'); + try { + if (obj['deprecatedSupport'] != null && + !(obj['deprecatedSupport'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('preselectSupport'); + try { + if (obj['preselectSupport'] != null && + !(obj['preselectSupport'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('tagSupport'); + try { + if (obj['tagSupport'] != null && + !(CompletionClientCapabilitiesTagSupport.canParse( + obj['tagSupport'], reporter))) { + reporter.reportError( + 'must be of type CompletionClientCapabilitiesTagSupport'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError( + 'must be of type CompletionClientCapabilitiesCompletionItem'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is CompletionClientCapabilitiesCompletionItem && + other.runtimeType == CompletionClientCapabilitiesCompletionItem) { + return snippetSupport == other.snippetSupport && + commitCharactersSupport == other.commitCharactersSupport && + listEqual(documentationFormat, other.documentationFormat, + (MarkupKind a, MarkupKind b) => a == b) && + deprecatedSupport == other.deprecatedSupport && + preselectSupport == other.preselectSupport && + tagSupport == other.tagSupport && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, snippetSupport.hashCode); + hash = JenkinsSmiHash.combine(hash, commitCharactersSupport.hashCode); + hash = JenkinsSmiHash.combine(hash, lspHashCode(documentationFormat)); + hash = JenkinsSmiHash.combine(hash, deprecatedSupport.hashCode); + hash = JenkinsSmiHash.combine(hash, preselectSupport.hashCode); + hash = JenkinsSmiHash.combine(hash, tagSupport.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class CompletionClientCapabilitiesCompletionItemKind implements ToJsonable { + static const jsonHandler = LspJsonHandler( + CompletionClientCapabilitiesCompletionItemKind.canParse, + CompletionClientCapabilitiesCompletionItemKind.fromJson); + + CompletionClientCapabilitiesCompletionItemKind(this.valueSet); + static CompletionClientCapabilitiesCompletionItemKind fromJson( + Map json) { + final valueSet = json['valueSet'] + ?.map((item) => item != null ? CompletionItemKind.fromJson(item) : null) + ?.cast() + ?.toList(); + return CompletionClientCapabilitiesCompletionItemKind(valueSet); + } + + /// The completion item kind values the client supports. When this property + /// exists the client also guarantees that it will handle values outside its + /// set gracefully and falls back to a default value when unknown. + /// + /// If this property is not present the client only supports the completion + /// items kinds from `Text` to `Reference` as defined in the initial version + /// of the protocol. + final List valueSet; + + Map toJson() { + var __result = {}; + if (valueSet != null) { + __result['valueSet'] = valueSet; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('valueSet'); + try { + if (obj['valueSet'] != null && + !((obj['valueSet'] is List && + (obj['valueSet'].every( + (item) => CompletionItemKind.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError( + 'must be of type CompletionClientCapabilitiesCompletionItemKind'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is CompletionClientCapabilitiesCompletionItemKind && + other.runtimeType == CompletionClientCapabilitiesCompletionItemKind) { + return listEqual(valueSet, other.valueSet, + (CompletionItemKind a, CompletionItemKind b) => a == b) && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, lspHashCode(valueSet)); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class CompletionClientCapabilitiesTagSupport implements ToJsonable { + static const jsonHandler = LspJsonHandler( + CompletionClientCapabilitiesTagSupport.canParse, + CompletionClientCapabilitiesTagSupport.fromJson); + + CompletionClientCapabilitiesTagSupport(this.valueSet) { + if (valueSet == null) { + throw 'valueSet is required but was not provided'; + } + } + static CompletionClientCapabilitiesTagSupport fromJson( + Map json) { + final valueSet = json['valueSet'] + ?.map((item) => item != null ? CompletionItemTag.fromJson(item) : null) + ?.cast() + ?.toList(); + return CompletionClientCapabilitiesTagSupport(valueSet); + } + + /// The tags supported by the client. + final List valueSet; + + Map toJson() { + var __result = {}; + __result['valueSet'] = + valueSet ?? (throw 'valueSet is required but was not set'); + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('valueSet'); + try { + if (!obj.containsKey('valueSet')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['valueSet'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!((obj['valueSet'] is List && + (obj['valueSet'].every( + (item) => CompletionItemTag.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError( + 'must be of type CompletionClientCapabilitiesTagSupport'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is CompletionClientCapabilitiesTagSupport && + other.runtimeType == CompletionClientCapabilitiesTagSupport) { + return listEqual(valueSet, other.valueSet, + (CompletionItemTag a, CompletionItemTag b) => a == b) && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, lspHashCode(valueSet)); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + /// Contains additional information about the context in which a completion /// request is triggered. class CompletionContext implements ToJsonable { @@ -2113,6 +3474,7 @@ class CompletionItem implements ToJsonable { CompletionItem( this.label, this.kind, + this.tags, this.detail, this.documentation, this.deprecated, @@ -2134,6 +3496,10 @@ class CompletionItem implements ToJsonable { final label = json['label']; final kind = json['kind'] != null ? CompletionItemKind.fromJson(json['kind']) : null; + final tags = json['tags'] + ?.map((item) => item != null ? CompletionItemTag.fromJson(item) : null) + ?.cast() + ?.toList(); final detail = json['detail']; final documentation = json['documentation'] is String ? Either2.t1(json['documentation']) @@ -2168,6 +3534,7 @@ class CompletionItem implements ToJsonable { return CompletionItem( label, kind, + tags, detail, documentation, deprecated, @@ -2208,6 +3575,8 @@ class CompletionItem implements ToJsonable { final CompletionItemResolutionInfo data; /// Indicates if this item is deprecated. + /// @deprecated Use `tags` instead if supported. + @core.deprecated final bool deprecated; /// A human-readable string with additional information about this item, like @@ -2233,7 +3602,7 @@ class CompletionItem implements ToJsonable { final String insertText; /// The format of the insert text. The format applies to both the `insertText` - /// property and the `newText` property of a provided `textEdit`. If ommitted + /// property and the `newText` property of a provided `textEdit`. If omitted /// defaults to `InsertTextFormat.PlainText`. final InsertTextFormat insertTextFormat; @@ -2257,6 +3626,10 @@ class CompletionItem implements ToJsonable { /// When `falsy` the label is used. final String sortText; + /// Tags for this completion item. + /// @since 3.15.0 + final List tags; + /// An edit which is applied to a document when selecting this completion. /// When an edit is provided the value of `insertText` is ignored. /// @@ -2270,6 +3643,9 @@ class CompletionItem implements ToJsonable { if (kind != null) { __result['kind'] = kind; } + if (tags != null) { + __result['tags'] = tags; + } if (detail != null) { __result['detail'] = detail; } @@ -2341,6 +3717,18 @@ class CompletionItem implements ToJsonable { } finally { reporter.pop(); } + reporter.push('tags'); + try { + if (obj['tags'] != null && + !((obj['tags'] is List && + (obj['tags'].every( + (item) => CompletionItemTag.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } reporter.push('detail'); try { if (obj['detail'] != null && !(obj['detail'] is String)) { @@ -2482,6 +3870,8 @@ class CompletionItem implements ToJsonable { if (other is CompletionItem && other.runtimeType == CompletionItem) { return label == other.label && kind == other.kind && + listEqual(tags, other.tags, + (CompletionItemTag a, CompletionItemTag b) => a == b) && detail == other.detail && documentation == other.documentation && deprecated == other.deprecated && @@ -2507,6 +3897,7 @@ class CompletionItem implements ToJsonable { var hash = 0; hash = JenkinsSmiHash.combine(hash, label.hashCode); hash = JenkinsSmiHash.combine(hash, kind.hashCode); + hash = JenkinsSmiHash.combine(hash, lspHashCode(tags)); hash = JenkinsSmiHash.combine(hash, detail.hashCode); hash = JenkinsSmiHash.combine(hash, documentation.hashCode); hash = JenkinsSmiHash.combine(hash, deprecated.hashCode); @@ -2575,6 +3966,33 @@ class CompletionItemKind { bool operator ==(Object o) => o is CompletionItemKind && o._value == _value; } +/// Completion item tags are extra annotations that tweak the rendering of a +/// completion item. +/// @since 3.15.0 +class CompletionItemTag { + const CompletionItemTag(this._value); + const CompletionItemTag.fromJson(this._value); + + final num _value; + + static bool canParse(Object obj, LspJsonReporter reporter) { + return obj is num; + } + + /// Render a completion as obsolete, usually using a strike-out. + static const Deprecated = CompletionItemTag(1); + + Object toJson() => _value; + + @override + String toString() => _value.toString(); + + @override + int get hashCode => _value.hashCode; + + bool operator ==(Object o) => o is CompletionItemTag && o._value == _value; +} + /// Represents a collection of completion items ([CompletionItem]) to be /// presented in the editor. class CompletionList implements ToJsonable { @@ -2682,40 +4100,99 @@ class CompletionList implements ToJsonable { } /// Completion options. -class CompletionOptions implements ToJsonable { +class CompletionOptions implements WorkDoneProgressOptions, ToJsonable { static const jsonHandler = LspJsonHandler(CompletionOptions.canParse, CompletionOptions.fromJson); - CompletionOptions(this.resolveProvider, this.triggerCharacters); + CompletionOptions(this.triggerCharacters, this.allCommitCharacters, + this.resolveProvider, this.workDoneProgress); static CompletionOptions fromJson(Map json) { - final resolveProvider = json['resolveProvider']; + if (CompletionRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return CompletionRegistrationOptions.fromJson(json); + } final triggerCharacters = json['triggerCharacters'] ?.map((item) => item) ?.cast() ?.toList(); - return CompletionOptions(resolveProvider, triggerCharacters); + final allCommitCharacters = json['allCommitCharacters'] + ?.map((item) => item) + ?.cast() + ?.toList(); + final resolveProvider = json['resolveProvider']; + final workDoneProgress = json['workDoneProgress']; + return CompletionOptions(triggerCharacters, allCommitCharacters, + resolveProvider, workDoneProgress); } + /// The list of all possible characters that commit a completion. This field + /// can be used if clients don't support individual commit characters per + /// completion item. See + /// `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport`. + /// + /// If a server provides both `allCommitCharacters` and commit characters on + /// an individual completion item the ones on the completion item win. + /// @since 3.2.0 + final List allCommitCharacters; + /// The server provides support to resolve additional information for a /// completion item. final bool resolveProvider; - /// The characters that trigger completion automatically. + /// Most tools trigger completion request automatically without explicitly + /// requesting it using a keyboard shortcut (e.g. Ctrl+Space). Typically they + /// do so when the user starts to type an identifier. For example if the user + /// types `c` in a JavaScript file code complete will automatically pop up + /// present `console` besides others as a completion item. Characters that + /// make up identifiers don't need to be listed here. + /// + /// If code complete should automatically be trigger on characters not being + /// valid inside an identifier (for example `.` in JavaScript) list them in + /// `triggerCharacters`. final List triggerCharacters; + final bool workDoneProgress; Map toJson() { var __result = {}; + if (triggerCharacters != null) { + __result['triggerCharacters'] = triggerCharacters; + } + if (allCommitCharacters != null) { + __result['allCommitCharacters'] = allCommitCharacters; + } if (resolveProvider != null) { __result['resolveProvider'] = resolveProvider; } - if (triggerCharacters != null) { - __result['triggerCharacters'] = triggerCharacters; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; } return __result; } static bool canParse(Object obj, LspJsonReporter reporter) { if (obj is Map) { + reporter.push('triggerCharacters'); + try { + if (obj['triggerCharacters'] != null && + !((obj['triggerCharacters'] is List && + (obj['triggerCharacters'].every((item) => item is String))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('allCommitCharacters'); + try { + if (obj['allCommitCharacters'] != null && + !((obj['allCommitCharacters'] is List && + (obj['allCommitCharacters'] + .every((item) => item is String))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } reporter.push('resolveProvider'); try { if (obj['resolveProvider'] != null && @@ -2726,12 +4203,11 @@ class CompletionOptions implements ToJsonable { } finally { reporter.pop(); } - reporter.push('triggerCharacters'); + reporter.push('workDoneProgress'); try { - if (obj['triggerCharacters'] != null && - !((obj['triggerCharacters'] is List && - (obj['triggerCharacters'].every((item) => item is String))))) { - reporter.reportError('must be of type List'); + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); return false; } } finally { @@ -2747,9 +4223,12 @@ class CompletionOptions implements ToJsonable { @override bool operator ==(Object other) { if (other is CompletionOptions && other.runtimeType == CompletionOptions) { - return resolveProvider == other.resolveProvider && - listEqual(triggerCharacters, other.triggerCharacters, + return listEqual(triggerCharacters, other.triggerCharacters, (String a, String b) => a == b) && + listEqual(allCommitCharacters, other.allCommitCharacters, + (String a, String b) => a == b) && + resolveProvider == other.resolveProvider && + workDoneProgress == other.workDoneProgress && true; } return false; @@ -2758,8 +4237,10 @@ class CompletionOptions implements ToJsonable { @override int get hashCode { var hash = 0; - hash = JenkinsSmiHash.combine(hash, resolveProvider.hashCode); hash = JenkinsSmiHash.combine(hash, lspHashCode(triggerCharacters)); + hash = JenkinsSmiHash.combine(hash, lspHashCode(allCommitCharacters)); + hash = JenkinsSmiHash.combine(hash, resolveProvider.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); return JenkinsSmiHash.finish(hash); } @@ -2767,11 +4248,17 @@ class CompletionOptions implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -class CompletionParams implements TextDocumentPositionParams, ToJsonable { +class CompletionParams + implements + TextDocumentPositionParams, + WorkDoneProgressParams, + PartialResultParams, + ToJsonable { static const jsonHandler = LspJsonHandler(CompletionParams.canParse, CompletionParams.fromJson); - CompletionParams(this.context, this.textDocument, this.position) { + CompletionParams(this.context, this.textDocument, this.position, + this.workDoneToken, this.partialResultToken) { if (textDocument == null) { throw 'textDocument is required but was not provided'; } @@ -2788,7 +4275,22 @@ class CompletionParams implements TextDocumentPositionParams, ToJsonable { : null; final position = json['position'] != null ? Position.fromJson(json['position']) : null; - return CompletionParams(context, textDocument, position); + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + final partialResultToken = json['partialResultToken'] is num + ? Either2.t1(json['partialResultToken']) + : (json['partialResultToken'] is String + ? Either2.t2(json['partialResultToken']) + : (json['partialResultToken'] == null + ? null + : (throw '''${json['partialResultToken']} was not one of (num, String)'''))); + return CompletionParams( + context, textDocument, position, workDoneToken, partialResultToken); } /// The completion context. This is only available if the client specifies to @@ -2796,12 +4298,19 @@ class CompletionParams implements TextDocumentPositionParams, ToJsonable { /// === true` final CompletionContext context; + /// An optional token that a server can use to report partial results (e.g. + /// streaming) to the client. + final Either2 partialResultToken; + /// The position inside the text document. final Position position; /// The text document. final TextDocumentIdentifier textDocument; + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + Map toJson() { var __result = {}; if (context != null) { @@ -2811,6 +4320,12 @@ class CompletionParams implements TextDocumentPositionParams, ToJsonable { textDocument ?? (throw 'textDocument is required but was not set'); __result['position'] = position ?? (throw 'position is required but was not set'); + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } + if (partialResultToken != null) { + __result['partialResultToken'] = partialResultToken; + } return __result; } @@ -2860,6 +4375,28 @@ class CompletionParams implements TextDocumentPositionParams, ToJsonable { } finally { reporter.pop(); } + reporter.push('workDoneToken'); + try { + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('partialResultToken'); + try { + if (obj['partialResultToken'] != null && + !((obj['partialResultToken'] is num || + obj['partialResultToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type CompletionParams'); @@ -2873,6 +4410,8 @@ class CompletionParams implements TextDocumentPositionParams, ToJsonable { return context == other.context && textDocument == other.textDocument && position == other.position && + workDoneToken == other.workDoneToken && + partialResultToken == other.partialResultToken && true; } return false; @@ -2884,6 +4423,8 @@ class CompletionParams implements TextDocumentPositionParams, ToJsonable { hash = JenkinsSmiHash.combine(hash, context.hashCode); hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); hash = JenkinsSmiHash.combine(hash, position.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); + hash = JenkinsSmiHash.combine(hash, partialResultToken.hashCode); return JenkinsSmiHash.finish(hash); } @@ -2892,14 +4433,18 @@ class CompletionParams implements TextDocumentPositionParams, ToJsonable { } class CompletionRegistrationOptions - implements TextDocumentRegistrationOptions, ToJsonable { + implements TextDocumentRegistrationOptions, CompletionOptions, ToJsonable { static const jsonHandler = LspJsonHandler( CompletionRegistrationOptions.canParse, CompletionRegistrationOptions.fromJson); - CompletionRegistrationOptions(this.triggerCharacters, - this.allCommitCharacters, this.resolveProvider, this.documentSelector); + CompletionRegistrationOptions(this.documentSelector, this.triggerCharacters, + this.allCommitCharacters, this.resolveProvider, this.workDoneProgress); static CompletionRegistrationOptions fromJson(Map json) { + final documentSelector = json['documentSelector'] + ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) + ?.cast() + ?.toList(); final triggerCharacters = json['triggerCharacters'] ?.map((item) => item) ?.cast() @@ -2909,23 +4454,19 @@ class CompletionRegistrationOptions ?.cast() ?.toList(); final resolveProvider = json['resolveProvider']; - final documentSelector = json['documentSelector'] - ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) - ?.cast() - ?.toList(); - return CompletionRegistrationOptions(triggerCharacters, allCommitCharacters, - resolveProvider, documentSelector); + final workDoneProgress = json['workDoneProgress']; + return CompletionRegistrationOptions(documentSelector, triggerCharacters, + allCommitCharacters, resolveProvider, workDoneProgress); } /// The list of all possible characters that commit a completion. This field - /// can be used if clients don't support individual commmit characters per + /// can be used if clients don't support individual commit characters per /// completion item. See /// `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport`. /// /// If a server provides both `allCommitCharacters` and commit characters on /// an individual completion item the ones on the completion item win. - /// - /// Since 3.2.0 + /// @since 3.2.0 final List allCommitCharacters; /// A document selector to identify the scope of the registration. If set to @@ -2947,9 +4488,11 @@ class CompletionRegistrationOptions /// valid inside an identifier (for example `.` in JavaScript) list them in /// `triggerCharacters`. final List triggerCharacters; + final bool workDoneProgress; Map toJson() { var __result = {}; + __result['documentSelector'] = documentSelector; if (triggerCharacters != null) { __result['triggerCharacters'] = triggerCharacters; } @@ -2959,12 +4502,30 @@ class CompletionRegistrationOptions if (resolveProvider != null) { __result['resolveProvider'] = resolveProvider; } - __result['documentSelector'] = documentSelector; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } return __result; } static bool canParse(Object obj, LspJsonReporter reporter) { if (obj is Map) { + reporter.push('documentSelector'); + try { + if (!obj.containsKey('documentSelector')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['documentSelector'] != null && + !((obj['documentSelector'] is List && + (obj['documentSelector'].every( + (item) => DocumentFilter.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } reporter.push('triggerCharacters'); try { if (obj['triggerCharacters'] != null && @@ -2998,17 +4559,11 @@ class CompletionRegistrationOptions } finally { reporter.pop(); } - reporter.push('documentSelector'); + reporter.push('workDoneProgress'); try { - if (!obj.containsKey('documentSelector')) { - reporter.reportError('must not be undefined'); - return false; - } - if (obj['documentSelector'] != null && - !((obj['documentSelector'] is List && - (obj['documentSelector'].every( - (item) => DocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); return false; } } finally { @@ -3025,13 +4580,14 @@ class CompletionRegistrationOptions bool operator ==(Object other) { if (other is CompletionRegistrationOptions && other.runtimeType == CompletionRegistrationOptions) { - return listEqual(triggerCharacters, other.triggerCharacters, + return listEqual(documentSelector, other.documentSelector, + (DocumentFilter a, DocumentFilter b) => a == b) && + listEqual(triggerCharacters, other.triggerCharacters, (String a, String b) => a == b) && listEqual(allCommitCharacters, other.allCommitCharacters, (String a, String b) => a == b) && resolveProvider == other.resolveProvider && - listEqual(documentSelector, other.documentSelector, - (DocumentFilter a, DocumentFilter b) => a == b) && + workDoneProgress == other.workDoneProgress && true; } return false; @@ -3040,10 +4596,11 @@ class CompletionRegistrationOptions @override int get hashCode { var hash = 0; + hash = JenkinsSmiHash.combine(hash, lspHashCode(documentSelector)); hash = JenkinsSmiHash.combine(hash, lspHashCode(triggerCharacters)); hash = JenkinsSmiHash.combine(hash, lspHashCode(allCommitCharacters)); hash = JenkinsSmiHash.combine(hash, resolveProvider.hashCode); - hash = JenkinsSmiHash.combine(hash, lspHashCode(documentSelector)); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); return JenkinsSmiHash.finish(hash); } @@ -3437,6 +4994,817 @@ class CreateFileOptions implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } +class DeclarationClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + DeclarationClientCapabilities.canParse, + DeclarationClientCapabilities.fromJson); + + DeclarationClientCapabilities(this.dynamicRegistration, this.linkSupport); + static DeclarationClientCapabilities fromJson(Map json) { + final dynamicRegistration = json['dynamicRegistration']; + final linkSupport = json['linkSupport']; + return DeclarationClientCapabilities(dynamicRegistration, linkSupport); + } + + /// Whether declaration supports dynamic registration. If this is set to + /// `true` the client supports the new `DeclarationRegistrationOptions` return + /// value for the corresponding server capability as well. + final bool dynamicRegistration; + + /// The client supports additional metadata in the form of declaration links. + final bool linkSupport; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + if (linkSupport != null) { + __result['linkSupport'] = linkSupport; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('linkSupport'); + try { + if (obj['linkSupport'] != null && !(obj['linkSupport'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type DeclarationClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DeclarationClientCapabilities && + other.runtimeType == DeclarationClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && + linkSupport == other.linkSupport && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + hash = JenkinsSmiHash.combine(hash, linkSupport.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DeclarationOptions implements WorkDoneProgressOptions, ToJsonable { + static const jsonHandler = + LspJsonHandler(DeclarationOptions.canParse, DeclarationOptions.fromJson); + + DeclarationOptions(this.workDoneProgress); + static DeclarationOptions fromJson(Map json) { + if (DeclarationRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return DeclarationRegistrationOptions.fromJson(json); + } + final workDoneProgress = json['workDoneProgress']; + return DeclarationOptions(workDoneProgress); + } + + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type DeclarationOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DeclarationOptions && + other.runtimeType == DeclarationOptions) { + return workDoneProgress == other.workDoneProgress && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DeclarationParams + implements + TextDocumentPositionParams, + WorkDoneProgressParams, + PartialResultParams, + ToJsonable { + static const jsonHandler = + LspJsonHandler(DeclarationParams.canParse, DeclarationParams.fromJson); + + DeclarationParams(this.textDocument, this.position, this.workDoneToken, + this.partialResultToken) { + if (textDocument == null) { + throw 'textDocument is required but was not provided'; + } + if (position == null) { + throw 'position is required but was not provided'; + } + } + static DeclarationParams fromJson(Map json) { + final textDocument = json['textDocument'] != null + ? TextDocumentIdentifier.fromJson(json['textDocument']) + : null; + final position = + json['position'] != null ? Position.fromJson(json['position']) : null; + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + final partialResultToken = json['partialResultToken'] is num + ? Either2.t1(json['partialResultToken']) + : (json['partialResultToken'] is String + ? Either2.t2(json['partialResultToken']) + : (json['partialResultToken'] == null + ? null + : (throw '''${json['partialResultToken']} was not one of (num, String)'''))); + return DeclarationParams( + textDocument, position, workDoneToken, partialResultToken); + } + + /// An optional token that a server can use to report partial results (e.g. + /// streaming) to the client. + final Either2 partialResultToken; + + /// The position inside the text document. + final Position position; + + /// The text document. + final TextDocumentIdentifier textDocument; + + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + + Map toJson() { + var __result = {}; + __result['textDocument'] = + textDocument ?? (throw 'textDocument is required but was not set'); + __result['position'] = + position ?? (throw 'position is required but was not set'); + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } + if (partialResultToken != null) { + __result['partialResultToken'] = partialResultToken; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('textDocument'); + try { + if (!obj.containsKey('textDocument')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['textDocument'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) { + reporter.reportError('must be of type TextDocumentIdentifier'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('position'); + try { + if (!obj.containsKey('position')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['position'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(Position.canParse(obj['position'], reporter))) { + reporter.reportError('must be of type Position'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneToken'); + try { + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('partialResultToken'); + try { + if (obj['partialResultToken'] != null && + !((obj['partialResultToken'] is num || + obj['partialResultToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type DeclarationParams'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DeclarationParams && other.runtimeType == DeclarationParams) { + return textDocument == other.textDocument && + position == other.position && + workDoneToken == other.workDoneToken && + partialResultToken == other.partialResultToken && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); + hash = JenkinsSmiHash.combine(hash, position.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); + hash = JenkinsSmiHash.combine(hash, partialResultToken.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DeclarationRegistrationOptions + implements + DeclarationOptions, + TextDocumentRegistrationOptions, + StaticRegistrationOptions, + ToJsonable { + static const jsonHandler = LspJsonHandler( + DeclarationRegistrationOptions.canParse, + DeclarationRegistrationOptions.fromJson); + + DeclarationRegistrationOptions( + this.workDoneProgress, this.documentSelector, this.id); + static DeclarationRegistrationOptions fromJson(Map json) { + final workDoneProgress = json['workDoneProgress']; + final documentSelector = json['documentSelector'] + ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) + ?.cast() + ?.toList(); + final id = json['id']; + return DeclarationRegistrationOptions( + workDoneProgress, documentSelector, id); + } + + /// 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. + final List documentSelector; + + /// The id used to register the request. The id can be used to deregister the + /// request again. See also Registration#id. + final String id; + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + __result['documentSelector'] = documentSelector; + if (id != null) { + __result['id'] = id; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('documentSelector'); + try { + if (!obj.containsKey('documentSelector')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['documentSelector'] != null && + !((obj['documentSelector'] is List && + (obj['documentSelector'].every( + (item) => DocumentFilter.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('id'); + try { + if (obj['id'] != null && !(obj['id'] is String)) { + reporter.reportError('must be of type String'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type DeclarationRegistrationOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DeclarationRegistrationOptions && + other.runtimeType == DeclarationRegistrationOptions) { + return workDoneProgress == other.workDoneProgress && + listEqual(documentSelector, other.documentSelector, + (DocumentFilter a, DocumentFilter b) => a == b) && + id == other.id && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + hash = JenkinsSmiHash.combine(hash, lspHashCode(documentSelector)); + hash = JenkinsSmiHash.combine(hash, id.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DefinitionClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + DefinitionClientCapabilities.canParse, + DefinitionClientCapabilities.fromJson); + + DefinitionClientCapabilities(this.dynamicRegistration, this.linkSupport); + static DefinitionClientCapabilities fromJson(Map json) { + final dynamicRegistration = json['dynamicRegistration']; + final linkSupport = json['linkSupport']; + return DefinitionClientCapabilities(dynamicRegistration, linkSupport); + } + + /// Whether definition supports dynamic registration. + final bool dynamicRegistration; + + /// The client supports additional metadata in the form of definition links. + /// @since 3.14.0 + final bool linkSupport; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + if (linkSupport != null) { + __result['linkSupport'] = linkSupport; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('linkSupport'); + try { + if (obj['linkSupport'] != null && !(obj['linkSupport'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type DefinitionClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DefinitionClientCapabilities && + other.runtimeType == DefinitionClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && + linkSupport == other.linkSupport && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + hash = JenkinsSmiHash.combine(hash, linkSupport.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DefinitionOptions implements WorkDoneProgressOptions, ToJsonable { + static const jsonHandler = + LspJsonHandler(DefinitionOptions.canParse, DefinitionOptions.fromJson); + + DefinitionOptions(this.workDoneProgress); + static DefinitionOptions fromJson(Map json) { + if (DefinitionRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return DefinitionRegistrationOptions.fromJson(json); + } + final workDoneProgress = json['workDoneProgress']; + return DefinitionOptions(workDoneProgress); + } + + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type DefinitionOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DefinitionOptions && other.runtimeType == DefinitionOptions) { + return workDoneProgress == other.workDoneProgress && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DefinitionParams + implements + TextDocumentPositionParams, + WorkDoneProgressParams, + PartialResultParams, + ToJsonable { + static const jsonHandler = + LspJsonHandler(DefinitionParams.canParse, DefinitionParams.fromJson); + + DefinitionParams(this.textDocument, this.position, this.workDoneToken, + this.partialResultToken) { + if (textDocument == null) { + throw 'textDocument is required but was not provided'; + } + if (position == null) { + throw 'position is required but was not provided'; + } + } + static DefinitionParams fromJson(Map json) { + final textDocument = json['textDocument'] != null + ? TextDocumentIdentifier.fromJson(json['textDocument']) + : null; + final position = + json['position'] != null ? Position.fromJson(json['position']) : null; + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + final partialResultToken = json['partialResultToken'] is num + ? Either2.t1(json['partialResultToken']) + : (json['partialResultToken'] is String + ? Either2.t2(json['partialResultToken']) + : (json['partialResultToken'] == null + ? null + : (throw '''${json['partialResultToken']} was not one of (num, String)'''))); + return DefinitionParams( + textDocument, position, workDoneToken, partialResultToken); + } + + /// An optional token that a server can use to report partial results (e.g. + /// streaming) to the client. + final Either2 partialResultToken; + + /// The position inside the text document. + final Position position; + + /// The text document. + final TextDocumentIdentifier textDocument; + + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + + Map toJson() { + var __result = {}; + __result['textDocument'] = + textDocument ?? (throw 'textDocument is required but was not set'); + __result['position'] = + position ?? (throw 'position is required but was not set'); + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } + if (partialResultToken != null) { + __result['partialResultToken'] = partialResultToken; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('textDocument'); + try { + if (!obj.containsKey('textDocument')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['textDocument'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) { + reporter.reportError('must be of type TextDocumentIdentifier'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('position'); + try { + if (!obj.containsKey('position')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['position'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(Position.canParse(obj['position'], reporter))) { + reporter.reportError('must be of type Position'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneToken'); + try { + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('partialResultToken'); + try { + if (obj['partialResultToken'] != null && + !((obj['partialResultToken'] is num || + obj['partialResultToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type DefinitionParams'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DefinitionParams && other.runtimeType == DefinitionParams) { + return textDocument == other.textDocument && + position == other.position && + workDoneToken == other.workDoneToken && + partialResultToken == other.partialResultToken && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); + hash = JenkinsSmiHash.combine(hash, position.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); + hash = JenkinsSmiHash.combine(hash, partialResultToken.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DefinitionRegistrationOptions + implements TextDocumentRegistrationOptions, DefinitionOptions, ToJsonable { + static const jsonHandler = LspJsonHandler( + DefinitionRegistrationOptions.canParse, + DefinitionRegistrationOptions.fromJson); + + DefinitionRegistrationOptions(this.documentSelector, this.workDoneProgress); + static DefinitionRegistrationOptions fromJson(Map json) { + final documentSelector = json['documentSelector'] + ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) + ?.cast() + ?.toList(); + final workDoneProgress = json['workDoneProgress']; + return DefinitionRegistrationOptions(documentSelector, workDoneProgress); + } + + /// 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. + final List documentSelector; + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + __result['documentSelector'] = documentSelector; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('documentSelector'); + try { + if (!obj.containsKey('documentSelector')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['documentSelector'] != null && + !((obj['documentSelector'] is List && + (obj['documentSelector'].every( + (item) => DocumentFilter.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type DefinitionRegistrationOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DefinitionRegistrationOptions && + other.runtimeType == DefinitionRegistrationOptions) { + return listEqual(documentSelector, other.documentSelector, + (DocumentFilter a, DocumentFilter b) => a == b) && + workDoneProgress == other.workDoneProgress && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, lspHashCode(documentSelector)); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + /// Delete file operation class DeleteFile implements ToJsonable { static const jsonHandler = @@ -3639,7 +6007,7 @@ class Diagnostic implements ToJsonable { LspJsonHandler(Diagnostic.canParse, Diagnostic.fromJson); Diagnostic(this.range, this.severity, this.code, this.source, this.message, - this.relatedInformation) { + this.tags, this.relatedInformation) { if (range == null) { throw 'range is required but was not provided'; } @@ -3655,13 +6023,17 @@ class Diagnostic implements ToJsonable { final code = json['code']; final source = json['source']; final message = json['message']; + final tags = json['tags'] + ?.map((item) => item != null ? DiagnosticTag.fromJson(item) : null) + ?.cast() + ?.toList(); final relatedInformation = json['relatedInformation'] ?.map((item) => item != null ? DiagnosticRelatedInformation.fromJson(item) : null) ?.cast() ?.toList(); return Diagnostic( - range, severity, code, source, message, relatedInformation); + range, severity, code, source, message, tags, relatedInformation); } /// The diagnostic's code, which might appear in the user interface. @@ -3685,6 +6057,10 @@ class Diagnostic implements ToJsonable { /// 'typescript' or 'super lint'. final String source; + /// Additional metadata about the diagnostic. + /// @since 3.15.0 + final List tags; + Map toJson() { var __result = {}; __result['range'] = range ?? (throw 'range is required but was not set'); @@ -3699,6 +6075,9 @@ class Diagnostic implements ToJsonable { } __result['message'] = message ?? (throw 'message is required but was not set'); + if (tags != null) { + __result['tags'] = tags; + } if (relatedInformation != null) { __result['relatedInformation'] = relatedInformation; } @@ -3769,6 +6148,18 @@ class Diagnostic implements ToJsonable { } finally { reporter.pop(); } + reporter.push('tags'); + try { + if (obj['tags'] != null && + !((obj['tags'] is List && + (obj['tags'].every( + (item) => DiagnosticTag.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } reporter.push('relatedInformation'); try { if (obj['relatedInformation'] != null && @@ -3797,6 +6188,8 @@ class Diagnostic implements ToJsonable { code == other.code && source == other.source && message == other.message && + listEqual( + tags, other.tags, (DiagnosticTag a, DiagnosticTag b) => a == b) && listEqual( relatedInformation, other.relatedInformation, @@ -3816,6 +6209,7 @@ class Diagnostic implements ToJsonable { hash = JenkinsSmiHash.combine(hash, code.hashCode); hash = JenkinsSmiHash.combine(hash, source.hashCode); hash = JenkinsSmiHash.combine(hash, message.hashCode); + hash = JenkinsSmiHash.combine(hash, lspHashCode(tags)); hash = JenkinsSmiHash.combine(hash, lspHashCode(relatedInformation)); return JenkinsSmiHash.finish(hash); } @@ -3825,7 +6219,7 @@ class Diagnostic implements ToJsonable { } /// Represents a related message and source code location for a diagnostic. This -/// should be used to point to code locations that cause or related to a +/// should be used to point to code locations that cause or are related to a /// diagnostics, e.g when duplicating a symbol in a scope. class DiagnosticRelatedInformation implements ToJsonable { static const jsonHandler = LspJsonHandler( @@ -3959,6 +6353,103 @@ class DiagnosticSeverity { bool operator ==(Object o) => o is DiagnosticSeverity && o._value == _value; } +/// The diagnostic tags. +/// @since 3.15.0 +class DiagnosticTag { + const DiagnosticTag(this._value); + const DiagnosticTag.fromJson(this._value); + + final num _value; + + static bool canParse(Object obj, LspJsonReporter reporter) { + return obj is num; + } + + /// Unused or unnecessary code. + /// + /// Clients are allowed to render diagnostics with this tag faded out instead + /// of having an error squiggle. + static const Unnecessary = DiagnosticTag(1); + + /// Deprecated or obsolete code. + /// + /// Clients are allowed to rendered diagnostics with this tag strike through. + static const Deprecated = DiagnosticTag(2); + + Object toJson() => _value; + + @override + String toString() => _value.toString(); + + @override + int get hashCode => _value.hashCode; + + bool operator ==(Object o) => o is DiagnosticTag && o._value == _value; +} + +class DidChangeConfigurationClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + DidChangeConfigurationClientCapabilities.canParse, + DidChangeConfigurationClientCapabilities.fromJson); + + DidChangeConfigurationClientCapabilities(this.dynamicRegistration); + static DidChangeConfigurationClientCapabilities fromJson( + Map json) { + final dynamicRegistration = json['dynamicRegistration']; + return DidChangeConfigurationClientCapabilities(dynamicRegistration); + } + + /// Did change configuration notification supports dynamic registration. + final bool dynamicRegistration; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError( + 'must be of type DidChangeConfigurationClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DidChangeConfigurationClientCapabilities && + other.runtimeType == DidChangeConfigurationClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + class DidChangeConfigurationParams implements ToJsonable { static const jsonHandler = LspJsonHandler( DidChangeConfigurationParams.canParse, @@ -4039,17 +6530,41 @@ class DidChangeTextDocumentParams implements ToJsonable { ? VersionedTextDocumentIdentifier.fromJson(json['textDocument']) : null; final contentChanges = json['contentChanges'] - ?.map((item) => - item != null ? TextDocumentContentChangeEvent.fromJson(item) : null) - ?.cast() + ?.map((item) => TextDocumentContentChangeEvent1.canParse( + item, nullLspJsonReporter) + ? Either2.t1( + item != null + ? TextDocumentContentChangeEvent1.fromJson(item) + : null) + : (TextDocumentContentChangeEvent2.canParse(item, nullLspJsonReporter) + ? Either2.t2( + item != null + ? TextDocumentContentChangeEvent2.fromJson(item) + : null) + : (throw '''${item} was not one of (TextDocumentContentChangeEvent1, TextDocumentContentChangeEvent2)'''))) + ?.cast>() ?.toList(); return DidChangeTextDocumentParams(textDocument, contentChanges); } /// The actual content changes. The content changes describe single state - /// changes to the document. So if there are two content changes c1 and c2 for - /// a document in state S then c1 move the document to S' and c2 to S''. - final List contentChanges; + /// changes to the document. So if there are two content changes c1 (at array + /// index 0) and c2 (at array index 1) for a document in state S then c1 moves + /// the document from S to S' and c2 from S' to S''. So c1 is computed on the + /// state S and c2 is computed on the state S'. + /// + /// To mirror the content of a document using change events use the following + /// approach: + /// - start with the same initial content + /// - apply the 'textDocument/didChange' notifications in the order you + /// recevie them. + /// - apply the `TextDocumentContentChangeEvent`s in a single notification in + /// the order + /// you receive them. + final List< + Either2> contentChanges; /// The document that did change. The version number points to the version /// after all provided content changes have been applied. @@ -4097,9 +6612,11 @@ class DidChangeTextDocumentParams implements ToJsonable { } if (!((obj['contentChanges'] is List && (obj['contentChanges'].every((item) => - TextDocumentContentChangeEvent.canParse(item, reporter)))))) { + (TextDocumentContentChangeEvent1.canParse(item, reporter) || + TextDocumentContentChangeEvent2.canParse( + item, reporter))))))) { reporter.reportError( - 'must be of type List'); + 'must be of type List>'); return false; } } finally { @@ -4120,8 +6637,12 @@ class DidChangeTextDocumentParams implements ToJsonable { listEqual( contentChanges, other.contentChanges, - (TextDocumentContentChangeEvent a, - TextDocumentContentChangeEvent b) => + (Either2 + a, + Either2 + b) => a == b) && true; } @@ -4140,6 +6661,71 @@ class DidChangeTextDocumentParams implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } +class DidChangeWatchedFilesClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + DidChangeWatchedFilesClientCapabilities.canParse, + DidChangeWatchedFilesClientCapabilities.fromJson); + + DidChangeWatchedFilesClientCapabilities(this.dynamicRegistration); + static DidChangeWatchedFilesClientCapabilities fromJson( + Map json) { + final dynamicRegistration = json['dynamicRegistration']; + return DidChangeWatchedFilesClientCapabilities(dynamicRegistration); + } + + /// Did change watched files notification supports dynamic registration. + /// Please note that the current protocol doesn't support static configuration + /// for file changes from the server side. + final bool dynamicRegistration; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError( + 'must be of type DidChangeWatchedFilesClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DidChangeWatchedFilesClientCapabilities && + other.runtimeType == DidChangeWatchedFilesClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + class DidChangeWatchedFilesParams implements ToJsonable { static const jsonHandler = LspJsonHandler( DidChangeWatchedFilesParams.canParse, @@ -4605,6 +7191,371 @@ class DidSaveTextDocumentParams implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } +class DocumentColorClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + DocumentColorClientCapabilities.canParse, + DocumentColorClientCapabilities.fromJson); + + DocumentColorClientCapabilities(this.dynamicRegistration); + static DocumentColorClientCapabilities fromJson(Map json) { + final dynamicRegistration = json['dynamicRegistration']; + return DocumentColorClientCapabilities(dynamicRegistration); + } + + /// Whether document color supports dynamic registration. + final bool dynamicRegistration; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type DocumentColorClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DocumentColorClientCapabilities && + other.runtimeType == DocumentColorClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DocumentColorOptions implements WorkDoneProgressOptions, ToJsonable { + static const jsonHandler = LspJsonHandler( + DocumentColorOptions.canParse, DocumentColorOptions.fromJson); + + DocumentColorOptions(this.workDoneProgress); + static DocumentColorOptions fromJson(Map json) { + if (DocumentColorRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return DocumentColorRegistrationOptions.fromJson(json); + } + final workDoneProgress = json['workDoneProgress']; + return DocumentColorOptions(workDoneProgress); + } + + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type DocumentColorOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DocumentColorOptions && + other.runtimeType == DocumentColorOptions) { + return workDoneProgress == other.workDoneProgress && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DocumentColorParams + implements WorkDoneProgressParams, PartialResultParams, ToJsonable { + static const jsonHandler = LspJsonHandler( + DocumentColorParams.canParse, DocumentColorParams.fromJson); + + DocumentColorParams( + this.textDocument, this.workDoneToken, this.partialResultToken) { + if (textDocument == null) { + throw 'textDocument is required but was not provided'; + } + } + static DocumentColorParams fromJson(Map json) { + final textDocument = json['textDocument'] != null + ? TextDocumentIdentifier.fromJson(json['textDocument']) + : null; + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + final partialResultToken = json['partialResultToken'] is num + ? Either2.t1(json['partialResultToken']) + : (json['partialResultToken'] is String + ? Either2.t2(json['partialResultToken']) + : (json['partialResultToken'] == null + ? null + : (throw '''${json['partialResultToken']} was not one of (num, String)'''))); + return DocumentColorParams(textDocument, workDoneToken, partialResultToken); + } + + /// An optional token that a server can use to report partial results (e.g. + /// streaming) to the client. + final Either2 partialResultToken; + + /// The text document. + final TextDocumentIdentifier textDocument; + + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + + Map toJson() { + var __result = {}; + __result['textDocument'] = + textDocument ?? (throw 'textDocument is required but was not set'); + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } + if (partialResultToken != null) { + __result['partialResultToken'] = partialResultToken; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('textDocument'); + try { + if (!obj.containsKey('textDocument')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['textDocument'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) { + reporter.reportError('must be of type TextDocumentIdentifier'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneToken'); + try { + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('partialResultToken'); + try { + if (obj['partialResultToken'] != null && + !((obj['partialResultToken'] is num || + obj['partialResultToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type DocumentColorParams'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DocumentColorParams && + other.runtimeType == DocumentColorParams) { + return textDocument == other.textDocument && + workDoneToken == other.workDoneToken && + partialResultToken == other.partialResultToken && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); + hash = JenkinsSmiHash.combine(hash, partialResultToken.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DocumentColorRegistrationOptions + implements + TextDocumentRegistrationOptions, + StaticRegistrationOptions, + DocumentColorOptions, + ToJsonable { + static const jsonHandler = LspJsonHandler( + DocumentColorRegistrationOptions.canParse, + DocumentColorRegistrationOptions.fromJson); + + DocumentColorRegistrationOptions( + this.documentSelector, this.id, this.workDoneProgress); + static DocumentColorRegistrationOptions fromJson(Map json) { + final documentSelector = json['documentSelector'] + ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) + ?.cast() + ?.toList(); + final id = json['id']; + final workDoneProgress = json['workDoneProgress']; + return DocumentColorRegistrationOptions( + documentSelector, id, workDoneProgress); + } + + /// 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. + final List documentSelector; + + /// The id used to register the request. The id can be used to deregister the + /// request again. See also Registration#id. + final String id; + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + __result['documentSelector'] = documentSelector; + if (id != null) { + __result['id'] = id; + } + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('documentSelector'); + try { + if (!obj.containsKey('documentSelector')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['documentSelector'] != null && + !((obj['documentSelector'] is List && + (obj['documentSelector'].every( + (item) => DocumentFilter.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('id'); + try { + if (obj['id'] != null && !(obj['id'] is String)) { + reporter.reportError('must be of type String'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type DocumentColorRegistrationOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DocumentColorRegistrationOptions && + other.runtimeType == DocumentColorRegistrationOptions) { + return listEqual(documentSelector, other.documentSelector, + (DocumentFilter a, DocumentFilter b) => a == b) && + id == other.id && + workDoneProgress == other.workDoneProgress && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, lspHashCode(documentSelector)); + hash = JenkinsSmiHash.combine(hash, id.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + class DocumentFilter implements ToJsonable { static const jsonHandler = LspJsonHandler(DocumentFilter.canParse, DocumentFilter.fromJson); @@ -4712,11 +7663,138 @@ class DocumentFilter implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -class DocumentFormattingParams implements ToJsonable { +class DocumentFormattingClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + DocumentFormattingClientCapabilities.canParse, + DocumentFormattingClientCapabilities.fromJson); + + DocumentFormattingClientCapabilities(this.dynamicRegistration); + static DocumentFormattingClientCapabilities fromJson( + Map json) { + final dynamicRegistration = json['dynamicRegistration']; + return DocumentFormattingClientCapabilities(dynamicRegistration); + } + + /// Whether formatting supports dynamic registration. + final bool dynamicRegistration; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter + .reportError('must be of type DocumentFormattingClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DocumentFormattingClientCapabilities && + other.runtimeType == DocumentFormattingClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DocumentFormattingOptions implements WorkDoneProgressOptions, ToJsonable { + static const jsonHandler = LspJsonHandler( + DocumentFormattingOptions.canParse, DocumentFormattingOptions.fromJson); + + DocumentFormattingOptions(this.workDoneProgress); + static DocumentFormattingOptions fromJson(Map json) { + if (DocumentFormattingRegistrationOptions.canParse( + json, nullLspJsonReporter)) { + return DocumentFormattingRegistrationOptions.fromJson(json); + } + final workDoneProgress = json['workDoneProgress']; + return DocumentFormattingOptions(workDoneProgress); + } + + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type DocumentFormattingOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DocumentFormattingOptions && + other.runtimeType == DocumentFormattingOptions) { + return workDoneProgress == other.workDoneProgress && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DocumentFormattingParams implements WorkDoneProgressParams, ToJsonable { static const jsonHandler = LspJsonHandler( DocumentFormattingParams.canParse, DocumentFormattingParams.fromJson); - DocumentFormattingParams(this.textDocument, this.options) { + DocumentFormattingParams( + this.textDocument, this.options, this.workDoneToken) { if (textDocument == null) { throw 'textDocument is required but was not provided'; } @@ -4731,7 +7809,14 @@ class DocumentFormattingParams implements ToJsonable { final options = json['options'] != null ? FormattingOptions.fromJson(json['options']) : null; - return DocumentFormattingParams(textDocument, options); + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + return DocumentFormattingParams(textDocument, options, workDoneToken); } /// The format options. @@ -4740,12 +7825,18 @@ class DocumentFormattingParams implements ToJsonable { /// The document to format. final TextDocumentIdentifier textDocument; + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + Map toJson() { var __result = {}; __result['textDocument'] = textDocument ?? (throw 'textDocument is required but was not set'); __result['options'] = options ?? (throw 'options is required but was not set'); + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } return __result; } @@ -4785,6 +7876,17 @@ class DocumentFormattingParams implements ToJsonable { } finally { reporter.pop(); } + reporter.push('workDoneToken'); + try { + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type DocumentFormattingParams'); @@ -4798,6 +7900,7 @@ class DocumentFormattingParams implements ToJsonable { other.runtimeType == DocumentFormattingParams) { return textDocument == other.textDocument && options == other.options && + workDoneToken == other.workDoneToken && true; } return false; @@ -4808,6 +7911,103 @@ class DocumentFormattingParams implements ToJsonable { var hash = 0; hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); hash = JenkinsSmiHash.combine(hash, options.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DocumentFormattingRegistrationOptions + implements + TextDocumentRegistrationOptions, + DocumentFormattingOptions, + ToJsonable { + static const jsonHandler = LspJsonHandler( + DocumentFormattingRegistrationOptions.canParse, + DocumentFormattingRegistrationOptions.fromJson); + + DocumentFormattingRegistrationOptions( + this.documentSelector, this.workDoneProgress); + static DocumentFormattingRegistrationOptions fromJson( + Map json) { + final documentSelector = json['documentSelector'] + ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) + ?.cast() + ?.toList(); + final workDoneProgress = json['workDoneProgress']; + return DocumentFormattingRegistrationOptions( + documentSelector, workDoneProgress); + } + + /// 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. + final List documentSelector; + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + __result['documentSelector'] = documentSelector; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('documentSelector'); + try { + if (!obj.containsKey('documentSelector')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['documentSelector'] != null && + !((obj['documentSelector'] is List && + (obj['documentSelector'].every( + (item) => DocumentFilter.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter + .reportError('must be of type DocumentFormattingRegistrationOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DocumentFormattingRegistrationOptions && + other.runtimeType == DocumentFormattingRegistrationOptions) { + return listEqual(documentSelector, other.documentSelector, + (DocumentFilter a, DocumentFilter b) => a == b) && + workDoneProgress == other.workDoneProgress && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, lspHashCode(documentSelector)); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); return JenkinsSmiHash.finish(hash); } @@ -4906,6 +8106,69 @@ class DocumentHighlight implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } +class DocumentHighlightClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + DocumentHighlightClientCapabilities.canParse, + DocumentHighlightClientCapabilities.fromJson); + + DocumentHighlightClientCapabilities(this.dynamicRegistration); + static DocumentHighlightClientCapabilities fromJson( + Map json) { + final dynamicRegistration = json['dynamicRegistration']; + return DocumentHighlightClientCapabilities(dynamicRegistration); + } + + /// Whether document highlight supports dynamic registration. + final bool dynamicRegistration; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter + .reportError('must be of type DocumentHighlightClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DocumentHighlightClientCapabilities && + other.runtimeType == DocumentHighlightClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + /// A document highlight kind. class DocumentHighlightKind { const DocumentHighlightKind(this._value); @@ -4938,13 +8201,334 @@ class DocumentHighlightKind { o is DocumentHighlightKind && o._value == _value; } +class DocumentHighlightOptions implements WorkDoneProgressOptions, ToJsonable { + static const jsonHandler = LspJsonHandler( + DocumentHighlightOptions.canParse, DocumentHighlightOptions.fromJson); + + DocumentHighlightOptions(this.workDoneProgress); + static DocumentHighlightOptions fromJson(Map json) { + if (DocumentHighlightRegistrationOptions.canParse( + json, nullLspJsonReporter)) { + return DocumentHighlightRegistrationOptions.fromJson(json); + } + final workDoneProgress = json['workDoneProgress']; + return DocumentHighlightOptions(workDoneProgress); + } + + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type DocumentHighlightOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DocumentHighlightOptions && + other.runtimeType == DocumentHighlightOptions) { + return workDoneProgress == other.workDoneProgress && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DocumentHighlightParams + implements + TextDocumentPositionParams, + WorkDoneProgressParams, + PartialResultParams, + ToJsonable { + static const jsonHandler = LspJsonHandler( + DocumentHighlightParams.canParse, DocumentHighlightParams.fromJson); + + DocumentHighlightParams(this.textDocument, this.position, this.workDoneToken, + this.partialResultToken) { + if (textDocument == null) { + throw 'textDocument is required but was not provided'; + } + if (position == null) { + throw 'position is required but was not provided'; + } + } + static DocumentHighlightParams fromJson(Map json) { + final textDocument = json['textDocument'] != null + ? TextDocumentIdentifier.fromJson(json['textDocument']) + : null; + final position = + json['position'] != null ? Position.fromJson(json['position']) : null; + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + final partialResultToken = json['partialResultToken'] is num + ? Either2.t1(json['partialResultToken']) + : (json['partialResultToken'] is String + ? Either2.t2(json['partialResultToken']) + : (json['partialResultToken'] == null + ? null + : (throw '''${json['partialResultToken']} was not one of (num, String)'''))); + return DocumentHighlightParams( + textDocument, position, workDoneToken, partialResultToken); + } + + /// An optional token that a server can use to report partial results (e.g. + /// streaming) to the client. + final Either2 partialResultToken; + + /// The position inside the text document. + final Position position; + + /// The text document. + final TextDocumentIdentifier textDocument; + + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + + Map toJson() { + var __result = {}; + __result['textDocument'] = + textDocument ?? (throw 'textDocument is required but was not set'); + __result['position'] = + position ?? (throw 'position is required but was not set'); + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } + if (partialResultToken != null) { + __result['partialResultToken'] = partialResultToken; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('textDocument'); + try { + if (!obj.containsKey('textDocument')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['textDocument'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) { + reporter.reportError('must be of type TextDocumentIdentifier'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('position'); + try { + if (!obj.containsKey('position')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['position'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(Position.canParse(obj['position'], reporter))) { + reporter.reportError('must be of type Position'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneToken'); + try { + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('partialResultToken'); + try { + if (obj['partialResultToken'] != null && + !((obj['partialResultToken'] is num || + obj['partialResultToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type DocumentHighlightParams'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DocumentHighlightParams && + other.runtimeType == DocumentHighlightParams) { + return textDocument == other.textDocument && + position == other.position && + workDoneToken == other.workDoneToken && + partialResultToken == other.partialResultToken && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); + hash = JenkinsSmiHash.combine(hash, position.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); + hash = JenkinsSmiHash.combine(hash, partialResultToken.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DocumentHighlightRegistrationOptions + implements + TextDocumentRegistrationOptions, + DocumentHighlightOptions, + ToJsonable { + static const jsonHandler = LspJsonHandler( + DocumentHighlightRegistrationOptions.canParse, + DocumentHighlightRegistrationOptions.fromJson); + + DocumentHighlightRegistrationOptions( + this.documentSelector, this.workDoneProgress); + static DocumentHighlightRegistrationOptions fromJson( + Map json) { + final documentSelector = json['documentSelector'] + ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) + ?.cast() + ?.toList(); + final workDoneProgress = json['workDoneProgress']; + return DocumentHighlightRegistrationOptions( + documentSelector, workDoneProgress); + } + + /// 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. + final List documentSelector; + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + __result['documentSelector'] = documentSelector; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('documentSelector'); + try { + if (!obj.containsKey('documentSelector')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['documentSelector'] != null && + !((obj['documentSelector'] is List && + (obj['documentSelector'].every( + (item) => DocumentFilter.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter + .reportError('must be of type DocumentHighlightRegistrationOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DocumentHighlightRegistrationOptions && + other.runtimeType == DocumentHighlightRegistrationOptions) { + return listEqual(documentSelector, other.documentSelector, + (DocumentFilter a, DocumentFilter b) => a == b) && + workDoneProgress == other.workDoneProgress && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, lspHashCode(documentSelector)); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + /// A document link is a range in a text document that links to an internal or /// external resource, like another text document or a web site. class DocumentLink implements ToJsonable { static const jsonHandler = LspJsonHandler(DocumentLink.canParse, DocumentLink.fromJson); - DocumentLink(this.range, this.target, this.data) { + DocumentLink(this.range, this.target, this.tooltip, this.data) { if (range == null) { throw 'range is required but was not provided'; } @@ -4952,8 +8536,9 @@ class DocumentLink implements ToJsonable { static DocumentLink fromJson(Map json) { final range = json['range'] != null ? Range.fromJson(json['range']) : null; final target = json['target']; + final tooltip = json['tooltip']; final data = json['data']; - return DocumentLink(range, target, data); + return DocumentLink(range, target, tooltip, data); } /// A data entry field that is preserved on a document link between a @@ -4966,12 +8551,24 @@ class DocumentLink implements ToJsonable { /// The uri this link points to. If missing a resolve request is sent later. final String target; + /// The tooltip text when you hover over this link. + /// + /// If a tooltip is provided, is will be displayed in a string that includes + /// instructions on how to trigger the link, such as `{0} (ctrl + click)`. The + /// specific instructions vary depending on OS, user settings, and + /// localization. + /// @since 3.15.0 + final String tooltip; + Map toJson() { var __result = {}; __result['range'] = range ?? (throw 'range is required but was not set'); if (target != null) { __result['target'] = target; } + if (tooltip != null) { + __result['tooltip'] = tooltip; + } if (data != null) { __result['data'] = data; } @@ -5006,6 +8603,15 @@ class DocumentLink implements ToJsonable { } finally { reporter.pop(); } + reporter.push('tooltip'); + try { + if (obj['tooltip'] != null && !(obj['tooltip'] is String)) { + reporter.reportError('must be of type String'); + return false; + } + } finally { + reporter.pop(); + } reporter.push('data'); try { if (obj['data'] != null && !(true)) { @@ -5027,6 +8633,7 @@ class DocumentLink implements ToJsonable { if (other is DocumentLink && other.runtimeType == DocumentLink) { return range == other.range && target == other.target && + tooltip == other.tooltip && data == other.data && true; } @@ -5038,6 +8645,7 @@ class DocumentLink implements ToJsonable { var hash = 0; hash = JenkinsSmiHash.combine(hash, range.hashCode); hash = JenkinsSmiHash.combine(hash, target.hashCode); + hash = JenkinsSmiHash.combine(hash, tooltip.hashCode); hash = JenkinsSmiHash.combine(hash, data.hashCode); return JenkinsSmiHash.finish(hash); } @@ -5046,25 +8654,113 @@ class DocumentLink implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -/// Document link options. -class DocumentLinkOptions implements ToJsonable { +class DocumentLinkClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + DocumentLinkClientCapabilities.canParse, + DocumentLinkClientCapabilities.fromJson); + + DocumentLinkClientCapabilities(this.dynamicRegistration, this.tooltipSupport); + static DocumentLinkClientCapabilities fromJson(Map json) { + final dynamicRegistration = json['dynamicRegistration']; + final tooltipSupport = json['tooltipSupport']; + return DocumentLinkClientCapabilities(dynamicRegistration, tooltipSupport); + } + + /// Whether document link supports dynamic registration. + final bool dynamicRegistration; + + /// Whether the client supports the `tooltip` property on `DocumentLink`. + /// @since 3.15.0 + final bool tooltipSupport; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + if (tooltipSupport != null) { + __result['tooltipSupport'] = tooltipSupport; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('tooltipSupport'); + try { + if (obj['tooltipSupport'] != null && !(obj['tooltipSupport'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type DocumentLinkClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DocumentLinkClientCapabilities && + other.runtimeType == DocumentLinkClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && + tooltipSupport == other.tooltipSupport && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + hash = JenkinsSmiHash.combine(hash, tooltipSupport.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DocumentLinkOptions implements WorkDoneProgressOptions, ToJsonable { static const jsonHandler = LspJsonHandler( DocumentLinkOptions.canParse, DocumentLinkOptions.fromJson); - DocumentLinkOptions(this.resolveProvider); + DocumentLinkOptions(this.resolveProvider, this.workDoneProgress); static DocumentLinkOptions fromJson(Map json) { + if (DocumentLinkRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return DocumentLinkRegistrationOptions.fromJson(json); + } final resolveProvider = json['resolveProvider']; - return DocumentLinkOptions(resolveProvider); + final workDoneProgress = json['workDoneProgress']; + return DocumentLinkOptions(resolveProvider, workDoneProgress); } /// Document links have a resolve provider as well. final bool resolveProvider; + final bool workDoneProgress; Map toJson() { var __result = {}; if (resolveProvider != null) { __result['resolveProvider'] = resolveProvider; } + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } return __result; } @@ -5080,6 +8776,16 @@ class DocumentLinkOptions implements ToJsonable { } finally { reporter.pop(); } + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type DocumentLinkOptions'); @@ -5091,7 +8797,9 @@ class DocumentLinkOptions implements ToJsonable { bool operator ==(Object other) { if (other is DocumentLinkOptions && other.runtimeType == DocumentLinkOptions) { - return resolveProvider == other.resolveProvider && true; + return resolveProvider == other.resolveProvider && + workDoneProgress == other.workDoneProgress && + true; } return false; } @@ -5100,6 +8808,7 @@ class DocumentLinkOptions implements ToJsonable { int get hashCode { var hash = 0; hash = JenkinsSmiHash.combine(hash, resolveProvider.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); return JenkinsSmiHash.finish(hash); } @@ -5107,11 +8816,13 @@ class DocumentLinkOptions implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -class DocumentLinkParams implements ToJsonable { +class DocumentLinkParams + implements WorkDoneProgressParams, PartialResultParams, ToJsonable { static const jsonHandler = LspJsonHandler(DocumentLinkParams.canParse, DocumentLinkParams.fromJson); - DocumentLinkParams(this.textDocument) { + DocumentLinkParams( + this.textDocument, this.workDoneToken, this.partialResultToken) { if (textDocument == null) { throw 'textDocument is required but was not provided'; } @@ -5120,16 +8831,43 @@ class DocumentLinkParams implements ToJsonable { final textDocument = json['textDocument'] != null ? TextDocumentIdentifier.fromJson(json['textDocument']) : null; - return DocumentLinkParams(textDocument); + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + final partialResultToken = json['partialResultToken'] is num + ? Either2.t1(json['partialResultToken']) + : (json['partialResultToken'] is String + ? Either2.t2(json['partialResultToken']) + : (json['partialResultToken'] == null + ? null + : (throw '''${json['partialResultToken']} was not one of (num, String)'''))); + return DocumentLinkParams(textDocument, workDoneToken, partialResultToken); } + /// An optional token that a server can use to report partial results (e.g. + /// streaming) to the client. + final Either2 partialResultToken; + /// The document to provide document links for. final TextDocumentIdentifier textDocument; + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + Map toJson() { var __result = {}; __result['textDocument'] = textDocument ?? (throw 'textDocument is required but was not set'); + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } + if (partialResultToken != null) { + __result['partialResultToken'] = partialResultToken; + } return __result; } @@ -5152,6 +8890,28 @@ class DocumentLinkParams implements ToJsonable { } finally { reporter.pop(); } + reporter.push('workDoneToken'); + try { + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('partialResultToken'); + try { + if (obj['partialResultToken'] != null && + !((obj['partialResultToken'] is num || + obj['partialResultToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type DocumentLinkParams'); @@ -5163,7 +8923,10 @@ class DocumentLinkParams implements ToJsonable { bool operator ==(Object other) { if (other is DocumentLinkParams && other.runtimeType == DocumentLinkParams) { - return textDocument == other.textDocument && true; + return textDocument == other.textDocument && + workDoneToken == other.workDoneToken && + partialResultToken == other.partialResultToken && + true; } return false; } @@ -5172,6 +8935,8 @@ class DocumentLinkParams implements ToJsonable { int get hashCode { var hash = 0; hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); + hash = JenkinsSmiHash.combine(hash, partialResultToken.hashCode); return JenkinsSmiHash.finish(hash); } @@ -5180,19 +8945,25 @@ class DocumentLinkParams implements ToJsonable { } class DocumentLinkRegistrationOptions - implements TextDocumentRegistrationOptions, ToJsonable { + implements + TextDocumentRegistrationOptions, + DocumentLinkOptions, + ToJsonable { static const jsonHandler = LspJsonHandler( DocumentLinkRegistrationOptions.canParse, DocumentLinkRegistrationOptions.fromJson); - DocumentLinkRegistrationOptions(this.resolveProvider, this.documentSelector); + DocumentLinkRegistrationOptions( + this.documentSelector, this.resolveProvider, this.workDoneProgress); static DocumentLinkRegistrationOptions fromJson(Map json) { - final resolveProvider = json['resolveProvider']; final documentSelector = json['documentSelector'] ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) ?.cast() ?.toList(); - return DocumentLinkRegistrationOptions(resolveProvider, documentSelector); + final resolveProvider = json['resolveProvider']; + final workDoneProgress = json['workDoneProgress']; + return DocumentLinkRegistrationOptions( + documentSelector, resolveProvider, workDoneProgress); } /// A document selector to identify the scope of the registration. If set to @@ -5201,28 +8972,22 @@ class DocumentLinkRegistrationOptions /// Document links have a resolve provider as well. final bool resolveProvider; + final bool workDoneProgress; Map toJson() { var __result = {}; + __result['documentSelector'] = documentSelector; if (resolveProvider != null) { __result['resolveProvider'] = resolveProvider; } - __result['documentSelector'] = documentSelector; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } return __result; } static bool canParse(Object obj, LspJsonReporter reporter) { if (obj is Map) { - reporter.push('resolveProvider'); - try { - if (obj['resolveProvider'] != null && - !(obj['resolveProvider'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } reporter.push('documentSelector'); try { if (!obj.containsKey('documentSelector')) { @@ -5239,6 +9004,26 @@ class DocumentLinkRegistrationOptions } finally { reporter.pop(); } + reporter.push('resolveProvider'); + try { + if (obj['resolveProvider'] != null && + !(obj['resolveProvider'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type DocumentLinkRegistrationOptions'); @@ -5250,9 +9035,10 @@ class DocumentLinkRegistrationOptions bool operator ==(Object other) { if (other is DocumentLinkRegistrationOptions && other.runtimeType == DocumentLinkRegistrationOptions) { - return resolveProvider == other.resolveProvider && - listEqual(documentSelector, other.documentSelector, + return listEqual(documentSelector, other.documentSelector, (DocumentFilter a, DocumentFilter b) => a == b) && + resolveProvider == other.resolveProvider && + workDoneProgress == other.workDoneProgress && true; } return false; @@ -5261,8 +9047,72 @@ class DocumentLinkRegistrationOptions @override int get hashCode { var hash = 0; - hash = JenkinsSmiHash.combine(hash, resolveProvider.hashCode); hash = JenkinsSmiHash.combine(hash, lspHashCode(documentSelector)); + hash = JenkinsSmiHash.combine(hash, resolveProvider.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DocumentOnTypeFormattingClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + DocumentOnTypeFormattingClientCapabilities.canParse, + DocumentOnTypeFormattingClientCapabilities.fromJson); + + DocumentOnTypeFormattingClientCapabilities(this.dynamicRegistration); + static DocumentOnTypeFormattingClientCapabilities fromJson( + Map json) { + final dynamicRegistration = json['dynamicRegistration']; + return DocumentOnTypeFormattingClientCapabilities(dynamicRegistration); + } + + /// Whether on type formatting supports dynamic registration. + final bool dynamicRegistration; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError( + 'must be of type DocumentOnTypeFormattingClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DocumentOnTypeFormattingClientCapabilities && + other.runtimeType == DocumentOnTypeFormattingClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); return JenkinsSmiHash.finish(hash); } @@ -5270,7 +9120,6 @@ class DocumentLinkRegistrationOptions String toString() => jsonEncoder.convert(toJson()); } -/// Format document on type options. class DocumentOnTypeFormattingOptions implements ToJsonable { static const jsonHandler = LspJsonHandler( DocumentOnTypeFormattingOptions.canParse, @@ -5283,6 +9132,10 @@ class DocumentOnTypeFormattingOptions implements ToJsonable { } } static DocumentOnTypeFormattingOptions fromJson(Map json) { + if (DocumentOnTypeFormattingRegistrationOptions.canParse( + json, nullLspJsonReporter)) { + return DocumentOnTypeFormattingRegistrationOptions.fromJson(json); + } final firstTriggerCharacter = json['firstTriggerCharacter']; final moreTriggerCharacter = json['moreTriggerCharacter'] ?.map((item) => item) @@ -5370,37 +9223,38 @@ class DocumentOnTypeFormattingOptions implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -class DocumentOnTypeFormattingParams implements ToJsonable { +class DocumentOnTypeFormattingParams + implements TextDocumentPositionParams, ToJsonable { static const jsonHandler = LspJsonHandler( DocumentOnTypeFormattingParams.canParse, DocumentOnTypeFormattingParams.fromJson); DocumentOnTypeFormattingParams( - this.textDocument, this.position, this.ch, this.options) { - if (textDocument == null) { - throw 'textDocument is required but was not provided'; - } - if (position == null) { - throw 'position is required but was not provided'; - } + this.ch, this.options, this.textDocument, this.position) { if (ch == null) { throw 'ch is required but was not provided'; } if (options == null) { throw 'options is required but was not provided'; } + if (textDocument == null) { + throw 'textDocument is required but was not provided'; + } + if (position == null) { + throw 'position is required but was not provided'; + } } static DocumentOnTypeFormattingParams fromJson(Map json) { + final ch = json['ch']; + final options = json['options'] != null + ? FormattingOptions.fromJson(json['options']) + : null; final textDocument = json['textDocument'] != null ? TextDocumentIdentifier.fromJson(json['textDocument']) : null; final position = json['position'] != null ? Position.fromJson(json['position']) : null; - final ch = json['ch']; - final options = json['options'] != null - ? FormattingOptions.fromJson(json['options']) - : null; - return DocumentOnTypeFormattingParams(textDocument, position, ch, options); + return DocumentOnTypeFormattingParams(ch, options, textDocument, position); } /// The character that has been typed. @@ -5409,60 +9263,26 @@ class DocumentOnTypeFormattingParams implements ToJsonable { /// The format options. final FormattingOptions options; - /// The position at which this request was sent. + /// The position inside the text document. final Position position; - /// The document to format. + /// The text document. final TextDocumentIdentifier textDocument; Map toJson() { var __result = {}; + __result['ch'] = ch ?? (throw 'ch is required but was not set'); + __result['options'] = + options ?? (throw 'options is required but was not set'); __result['textDocument'] = textDocument ?? (throw 'textDocument is required but was not set'); __result['position'] = position ?? (throw 'position is required but was not set'); - __result['ch'] = ch ?? (throw 'ch is required but was not set'); - __result['options'] = - options ?? (throw 'options is required but was not set'); return __result; } static bool canParse(Object obj, LspJsonReporter reporter) { if (obj is Map) { - reporter.push('textDocument'); - try { - if (!obj.containsKey('textDocument')) { - reporter.reportError('must not be undefined'); - return false; - } - if (obj['textDocument'] == null) { - reporter.reportError('must not be null'); - return false; - } - if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) { - reporter.reportError('must be of type TextDocumentIdentifier'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('position'); - try { - if (!obj.containsKey('position')) { - reporter.reportError('must not be undefined'); - return false; - } - if (obj['position'] == null) { - reporter.reportError('must not be null'); - return false; - } - if (!(Position.canParse(obj['position'], reporter))) { - reporter.reportError('must be of type Position'); - return false; - } - } finally { - reporter.pop(); - } reporter.push('ch'); try { if (!obj.containsKey('ch')) { @@ -5497,6 +9317,40 @@ class DocumentOnTypeFormattingParams implements ToJsonable { } finally { reporter.pop(); } + reporter.push('textDocument'); + try { + if (!obj.containsKey('textDocument')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['textDocument'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) { + reporter.reportError('must be of type TextDocumentIdentifier'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('position'); + try { + if (!obj.containsKey('position')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['position'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(Position.canParse(obj['position'], reporter))) { + reporter.reportError('must be of type Position'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type DocumentOnTypeFormattingParams'); @@ -5508,10 +9362,10 @@ class DocumentOnTypeFormattingParams implements ToJsonable { bool operator ==(Object other) { if (other is DocumentOnTypeFormattingParams && other.runtimeType == DocumentOnTypeFormattingParams) { - return textDocument == other.textDocument && - position == other.position && - ch == other.ch && + return ch == other.ch && options == other.options && + textDocument == other.textDocument && + position == other.position && true; } return false; @@ -5520,10 +9374,10 @@ class DocumentOnTypeFormattingParams implements ToJsonable { @override int get hashCode { var hash = 0; - hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); - hash = JenkinsSmiHash.combine(hash, position.hashCode); hash = JenkinsSmiHash.combine(hash, ch.hashCode); hash = JenkinsSmiHash.combine(hash, options.hashCode); + hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); + hash = JenkinsSmiHash.combine(hash, position.hashCode); return JenkinsSmiHash.finish(hash); } @@ -5532,30 +9386,33 @@ class DocumentOnTypeFormattingParams implements ToJsonable { } class DocumentOnTypeFormattingRegistrationOptions - implements TextDocumentRegistrationOptions, ToJsonable { + implements + TextDocumentRegistrationOptions, + DocumentOnTypeFormattingOptions, + ToJsonable { static const jsonHandler = LspJsonHandler( DocumentOnTypeFormattingRegistrationOptions.canParse, DocumentOnTypeFormattingRegistrationOptions.fromJson); - DocumentOnTypeFormattingRegistrationOptions(this.firstTriggerCharacter, - this.moreTriggerCharacter, this.documentSelector) { + DocumentOnTypeFormattingRegistrationOptions(this.documentSelector, + this.firstTriggerCharacter, this.moreTriggerCharacter) { if (firstTriggerCharacter == null) { throw 'firstTriggerCharacter is required but was not provided'; } } static DocumentOnTypeFormattingRegistrationOptions fromJson( Map json) { + final documentSelector = json['documentSelector'] + ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) + ?.cast() + ?.toList(); final firstTriggerCharacter = json['firstTriggerCharacter']; final moreTriggerCharacter = json['moreTriggerCharacter'] ?.map((item) => item) ?.cast() ?.toList(); - final documentSelector = json['documentSelector'] - ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) - ?.cast() - ?.toList(); return DocumentOnTypeFormattingRegistrationOptions( - firstTriggerCharacter, moreTriggerCharacter, documentSelector); + documentSelector, firstTriggerCharacter, moreTriggerCharacter); } /// A document selector to identify the scope of the registration. If set to @@ -5570,17 +9427,33 @@ class DocumentOnTypeFormattingRegistrationOptions Map toJson() { var __result = {}; + __result['documentSelector'] = documentSelector; __result['firstTriggerCharacter'] = firstTriggerCharacter ?? (throw 'firstTriggerCharacter is required but was not set'); if (moreTriggerCharacter != null) { __result['moreTriggerCharacter'] = moreTriggerCharacter; } - __result['documentSelector'] = documentSelector; return __result; } static bool canParse(Object obj, LspJsonReporter reporter) { if (obj is Map) { + reporter.push('documentSelector'); + try { + if (!obj.containsKey('documentSelector')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['documentSelector'] != null && + !((obj['documentSelector'] is List && + (obj['documentSelector'].every( + (item) => DocumentFilter.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } reporter.push('firstTriggerCharacter'); try { if (!obj.containsKey('firstTriggerCharacter')) { @@ -5610,22 +9483,6 @@ class DocumentOnTypeFormattingRegistrationOptions } finally { reporter.pop(); } - reporter.push('documentSelector'); - try { - if (!obj.containsKey('documentSelector')) { - reporter.reportError('must not be undefined'); - return false; - } - if (obj['documentSelector'] != null && - !((obj['documentSelector'] is List && - (obj['documentSelector'].every( - (item) => DocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); - return false; - } - } finally { - reporter.pop(); - } return true; } else { reporter.reportError( @@ -5638,11 +9495,11 @@ class DocumentOnTypeFormattingRegistrationOptions bool operator ==(Object other) { if (other is DocumentOnTypeFormattingRegistrationOptions && other.runtimeType == DocumentOnTypeFormattingRegistrationOptions) { - return firstTriggerCharacter == other.firstTriggerCharacter && + return listEqual(documentSelector, other.documentSelector, + (DocumentFilter a, DocumentFilter b) => a == b) && + firstTriggerCharacter == other.firstTriggerCharacter && listEqual(moreTriggerCharacter, other.moreTriggerCharacter, (String a, String b) => a == b) && - listEqual(documentSelector, other.documentSelector, - (DocumentFilter a, DocumentFilter b) => a == b) && true; } return false; @@ -5651,9 +9508,9 @@ class DocumentOnTypeFormattingRegistrationOptions @override int get hashCode { var hash = 0; + hash = JenkinsSmiHash.combine(hash, lspHashCode(documentSelector)); hash = JenkinsSmiHash.combine(hash, firstTriggerCharacter.hashCode); hash = JenkinsSmiHash.combine(hash, lspHashCode(moreTriggerCharacter)); - hash = JenkinsSmiHash.combine(hash, lspHashCode(documentSelector)); return JenkinsSmiHash.finish(hash); } @@ -5661,12 +9518,142 @@ class DocumentOnTypeFormattingRegistrationOptions String toString() => jsonEncoder.convert(toJson()); } -class DocumentRangeFormattingParams implements ToJsonable { +class DocumentRangeFormattingClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + DocumentRangeFormattingClientCapabilities.canParse, + DocumentRangeFormattingClientCapabilities.fromJson); + + DocumentRangeFormattingClientCapabilities(this.dynamicRegistration); + static DocumentRangeFormattingClientCapabilities fromJson( + Map json) { + final dynamicRegistration = json['dynamicRegistration']; + return DocumentRangeFormattingClientCapabilities(dynamicRegistration); + } + + /// Whether formatting supports dynamic registration. + final bool dynamicRegistration; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError( + 'must be of type DocumentRangeFormattingClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DocumentRangeFormattingClientCapabilities && + other.runtimeType == DocumentRangeFormattingClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DocumentRangeFormattingOptions + implements WorkDoneProgressOptions, ToJsonable { + static const jsonHandler = LspJsonHandler( + DocumentRangeFormattingOptions.canParse, + DocumentRangeFormattingOptions.fromJson); + + DocumentRangeFormattingOptions(this.workDoneProgress); + static DocumentRangeFormattingOptions fromJson(Map json) { + if (DocumentRangeFormattingRegistrationOptions.canParse( + json, nullLspJsonReporter)) { + return DocumentRangeFormattingRegistrationOptions.fromJson(json); + } + final workDoneProgress = json['workDoneProgress']; + return DocumentRangeFormattingOptions(workDoneProgress); + } + + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type DocumentRangeFormattingOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DocumentRangeFormattingOptions && + other.runtimeType == DocumentRangeFormattingOptions) { + return workDoneProgress == other.workDoneProgress && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DocumentRangeFormattingParams + implements WorkDoneProgressParams, ToJsonable { static const jsonHandler = LspJsonHandler( DocumentRangeFormattingParams.canParse, DocumentRangeFormattingParams.fromJson); - DocumentRangeFormattingParams(this.textDocument, this.range, this.options) { + DocumentRangeFormattingParams( + this.textDocument, this.range, this.options, this.workDoneToken) { if (textDocument == null) { throw 'textDocument is required but was not provided'; } @@ -5685,7 +9672,15 @@ class DocumentRangeFormattingParams implements ToJsonable { final options = json['options'] != null ? FormattingOptions.fromJson(json['options']) : null; - return DocumentRangeFormattingParams(textDocument, range, options); + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + return DocumentRangeFormattingParams( + textDocument, range, options, workDoneToken); } /// The format options @@ -5697,6 +9692,9 @@ class DocumentRangeFormattingParams implements ToJsonable { /// The document to format. final TextDocumentIdentifier textDocument; + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + Map toJson() { var __result = {}; __result['textDocument'] = @@ -5704,6 +9702,9 @@ class DocumentRangeFormattingParams implements ToJsonable { __result['range'] = range ?? (throw 'range is required but was not set'); __result['options'] = options ?? (throw 'options is required but was not set'); + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } return __result; } @@ -5760,6 +9761,17 @@ class DocumentRangeFormattingParams implements ToJsonable { } finally { reporter.pop(); } + reporter.push('workDoneToken'); + try { + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type DocumentRangeFormattingParams'); @@ -5774,6 +9786,7 @@ class DocumentRangeFormattingParams implements ToJsonable { return textDocument == other.textDocument && range == other.range && options == other.options && + workDoneToken == other.workDoneToken && true; } return false; @@ -5785,6 +9798,103 @@ class DocumentRangeFormattingParams implements ToJsonable { hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); hash = JenkinsSmiHash.combine(hash, range.hashCode); hash = JenkinsSmiHash.combine(hash, options.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DocumentRangeFormattingRegistrationOptions + implements + TextDocumentRegistrationOptions, + DocumentRangeFormattingOptions, + ToJsonable { + static const jsonHandler = LspJsonHandler( + DocumentRangeFormattingRegistrationOptions.canParse, + DocumentRangeFormattingRegistrationOptions.fromJson); + + DocumentRangeFormattingRegistrationOptions( + this.documentSelector, this.workDoneProgress); + static DocumentRangeFormattingRegistrationOptions fromJson( + Map json) { + final documentSelector = json['documentSelector'] + ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) + ?.cast() + ?.toList(); + final workDoneProgress = json['workDoneProgress']; + return DocumentRangeFormattingRegistrationOptions( + documentSelector, workDoneProgress); + } + + /// 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. + final List documentSelector; + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + __result['documentSelector'] = documentSelector; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('documentSelector'); + try { + if (!obj.containsKey('documentSelector')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['documentSelector'] != null && + !((obj['documentSelector'] is List && + (obj['documentSelector'].every( + (item) => DocumentFilter.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError( + 'must be of type DocumentRangeFormattingRegistrationOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DocumentRangeFormattingRegistrationOptions && + other.runtimeType == DocumentRangeFormattingRegistrationOptions) { + return listEqual(documentSelector, other.documentSelector, + (DocumentFilter a, DocumentFilter b) => a == b) && + workDoneProgress == other.workDoneProgress && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, lspHashCode(documentSelector)); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); return JenkinsSmiHash.finish(hash); } @@ -6019,11 +10129,262 @@ class DocumentSymbol implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -class DocumentSymbolParams implements ToJsonable { +class DocumentSymbolClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + DocumentSymbolClientCapabilities.canParse, + DocumentSymbolClientCapabilities.fromJson); + + DocumentSymbolClientCapabilities(this.dynamicRegistration, this.symbolKind, + this.hierarchicalDocumentSymbolSupport); + static DocumentSymbolClientCapabilities fromJson(Map json) { + final dynamicRegistration = json['dynamicRegistration']; + final symbolKind = json['symbolKind'] != null + ? DocumentSymbolClientCapabilitiesSymbolKind.fromJson( + json['symbolKind']) + : null; + final hierarchicalDocumentSymbolSupport = + json['hierarchicalDocumentSymbolSupport']; + return DocumentSymbolClientCapabilities( + dynamicRegistration, symbolKind, hierarchicalDocumentSymbolSupport); + } + + /// Whether document symbol supports dynamic registration. + final bool dynamicRegistration; + + /// The client supports hierarchical document symbols. + final bool hierarchicalDocumentSymbolSupport; + + /// Specific capabilities for the `SymbolKind` in the + /// `textDocument/documentSymbol` request. + final DocumentSymbolClientCapabilitiesSymbolKind symbolKind; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + if (symbolKind != null) { + __result['symbolKind'] = symbolKind; + } + if (hierarchicalDocumentSymbolSupport != null) { + __result['hierarchicalDocumentSymbolSupport'] = + hierarchicalDocumentSymbolSupport; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('symbolKind'); + try { + if (obj['symbolKind'] != null && + !(DocumentSymbolClientCapabilitiesSymbolKind.canParse( + obj['symbolKind'], reporter))) { + reporter.reportError( + 'must be of type DocumentSymbolClientCapabilitiesSymbolKind'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('hierarchicalDocumentSymbolSupport'); + try { + if (obj['hierarchicalDocumentSymbolSupport'] != null && + !(obj['hierarchicalDocumentSymbolSupport'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type DocumentSymbolClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DocumentSymbolClientCapabilities && + other.runtimeType == DocumentSymbolClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && + symbolKind == other.symbolKind && + hierarchicalDocumentSymbolSupport == + other.hierarchicalDocumentSymbolSupport && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + hash = JenkinsSmiHash.combine(hash, symbolKind.hashCode); + hash = JenkinsSmiHash.combine( + hash, hierarchicalDocumentSymbolSupport.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DocumentSymbolClientCapabilitiesSymbolKind implements ToJsonable { + static const jsonHandler = LspJsonHandler( + DocumentSymbolClientCapabilitiesSymbolKind.canParse, + DocumentSymbolClientCapabilitiesSymbolKind.fromJson); + + DocumentSymbolClientCapabilitiesSymbolKind(this.valueSet); + static DocumentSymbolClientCapabilitiesSymbolKind fromJson( + Map json) { + final valueSet = json['valueSet'] + ?.map((item) => item != null ? SymbolKind.fromJson(item) : null) + ?.cast() + ?.toList(); + return DocumentSymbolClientCapabilitiesSymbolKind(valueSet); + } + + /// The symbol kind values the client supports. When this property exists the + /// client also guarantees that it will handle values outside its set + /// gracefully and falls back to a default value when unknown. + /// + /// If this property is not present the client only supports the symbol kinds + /// from `File` to `Array` as defined in the initial version of the protocol. + final List valueSet; + + Map toJson() { + var __result = {}; + if (valueSet != null) { + __result['valueSet'] = valueSet; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('valueSet'); + try { + if (obj['valueSet'] != null && + !((obj['valueSet'] is List && + (obj['valueSet'] + .every((item) => SymbolKind.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError( + 'must be of type DocumentSymbolClientCapabilitiesSymbolKind'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DocumentSymbolClientCapabilitiesSymbolKind && + other.runtimeType == DocumentSymbolClientCapabilitiesSymbolKind) { + return listEqual(valueSet, other.valueSet, + (SymbolKind a, SymbolKind b) => a == b) && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, lspHashCode(valueSet)); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DocumentSymbolOptions implements WorkDoneProgressOptions, ToJsonable { + static const jsonHandler = LspJsonHandler( + DocumentSymbolOptions.canParse, DocumentSymbolOptions.fromJson); + + DocumentSymbolOptions(this.workDoneProgress); + static DocumentSymbolOptions fromJson(Map json) { + if (DocumentSymbolRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return DocumentSymbolRegistrationOptions.fromJson(json); + } + final workDoneProgress = json['workDoneProgress']; + return DocumentSymbolOptions(workDoneProgress); + } + + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type DocumentSymbolOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DocumentSymbolOptions && + other.runtimeType == DocumentSymbolOptions) { + return workDoneProgress == other.workDoneProgress && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DocumentSymbolParams + implements WorkDoneProgressParams, PartialResultParams, ToJsonable { static const jsonHandler = LspJsonHandler( DocumentSymbolParams.canParse, DocumentSymbolParams.fromJson); - DocumentSymbolParams(this.textDocument) { + DocumentSymbolParams( + this.textDocument, this.workDoneToken, this.partialResultToken) { if (textDocument == null) { throw 'textDocument is required but was not provided'; } @@ -6032,16 +10393,44 @@ class DocumentSymbolParams implements ToJsonable { final textDocument = json['textDocument'] != null ? TextDocumentIdentifier.fromJson(json['textDocument']) : null; - return DocumentSymbolParams(textDocument); + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + final partialResultToken = json['partialResultToken'] is num + ? Either2.t1(json['partialResultToken']) + : (json['partialResultToken'] is String + ? Either2.t2(json['partialResultToken']) + : (json['partialResultToken'] == null + ? null + : (throw '''${json['partialResultToken']} was not one of (num, String)'''))); + return DocumentSymbolParams( + textDocument, workDoneToken, partialResultToken); } + /// An optional token that a server can use to report partial results (e.g. + /// streaming) to the client. + final Either2 partialResultToken; + /// The text document. final TextDocumentIdentifier textDocument; + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + Map toJson() { var __result = {}; __result['textDocument'] = textDocument ?? (throw 'textDocument is required but was not set'); + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } + if (partialResultToken != null) { + __result['partialResultToken'] = partialResultToken; + } return __result; } @@ -6064,6 +10453,28 @@ class DocumentSymbolParams implements ToJsonable { } finally { reporter.pop(); } + reporter.push('workDoneToken'); + try { + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('partialResultToken'); + try { + if (obj['partialResultToken'] != null && + !((obj['partialResultToken'] is num || + obj['partialResultToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type DocumentSymbolParams'); @@ -6075,7 +10486,10 @@ class DocumentSymbolParams implements ToJsonable { bool operator ==(Object other) { if (other is DocumentSymbolParams && other.runtimeType == DocumentSymbolParams) { - return textDocument == other.textDocument && true; + return textDocument == other.textDocument && + workDoneToken == other.workDoneToken && + partialResultToken == other.partialResultToken && + true; } return false; } @@ -6084,6 +10498,102 @@ class DocumentSymbolParams implements ToJsonable { int get hashCode { var hash = 0; hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); + hash = JenkinsSmiHash.combine(hash, partialResultToken.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class DocumentSymbolRegistrationOptions + implements + TextDocumentRegistrationOptions, + DocumentSymbolOptions, + ToJsonable { + static const jsonHandler = LspJsonHandler( + DocumentSymbolRegistrationOptions.canParse, + DocumentSymbolRegistrationOptions.fromJson); + + DocumentSymbolRegistrationOptions( + this.documentSelector, this.workDoneProgress); + static DocumentSymbolRegistrationOptions fromJson(Map json) { + final documentSelector = json['documentSelector'] + ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) + ?.cast() + ?.toList(); + final workDoneProgress = json['workDoneProgress']; + return DocumentSymbolRegistrationOptions( + documentSelector, workDoneProgress); + } + + /// 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. + final List documentSelector; + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + __result['documentSelector'] = documentSelector; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('documentSelector'); + try { + if (!obj.containsKey('documentSelector')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['documentSelector'] != null && + !((obj['documentSelector'] is List && + (obj['documentSelector'].every( + (item) => DocumentFilter.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type DocumentSymbolRegistrationOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is DocumentSymbolRegistrationOptions && + other.runtimeType == DocumentSymbolRegistrationOptions) { + return listEqual(documentSelector, other.documentSelector, + (DocumentFilter a, DocumentFilter b) => a == b) && + workDoneProgress == other.workDoneProgress && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, lspHashCode(documentSelector)); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); return JenkinsSmiHash.finish(hash); } @@ -6127,29 +10637,97 @@ class ErrorCodes { bool operator ==(Object o) => o is ErrorCodes && o._value == _value; } -/// Execute command options. -class ExecuteCommandOptions implements ToJsonable { +class ExecuteCommandClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + ExecuteCommandClientCapabilities.canParse, + ExecuteCommandClientCapabilities.fromJson); + + ExecuteCommandClientCapabilities(this.dynamicRegistration); + static ExecuteCommandClientCapabilities fromJson(Map json) { + final dynamicRegistration = json['dynamicRegistration']; + return ExecuteCommandClientCapabilities(dynamicRegistration); + } + + /// Execute command supports dynamic registration. + final bool dynamicRegistration; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type ExecuteCommandClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is ExecuteCommandClientCapabilities && + other.runtimeType == ExecuteCommandClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class ExecuteCommandOptions implements WorkDoneProgressOptions, ToJsonable { static const jsonHandler = LspJsonHandler( ExecuteCommandOptions.canParse, ExecuteCommandOptions.fromJson); - ExecuteCommandOptions(this.commands) { + ExecuteCommandOptions(this.commands, this.workDoneProgress) { if (commands == null) { throw 'commands is required but was not provided'; } } static ExecuteCommandOptions fromJson(Map json) { + if (ExecuteCommandRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return ExecuteCommandRegistrationOptions.fromJson(json); + } final commands = json['commands']?.map((item) => item)?.cast()?.toList(); - return ExecuteCommandOptions(commands); + final workDoneProgress = json['workDoneProgress']; + return ExecuteCommandOptions(commands, workDoneProgress); } /// The commands to be executed on the server final List commands; + final bool workDoneProgress; Map toJson() { var __result = {}; __result['commands'] = commands ?? (throw 'commands is required but was not set'); + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } return __result; } @@ -6173,6 +10751,16 @@ class ExecuteCommandOptions implements ToJsonable { } finally { reporter.pop(); } + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type ExecuteCommandOptions'); @@ -6186,6 +10774,7 @@ class ExecuteCommandOptions implements ToJsonable { other.runtimeType == ExecuteCommandOptions) { return listEqual( commands, other.commands, (String a, String b) => a == b) && + workDoneProgress == other.workDoneProgress && true; } return false; @@ -6195,6 +10784,7 @@ class ExecuteCommandOptions implements ToJsonable { int get hashCode { var hash = 0; hash = JenkinsSmiHash.combine(hash, lspHashCode(commands)); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); return JenkinsSmiHash.finish(hash); } @@ -6202,11 +10792,11 @@ class ExecuteCommandOptions implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -class ExecuteCommandParams implements ToJsonable { +class ExecuteCommandParams implements WorkDoneProgressParams, ToJsonable { static const jsonHandler = LspJsonHandler( ExecuteCommandParams.canParse, ExecuteCommandParams.fromJson); - ExecuteCommandParams(this.command, this.arguments) { + ExecuteCommandParams(this.command, this.arguments, this.workDoneToken) { if (command == null) { throw 'command is required but was not provided'; } @@ -6215,7 +10805,14 @@ class ExecuteCommandParams implements ToJsonable { final command = json['command']; final arguments = json['arguments']?.map((item) => item)?.cast()?.toList(); - return ExecuteCommandParams(command, arguments); + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + return ExecuteCommandParams(command, arguments, workDoneToken); } /// Arguments that the command should be invoked with. @@ -6224,6 +10821,9 @@ class ExecuteCommandParams implements ToJsonable { /// The identifier of the actual command handler. final String command; + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + Map toJson() { var __result = {}; __result['command'] = @@ -6231,6 +10831,9 @@ class ExecuteCommandParams implements ToJsonable { if (arguments != null) { __result['arguments'] = arguments; } + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } return __result; } @@ -6264,6 +10867,17 @@ class ExecuteCommandParams implements ToJsonable { } finally { reporter.pop(); } + reporter.push('workDoneToken'); + try { + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type ExecuteCommandParams'); @@ -6278,6 +10892,7 @@ class ExecuteCommandParams implements ToJsonable { return command == other.command && listEqual( arguments, other.arguments, (dynamic a, dynamic b) => a == b) && + workDoneToken == other.workDoneToken && true; } return false; @@ -6288,6 +10903,7 @@ class ExecuteCommandParams implements ToJsonable { var hash = 0; hash = JenkinsSmiHash.combine(hash, command.hashCode); hash = JenkinsSmiHash.combine(hash, lspHashCode(arguments)); + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); return JenkinsSmiHash.finish(hash); } @@ -6296,12 +10912,13 @@ class ExecuteCommandParams implements ToJsonable { } /// Execute command registration options. -class ExecuteCommandRegistrationOptions implements ToJsonable { +class ExecuteCommandRegistrationOptions + implements ExecuteCommandOptions, ToJsonable { static const jsonHandler = LspJsonHandler( ExecuteCommandRegistrationOptions.canParse, ExecuteCommandRegistrationOptions.fromJson); - ExecuteCommandRegistrationOptions(this.commands) { + ExecuteCommandRegistrationOptions(this.commands, this.workDoneProgress) { if (commands == null) { throw 'commands is required but was not provided'; } @@ -6309,16 +10926,21 @@ class ExecuteCommandRegistrationOptions implements ToJsonable { static ExecuteCommandRegistrationOptions fromJson(Map json) { final commands = json['commands']?.map((item) => item)?.cast()?.toList(); - return ExecuteCommandRegistrationOptions(commands); + final workDoneProgress = json['workDoneProgress']; + return ExecuteCommandRegistrationOptions(commands, workDoneProgress); } /// The commands to be executed on the server final List commands; + final bool workDoneProgress; Map toJson() { var __result = {}; __result['commands'] = commands ?? (throw 'commands is required but was not set'); + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } return __result; } @@ -6342,6 +10964,16 @@ class ExecuteCommandRegistrationOptions implements ToJsonable { } finally { reporter.pop(); } + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type ExecuteCommandRegistrationOptions'); @@ -6355,6 +10987,7 @@ class ExecuteCommandRegistrationOptions implements ToJsonable { other.runtimeType == ExecuteCommandRegistrationOptions) { return listEqual( commands, other.commands, (String a, String b) => a == b) && + workDoneProgress == other.workDoneProgress && true; } return false; @@ -6364,6 +10997,7 @@ class ExecuteCommandRegistrationOptions implements ToJsonable { int get hashCode { var hash = 0; hash = JenkinsSmiHash.combine(hash, lspHashCode(commands)); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); return JenkinsSmiHash.finish(hash); } @@ -6393,18 +11027,18 @@ class FailureHandlingKind { /// executed. static const Abort = FailureHandlingKind._('abort'); - /// All operations are executed transactionally. That means they either all + /// All operations are executed transactional. That means they either all /// succeed or no changes at all are applied to the workspace. static const Transactional = FailureHandlingKind._('transactional'); /// If the workspace edit contains only textual file changes they are executed - /// transactionally. If resource changes (create, rename or delete file) are + /// transactional. If resource changes (create, rename or delete file) are /// part of the change the failure handling strategy is abort. static const TextOnlyTransactional = FailureHandlingKind._('textOnlyTransactional'); /// The client tries to undo the operations already executed. But there is no - /// guarantee that this succeeds. + /// guarantee that this is succeeding. static const Undo = FailureHandlingKind._('undo'); Object toJson() => _value; @@ -6805,6 +11439,114 @@ class FoldingRange implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } +class FoldingRangeClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + FoldingRangeClientCapabilities.canParse, + FoldingRangeClientCapabilities.fromJson); + + FoldingRangeClientCapabilities( + this.dynamicRegistration, this.rangeLimit, this.lineFoldingOnly); + static FoldingRangeClientCapabilities fromJson(Map json) { + final dynamicRegistration = json['dynamicRegistration']; + final rangeLimit = json['rangeLimit']; + final lineFoldingOnly = json['lineFoldingOnly']; + return FoldingRangeClientCapabilities( + dynamicRegistration, rangeLimit, lineFoldingOnly); + } + + /// Whether implementation supports dynamic registration for folding range + /// providers. If this is set to `true` the client supports the new + /// `FoldingRangeRegistrationOptions` return value for the corresponding + /// server capability as well. + final bool dynamicRegistration; + + /// If set, the client signals that it only supports folding complete lines. + /// If set, client will ignore specified `startCharacter` and `endCharacter` + /// properties in a FoldingRange. + final bool lineFoldingOnly; + + /// The maximum number of folding ranges that the client prefers to receive + /// per document. The value serves as a hint, servers are free to follow the + /// limit. + final num rangeLimit; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + if (rangeLimit != null) { + __result['rangeLimit'] = rangeLimit; + } + if (lineFoldingOnly != null) { + __result['lineFoldingOnly'] = lineFoldingOnly; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('rangeLimit'); + try { + if (obj['rangeLimit'] != null && !(obj['rangeLimit'] is num)) { + reporter.reportError('must be of type num'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('lineFoldingOnly'); + try { + if (obj['lineFoldingOnly'] != null && + !(obj['lineFoldingOnly'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type FoldingRangeClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is FoldingRangeClientCapabilities && + other.runtimeType == FoldingRangeClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && + rangeLimit == other.rangeLimit && + lineFoldingOnly == other.lineFoldingOnly && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + hash = JenkinsSmiHash.combine(hash, rangeLimit.hashCode); + hash = JenkinsSmiHash.combine(hash, lineFoldingOnly.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + /// Enum of known range kinds class FoldingRangeKind { const FoldingRangeKind(this._value); @@ -6836,11 +11578,75 @@ class FoldingRangeKind { bool operator ==(Object o) => o is FoldingRangeKind && o._value == _value; } -class FoldingRangeParams implements ToJsonable { +class FoldingRangeOptions implements WorkDoneProgressOptions, ToJsonable { + static const jsonHandler = LspJsonHandler( + FoldingRangeOptions.canParse, FoldingRangeOptions.fromJson); + + FoldingRangeOptions(this.workDoneProgress); + static FoldingRangeOptions fromJson(Map json) { + if (FoldingRangeRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return FoldingRangeRegistrationOptions.fromJson(json); + } + final workDoneProgress = json['workDoneProgress']; + return FoldingRangeOptions(workDoneProgress); + } + + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type FoldingRangeOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is FoldingRangeOptions && + other.runtimeType == FoldingRangeOptions) { + return workDoneProgress == other.workDoneProgress && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class FoldingRangeParams + implements WorkDoneProgressParams, PartialResultParams, ToJsonable { static const jsonHandler = LspJsonHandler(FoldingRangeParams.canParse, FoldingRangeParams.fromJson); - FoldingRangeParams(this.textDocument) { + FoldingRangeParams( + this.textDocument, this.workDoneToken, this.partialResultToken) { if (textDocument == null) { throw 'textDocument is required but was not provided'; } @@ -6849,16 +11655,43 @@ class FoldingRangeParams implements ToJsonable { final textDocument = json['textDocument'] != null ? TextDocumentIdentifier.fromJson(json['textDocument']) : null; - return FoldingRangeParams(textDocument); + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + final partialResultToken = json['partialResultToken'] is num + ? Either2.t1(json['partialResultToken']) + : (json['partialResultToken'] is String + ? Either2.t2(json['partialResultToken']) + : (json['partialResultToken'] == null + ? null + : (throw '''${json['partialResultToken']} was not one of (num, String)'''))); + return FoldingRangeParams(textDocument, workDoneToken, partialResultToken); } + /// An optional token that a server can use to report partial results (e.g. + /// streaming) to the client. + final Either2 partialResultToken; + /// The text document. final TextDocumentIdentifier textDocument; + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + Map toJson() { var __result = {}; __result['textDocument'] = textDocument ?? (throw 'textDocument is required but was not set'); + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } + if (partialResultToken != null) { + __result['partialResultToken'] = partialResultToken; + } return __result; } @@ -6881,6 +11714,28 @@ class FoldingRangeParams implements ToJsonable { } finally { reporter.pop(); } + reporter.push('workDoneToken'); + try { + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('partialResultToken'); + try { + if (obj['partialResultToken'] != null && + !((obj['partialResultToken'] is num || + obj['partialResultToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type FoldingRangeParams'); @@ -6892,7 +11747,10 @@ class FoldingRangeParams implements ToJsonable { bool operator ==(Object other) { if (other is FoldingRangeParams && other.runtimeType == FoldingRangeParams) { - return textDocument == other.textDocument && true; + return textDocument == other.textDocument && + workDoneToken == other.workDoneToken && + partialResultToken == other.partialResultToken && + true; } return false; } @@ -6901,6 +11759,8 @@ class FoldingRangeParams implements ToJsonable { int get hashCode { var hash = 0; hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); + hash = JenkinsSmiHash.combine(hash, partialResultToken.hashCode); return JenkinsSmiHash.finish(hash); } @@ -6908,35 +11768,103 @@ class FoldingRangeParams implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -/// Folding range provider options. -class FoldingRangeProviderOptions implements ToJsonable { +class FoldingRangeRegistrationOptions + implements + TextDocumentRegistrationOptions, + FoldingRangeOptions, + StaticRegistrationOptions, + ToJsonable { static const jsonHandler = LspJsonHandler( - FoldingRangeProviderOptions.canParse, - FoldingRangeProviderOptions.fromJson); + FoldingRangeRegistrationOptions.canParse, + FoldingRangeRegistrationOptions.fromJson); - static FoldingRangeProviderOptions fromJson(Map json) { - return FoldingRangeProviderOptions(); + FoldingRangeRegistrationOptions( + this.documentSelector, this.workDoneProgress, this.id); + static FoldingRangeRegistrationOptions fromJson(Map json) { + final documentSelector = json['documentSelector'] + ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) + ?.cast() + ?.toList(); + final workDoneProgress = json['workDoneProgress']; + final id = json['id']; + return FoldingRangeRegistrationOptions( + documentSelector, workDoneProgress, id); } + /// 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. + final List documentSelector; + + /// The id used to register the request. The id can be used to deregister the + /// request again. See also Registration#id. + final String id; + final bool workDoneProgress; + Map toJson() { var __result = {}; + __result['documentSelector'] = documentSelector; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + if (id != null) { + __result['id'] = id; + } return __result; } static bool canParse(Object obj, LspJsonReporter reporter) { if (obj is Map) { + reporter.push('documentSelector'); + try { + if (!obj.containsKey('documentSelector')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['documentSelector'] != null && + !((obj['documentSelector'] is List && + (obj['documentSelector'].every( + (item) => DocumentFilter.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('id'); + try { + if (obj['id'] != null && !(obj['id'] is String)) { + reporter.reportError('must be of type String'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { - reporter.reportError('must be of type FoldingRangeProviderOptions'); + reporter.reportError('must be of type FoldingRangeRegistrationOptions'); return false; } } @override bool operator ==(Object other) { - if (other is FoldingRangeProviderOptions && - other.runtimeType == FoldingRangeProviderOptions) { - return true; + if (other is FoldingRangeRegistrationOptions && + other.runtimeType == FoldingRangeRegistrationOptions) { + return listEqual(documentSelector, other.documentSelector, + (DocumentFilter a, DocumentFilter b) => a == b) && + workDoneProgress == other.workDoneProgress && + id == other.id && + true; } return false; } @@ -6944,6 +11872,9 @@ class FoldingRangeProviderOptions implements ToJsonable { @override int get hashCode { var hash = 0; + hash = JenkinsSmiHash.combine(hash, lspHashCode(documentSelector)); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + hash = JenkinsSmiHash.combine(hash, id.hashCode); return JenkinsSmiHash.finish(hash); } @@ -6956,7 +11887,12 @@ class FormattingOptions implements ToJsonable { static const jsonHandler = LspJsonHandler(FormattingOptions.canParse, FormattingOptions.fromJson); - FormattingOptions(this.tabSize, this.insertSpaces) { + FormattingOptions( + this.tabSize, + this.insertSpaces, + this.trimTrailingWhitespace, + this.insertFinalNewline, + this.trimFinalNewlines) { if (tabSize == null) { throw 'tabSize is required but was not provided'; } @@ -6967,21 +11903,46 @@ class FormattingOptions implements ToJsonable { static FormattingOptions fromJson(Map json) { final tabSize = json['tabSize']; final insertSpaces = json['insertSpaces']; - return FormattingOptions(tabSize, insertSpaces); + final trimTrailingWhitespace = json['trimTrailingWhitespace']; + final insertFinalNewline = json['insertFinalNewline']; + final trimFinalNewlines = json['trimFinalNewlines']; + return FormattingOptions(tabSize, insertSpaces, trimTrailingWhitespace, + insertFinalNewline, trimFinalNewlines); } + /// Insert a newline character at the end of the file if one does not exist. + /// @since 3.15.0 + final bool insertFinalNewline; + /// Prefer spaces over tabs. final bool insertSpaces; /// Size of a tab in spaces. final num tabSize; + /// Trim all newlines after the final newline at the end of the file. + /// @since 3.15.0 + final bool trimFinalNewlines; + + /// Trim trailing whitespace on a line. + /// @since 3.15.0 + final bool trimTrailingWhitespace; + Map toJson() { var __result = {}; __result['tabSize'] = tabSize ?? (throw 'tabSize is required but was not set'); __result['insertSpaces'] = insertSpaces ?? (throw 'insertSpaces is required but was not set'); + if (trimTrailingWhitespace != null) { + __result['trimTrailingWhitespace'] = trimTrailingWhitespace; + } + if (insertFinalNewline != null) { + __result['insertFinalNewline'] = insertFinalNewline; + } + if (trimFinalNewlines != null) { + __result['trimFinalNewlines'] = trimFinalNewlines; + } return __result; } @@ -7021,6 +11982,36 @@ class FormattingOptions implements ToJsonable { } finally { reporter.pop(); } + reporter.push('trimTrailingWhitespace'); + try { + if (obj['trimTrailingWhitespace'] != null && + !(obj['trimTrailingWhitespace'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('insertFinalNewline'); + try { + if (obj['insertFinalNewline'] != null && + !(obj['insertFinalNewline'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('trimFinalNewlines'); + try { + if (obj['trimFinalNewlines'] != null && + !(obj['trimFinalNewlines'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type FormattingOptions'); @@ -7033,6 +12024,9 @@ class FormattingOptions implements ToJsonable { if (other is FormattingOptions && other.runtimeType == FormattingOptions) { return tabSize == other.tabSize && insertSpaces == other.insertSpaces && + trimTrailingWhitespace == other.trimTrailingWhitespace && + insertFinalNewline == other.insertFinalNewline && + trimFinalNewlines == other.trimFinalNewlines && true; } return false; @@ -7043,6 +12037,9 @@ class FormattingOptions implements ToJsonable { var hash = 0; hash = JenkinsSmiHash.combine(hash, tabSize.hashCode); hash = JenkinsSmiHash.combine(hash, insertSpaces.hashCode); + hash = JenkinsSmiHash.combine(hash, trimTrailingWhitespace.hashCode); + hash = JenkinsSmiHash.combine(hash, insertFinalNewline.hashCode); + hash = JenkinsSmiHash.combine(hash, trimFinalNewlines.hashCode); return JenkinsSmiHash.finish(hash); } @@ -7145,24 +12142,814 @@ class Hover implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -class InitializeParams implements ToJsonable { +class HoverClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + HoverClientCapabilities.canParse, HoverClientCapabilities.fromJson); + + HoverClientCapabilities(this.dynamicRegistration, this.contentFormat); + static HoverClientCapabilities fromJson(Map json) { + final dynamicRegistration = json['dynamicRegistration']; + final contentFormat = json['contentFormat'] + ?.map((item) => item != null ? MarkupKind.fromJson(item) : null) + ?.cast() + ?.toList(); + return HoverClientCapabilities(dynamicRegistration, contentFormat); + } + + /// Client supports the follow content formats for the content property. The + /// order describes the preferred format of the client. + final List contentFormat; + + /// Whether hover supports dynamic registration. + final bool dynamicRegistration; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + if (contentFormat != null) { + __result['contentFormat'] = contentFormat; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('contentFormat'); + try { + if (obj['contentFormat'] != null && + !((obj['contentFormat'] is List && + (obj['contentFormat'] + .every((item) => MarkupKind.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type HoverClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is HoverClientCapabilities && + other.runtimeType == HoverClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && + listEqual(contentFormat, other.contentFormat, + (MarkupKind a, MarkupKind b) => a == b) && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + hash = JenkinsSmiHash.combine(hash, lspHashCode(contentFormat)); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class HoverOptions implements WorkDoneProgressOptions, ToJsonable { + static const jsonHandler = + LspJsonHandler(HoverOptions.canParse, HoverOptions.fromJson); + + HoverOptions(this.workDoneProgress); + static HoverOptions fromJson(Map json) { + if (HoverRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return HoverRegistrationOptions.fromJson(json); + } + final workDoneProgress = json['workDoneProgress']; + return HoverOptions(workDoneProgress); + } + + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type HoverOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is HoverOptions && other.runtimeType == HoverOptions) { + return workDoneProgress == other.workDoneProgress && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class HoverParams + implements TextDocumentPositionParams, WorkDoneProgressParams, ToJsonable { + static const jsonHandler = + LspJsonHandler(HoverParams.canParse, HoverParams.fromJson); + + HoverParams(this.textDocument, this.position, this.workDoneToken) { + if (textDocument == null) { + throw 'textDocument is required but was not provided'; + } + if (position == null) { + throw 'position is required but was not provided'; + } + } + static HoverParams fromJson(Map json) { + final textDocument = json['textDocument'] != null + ? TextDocumentIdentifier.fromJson(json['textDocument']) + : null; + final position = + json['position'] != null ? Position.fromJson(json['position']) : null; + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + return HoverParams(textDocument, position, workDoneToken); + } + + /// The position inside the text document. + final Position position; + + /// The text document. + final TextDocumentIdentifier textDocument; + + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + + Map toJson() { + var __result = {}; + __result['textDocument'] = + textDocument ?? (throw 'textDocument is required but was not set'); + __result['position'] = + position ?? (throw 'position is required but was not set'); + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('textDocument'); + try { + if (!obj.containsKey('textDocument')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['textDocument'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) { + reporter.reportError('must be of type TextDocumentIdentifier'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('position'); + try { + if (!obj.containsKey('position')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['position'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(Position.canParse(obj['position'], reporter))) { + reporter.reportError('must be of type Position'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneToken'); + try { + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type HoverParams'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is HoverParams && other.runtimeType == HoverParams) { + return textDocument == other.textDocument && + position == other.position && + workDoneToken == other.workDoneToken && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); + hash = JenkinsSmiHash.combine(hash, position.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class HoverRegistrationOptions + implements TextDocumentRegistrationOptions, HoverOptions, ToJsonable { + static const jsonHandler = LspJsonHandler( + HoverRegistrationOptions.canParse, HoverRegistrationOptions.fromJson); + + HoverRegistrationOptions(this.documentSelector, this.workDoneProgress); + static HoverRegistrationOptions fromJson(Map json) { + final documentSelector = json['documentSelector'] + ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) + ?.cast() + ?.toList(); + final workDoneProgress = json['workDoneProgress']; + return HoverRegistrationOptions(documentSelector, workDoneProgress); + } + + /// 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. + final List documentSelector; + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + __result['documentSelector'] = documentSelector; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('documentSelector'); + try { + if (!obj.containsKey('documentSelector')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['documentSelector'] != null && + !((obj['documentSelector'] is List && + (obj['documentSelector'].every( + (item) => DocumentFilter.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type HoverRegistrationOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is HoverRegistrationOptions && + other.runtimeType == HoverRegistrationOptions) { + return listEqual(documentSelector, other.documentSelector, + (DocumentFilter a, DocumentFilter b) => a == b) && + workDoneProgress == other.workDoneProgress && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, lspHashCode(documentSelector)); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class ImplementationClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + ImplementationClientCapabilities.canParse, + ImplementationClientCapabilities.fromJson); + + ImplementationClientCapabilities(this.dynamicRegistration, this.linkSupport); + static ImplementationClientCapabilities fromJson(Map json) { + final dynamicRegistration = json['dynamicRegistration']; + final linkSupport = json['linkSupport']; + return ImplementationClientCapabilities(dynamicRegistration, linkSupport); + } + + /// Whether implementation supports dynamic registration. If this is set to + /// `true` the client supports the new `ImplementationRegistrationOptions` + /// return value for the corresponding server capability as well. + final bool dynamicRegistration; + + /// The client supports additional metadata in the form of definition links. + /// @since 3.14.0 + final bool linkSupport; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + if (linkSupport != null) { + __result['linkSupport'] = linkSupport; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('linkSupport'); + try { + if (obj['linkSupport'] != null && !(obj['linkSupport'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type ImplementationClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is ImplementationClientCapabilities && + other.runtimeType == ImplementationClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && + linkSupport == other.linkSupport && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + hash = JenkinsSmiHash.combine(hash, linkSupport.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class ImplementationOptions implements WorkDoneProgressOptions, ToJsonable { + static const jsonHandler = LspJsonHandler( + ImplementationOptions.canParse, ImplementationOptions.fromJson); + + ImplementationOptions(this.workDoneProgress); + static ImplementationOptions fromJson(Map json) { + if (ImplementationRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return ImplementationRegistrationOptions.fromJson(json); + } + final workDoneProgress = json['workDoneProgress']; + return ImplementationOptions(workDoneProgress); + } + + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type ImplementationOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is ImplementationOptions && + other.runtimeType == ImplementationOptions) { + return workDoneProgress == other.workDoneProgress && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class ImplementationParams + implements + TextDocumentPositionParams, + WorkDoneProgressParams, + PartialResultParams, + ToJsonable { + static const jsonHandler = LspJsonHandler( + ImplementationParams.canParse, ImplementationParams.fromJson); + + ImplementationParams(this.textDocument, this.position, this.workDoneToken, + this.partialResultToken) { + if (textDocument == null) { + throw 'textDocument is required but was not provided'; + } + if (position == null) { + throw 'position is required but was not provided'; + } + } + static ImplementationParams fromJson(Map json) { + final textDocument = json['textDocument'] != null + ? TextDocumentIdentifier.fromJson(json['textDocument']) + : null; + final position = + json['position'] != null ? Position.fromJson(json['position']) : null; + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + final partialResultToken = json['partialResultToken'] is num + ? Either2.t1(json['partialResultToken']) + : (json['partialResultToken'] is String + ? Either2.t2(json['partialResultToken']) + : (json['partialResultToken'] == null + ? null + : (throw '''${json['partialResultToken']} was not one of (num, String)'''))); + return ImplementationParams( + textDocument, position, workDoneToken, partialResultToken); + } + + /// An optional token that a server can use to report partial results (e.g. + /// streaming) to the client. + final Either2 partialResultToken; + + /// The position inside the text document. + final Position position; + + /// The text document. + final TextDocumentIdentifier textDocument; + + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + + Map toJson() { + var __result = {}; + __result['textDocument'] = + textDocument ?? (throw 'textDocument is required but was not set'); + __result['position'] = + position ?? (throw 'position is required but was not set'); + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } + if (partialResultToken != null) { + __result['partialResultToken'] = partialResultToken; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('textDocument'); + try { + if (!obj.containsKey('textDocument')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['textDocument'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) { + reporter.reportError('must be of type TextDocumentIdentifier'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('position'); + try { + if (!obj.containsKey('position')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['position'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(Position.canParse(obj['position'], reporter))) { + reporter.reportError('must be of type Position'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneToken'); + try { + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('partialResultToken'); + try { + if (obj['partialResultToken'] != null && + !((obj['partialResultToken'] is num || + obj['partialResultToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type ImplementationParams'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is ImplementationParams && + other.runtimeType == ImplementationParams) { + return textDocument == other.textDocument && + position == other.position && + workDoneToken == other.workDoneToken && + partialResultToken == other.partialResultToken && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); + hash = JenkinsSmiHash.combine(hash, position.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); + hash = JenkinsSmiHash.combine(hash, partialResultToken.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class ImplementationRegistrationOptions + implements + TextDocumentRegistrationOptions, + ImplementationOptions, + StaticRegistrationOptions, + ToJsonable { + static const jsonHandler = LspJsonHandler( + ImplementationRegistrationOptions.canParse, + ImplementationRegistrationOptions.fromJson); + + ImplementationRegistrationOptions( + this.documentSelector, this.workDoneProgress, this.id); + static ImplementationRegistrationOptions fromJson(Map json) { + final documentSelector = json['documentSelector'] + ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) + ?.cast() + ?.toList(); + final workDoneProgress = json['workDoneProgress']; + final id = json['id']; + return ImplementationRegistrationOptions( + documentSelector, workDoneProgress, id); + } + + /// 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. + final List documentSelector; + + /// The id used to register the request. The id can be used to deregister the + /// request again. See also Registration#id. + final String id; + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + __result['documentSelector'] = documentSelector; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + if (id != null) { + __result['id'] = id; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('documentSelector'); + try { + if (!obj.containsKey('documentSelector')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['documentSelector'] != null && + !((obj['documentSelector'] is List && + (obj['documentSelector'].every( + (item) => DocumentFilter.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('id'); + try { + if (obj['id'] != null && !(obj['id'] is String)) { + reporter.reportError('must be of type String'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type ImplementationRegistrationOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is ImplementationRegistrationOptions && + other.runtimeType == ImplementationRegistrationOptions) { + return listEqual(documentSelector, other.documentSelector, + (DocumentFilter a, DocumentFilter b) => a == b) && + workDoneProgress == other.workDoneProgress && + id == other.id && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, lspHashCode(documentSelector)); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + hash = JenkinsSmiHash.combine(hash, id.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class InitializeParams implements WorkDoneProgressParams, ToJsonable { static const jsonHandler = LspJsonHandler(InitializeParams.canParse, InitializeParams.fromJson); InitializeParams( this.processId, + this.clientInfo, this.rootPath, this.rootUri, this.initializationOptions, this.capabilities, this.trace, - this.workspaceFolders) { + this.workspaceFolders, + this.workDoneToken) { if (capabilities == null) { throw 'capabilities is required but was not provided'; } } static InitializeParams fromJson(Map json) { final processId = json['processId']; + final clientInfo = json['clientInfo'] != null + ? InitializeParamsClientInfo.fromJson(json['clientInfo']) + : null; final rootPath = json['rootPath']; final rootUri = json['rootUri']; final initializationOptions = json['initializationOptions']; @@ -7174,13 +12961,32 @@ class InitializeParams implements ToJsonable { ?.map((item) => item != null ? WorkspaceFolder.fromJson(item) : null) ?.cast() ?.toList(); - return InitializeParams(processId, rootPath, rootUri, initializationOptions, - capabilities, trace, workspaceFolders); + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + return InitializeParams( + processId, + clientInfo, + rootPath, + rootUri, + initializationOptions, + capabilities, + trace, + workspaceFolders, + workDoneToken); } /// The capabilities provided by the client (editor or tool) final ClientCapabilities capabilities; + /// Information about the client + /// @since 3.15.0 + final InitializeParamsClientInfo clientInfo; + /// User provided initialization options. final dynamic initializationOptions; @@ -7202,17 +13008,22 @@ class InitializeParams implements ToJsonable { /// The initial trace setting. If omitted trace is disabled ('off'). final String trace; + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + /// The workspace folders configured in the client when the server starts. /// This property is only available if the client supports workspace folders. /// It can be `null` if the client supports workspace folders but none are /// configured. - /// - /// Since 3.6.0 + /// @since 3.6.0 final List workspaceFolders; Map toJson() { var __result = {}; __result['processId'] = processId; + if (clientInfo != null) { + __result['clientInfo'] = clientInfo; + } if (rootPath != null) { __result['rootPath'] = rootPath; } @@ -7228,6 +13039,9 @@ class InitializeParams implements ToJsonable { if (workspaceFolders != null) { __result['workspaceFolders'] = workspaceFolders; } + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } return __result; } @@ -7246,6 +13060,17 @@ class InitializeParams implements ToJsonable { } finally { reporter.pop(); } + reporter.push('clientInfo'); + try { + if (obj['clientInfo'] != null && + !(InitializeParamsClientInfo.canParse( + obj['clientInfo'], reporter))) { + reporter.reportError('must be of type InitializeParamsClientInfo'); + return false; + } + } finally { + reporter.pop(); + } reporter.push('rootPath'); try { if (obj['rootPath'] != null && !(obj['rootPath'] is String)) { @@ -7315,6 +13140,17 @@ class InitializeParams implements ToJsonable { } finally { reporter.pop(); } + reporter.push('workDoneToken'); + try { + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type InitializeParams'); @@ -7326,6 +13162,7 @@ class InitializeParams implements ToJsonable { bool operator ==(Object other) { if (other is InitializeParams && other.runtimeType == InitializeParams) { return processId == other.processId && + clientInfo == other.clientInfo && rootPath == other.rootPath && rootUri == other.rootUri && initializationOptions == other.initializationOptions && @@ -7333,6 +13170,7 @@ class InitializeParams implements ToJsonable { trace == other.trace && listEqual(workspaceFolders, other.workspaceFolders, (WorkspaceFolder a, WorkspaceFolder b) => a == b) && + workDoneToken == other.workDoneToken && true; } return false; @@ -7342,12 +13180,100 @@ class InitializeParams implements ToJsonable { int get hashCode { var hash = 0; hash = JenkinsSmiHash.combine(hash, processId.hashCode); + hash = JenkinsSmiHash.combine(hash, clientInfo.hashCode); hash = JenkinsSmiHash.combine(hash, rootPath.hashCode); hash = JenkinsSmiHash.combine(hash, rootUri.hashCode); hash = JenkinsSmiHash.combine(hash, initializationOptions.hashCode); hash = JenkinsSmiHash.combine(hash, capabilities.hashCode); hash = JenkinsSmiHash.combine(hash, trace.hashCode); hash = JenkinsSmiHash.combine(hash, lspHashCode(workspaceFolders)); + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class InitializeParamsClientInfo implements ToJsonable { + static const jsonHandler = LspJsonHandler( + InitializeParamsClientInfo.canParse, InitializeParamsClientInfo.fromJson); + + InitializeParamsClientInfo(this.name, this.version) { + if (name == null) { + throw 'name is required but was not provided'; + } + } + static InitializeParamsClientInfo fromJson(Map json) { + final name = json['name']; + final version = json['version']; + return InitializeParamsClientInfo(name, version); + } + + /// The name of the client as defined by the client. + final String name; + + /// The client's version as defined by the client. + final String version; + + Map toJson() { + var __result = {}; + __result['name'] = name ?? (throw 'name is required but was not set'); + if (version != null) { + __result['version'] = version; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('name'); + try { + if (!obj.containsKey('name')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['name'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(obj['name'] is String)) { + reporter.reportError('must be of type String'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('version'); + try { + if (obj['version'] != null && !(obj['version'] is String)) { + reporter.reportError('must be of type String'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type InitializeParamsClientInfo'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is InitializeParamsClientInfo && + other.runtimeType == InitializeParamsClientInfo) { + return name == other.name && version == other.version && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, name.hashCode); + hash = JenkinsSmiHash.combine(hash, version.hashCode); return JenkinsSmiHash.finish(hash); } @@ -7359,7 +13285,7 @@ class InitializeResult implements ToJsonable { static const jsonHandler = LspJsonHandler(InitializeResult.canParse, InitializeResult.fromJson); - InitializeResult(this.capabilities) { + InitializeResult(this.capabilities, this.serverInfo) { if (capabilities == null) { throw 'capabilities is required but was not provided'; } @@ -7368,16 +13294,26 @@ class InitializeResult implements ToJsonable { final capabilities = json['capabilities'] != null ? ServerCapabilities.fromJson(json['capabilities']) : null; - return InitializeResult(capabilities); + final serverInfo = json['serverInfo'] != null + ? InitializeResultServerInfo.fromJson(json['serverInfo']) + : null; + return InitializeResult(capabilities, serverInfo); } /// The capabilities the language server provides. final ServerCapabilities capabilities; + /// Information about the server. + /// @since 3.15.0 + final InitializeResultServerInfo serverInfo; + Map toJson() { var __result = {}; __result['capabilities'] = capabilities ?? (throw 'capabilities is required but was not set'); + if (serverInfo != null) { + __result['serverInfo'] = serverInfo; + } return __result; } @@ -7400,6 +13336,17 @@ class InitializeResult implements ToJsonable { } finally { reporter.pop(); } + reporter.push('serverInfo'); + try { + if (obj['serverInfo'] != null && + !(InitializeResultServerInfo.canParse( + obj['serverInfo'], reporter))) { + reporter.reportError('must be of type InitializeResultServerInfo'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type InitializeResult'); @@ -7410,7 +13357,9 @@ class InitializeResult implements ToJsonable { @override bool operator ==(Object other) { if (other is InitializeResult && other.runtimeType == InitializeResult) { - return capabilities == other.capabilities && true; + return capabilities == other.capabilities && + serverInfo == other.serverInfo && + true; } return false; } @@ -7419,6 +13368,93 @@ class InitializeResult implements ToJsonable { int get hashCode { var hash = 0; hash = JenkinsSmiHash.combine(hash, capabilities.hashCode); + hash = JenkinsSmiHash.combine(hash, serverInfo.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class InitializeResultServerInfo implements ToJsonable { + static const jsonHandler = LspJsonHandler( + InitializeResultServerInfo.canParse, InitializeResultServerInfo.fromJson); + + InitializeResultServerInfo(this.name, this.version) { + if (name == null) { + throw 'name is required but was not provided'; + } + } + static InitializeResultServerInfo fromJson(Map json) { + final name = json['name']; + final version = json['version']; + return InitializeResultServerInfo(name, version); + } + + /// The name of the server as defined by the server. + final String name; + + /// The server's version as defined by the server. + final String version; + + Map toJson() { + var __result = {}; + __result['name'] = name ?? (throw 'name is required but was not set'); + if (version != null) { + __result['version'] = version; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('name'); + try { + if (!obj.containsKey('name')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['name'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(obj['name'] is String)) { + reporter.reportError('must be of type String'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('version'); + try { + if (obj['version'] != null && !(obj['version'] is String)) { + reporter.reportError('must be of type String'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type InitializeResultServerInfo'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is InitializeResultServerInfo && + other.runtimeType == InitializeResultServerInfo) { + return name == other.name && version == other.version && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, name.hashCode); + hash = JenkinsSmiHash.combine(hash, version.hashCode); return JenkinsSmiHash.finish(hash); } @@ -8198,6 +14234,9 @@ class Method { /// Constant for the '$/cancelRequest' method. static const cancelRequest = Method(r'$/cancelRequest'); + /// Constant for the '$/progress' method. + static const progress = Method(r'$/progress'); + /// Constant for the 'initialize' method. static const initialize = Method(r'initialize'); @@ -8219,6 +14258,14 @@ class Method { /// Constant for the 'window/logMessage' method. static const window_logMessage = Method(r'window/logMessage'); + /// Constant for the 'window/workDoneProgress/create' method. + static const window_workDoneProgress_create = + Method(r'window/workDoneProgress/create'); + + /// Constant for the 'window/workDoneProgress/cancel' method. + static const window_workDoneProgress_cancel = + Method(r'window/workDoneProgress/cancel'); + /// Constant for the 'telemetry/event' method. static const telemetry_event = Method(r'telemetry/event'); @@ -8270,6 +14317,9 @@ class Method { static const textDocument_willSaveWaitUntil = Method(r'textDocument/willSaveWaitUntil'); + /// Constant for the 'textDocument/didSave' method. + static const textDocument_didSave = Method(r'textDocument/didSave'); + /// Constant for the 'textDocument/didClose' method. static const textDocument_didClose = Method(r'textDocument/didClose'); @@ -8359,6 +14409,10 @@ class Method { /// Constant for the 'textDocument/foldingRange' method. static const textDocument_foldingRange = Method(r'textDocument/foldingRange'); + /// Constant for the 'textDocument/selectionRange' method. + static const textDocument_selectionRange = + Method(r'textDocument/selectionRange'); + Object toJson() => _value; @override @@ -8597,6 +14651,122 @@ class ParameterInformation implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } +class PartialResultParams implements ToJsonable { + static const jsonHandler = LspJsonHandler( + PartialResultParams.canParse, PartialResultParams.fromJson); + + PartialResultParams(this.partialResultToken); + static PartialResultParams fromJson(Map json) { + if (WorkspaceSymbolParams.canParse(json, nullLspJsonReporter)) { + return WorkspaceSymbolParams.fromJson(json); + } + if (CompletionParams.canParse(json, nullLspJsonReporter)) { + return CompletionParams.fromJson(json); + } + if (DeclarationParams.canParse(json, nullLspJsonReporter)) { + return DeclarationParams.fromJson(json); + } + if (DefinitionParams.canParse(json, nullLspJsonReporter)) { + return DefinitionParams.fromJson(json); + } + if (TypeDefinitionParams.canParse(json, nullLspJsonReporter)) { + return TypeDefinitionParams.fromJson(json); + } + if (ImplementationParams.canParse(json, nullLspJsonReporter)) { + return ImplementationParams.fromJson(json); + } + if (ReferenceParams.canParse(json, nullLspJsonReporter)) { + return ReferenceParams.fromJson(json); + } + if (DocumentHighlightParams.canParse(json, nullLspJsonReporter)) { + return DocumentHighlightParams.fromJson(json); + } + if (DocumentSymbolParams.canParse(json, nullLspJsonReporter)) { + return DocumentSymbolParams.fromJson(json); + } + if (CodeActionParams.canParse(json, nullLspJsonReporter)) { + return CodeActionParams.fromJson(json); + } + if (CodeLensParams.canParse(json, nullLspJsonReporter)) { + return CodeLensParams.fromJson(json); + } + if (DocumentLinkParams.canParse(json, nullLspJsonReporter)) { + return DocumentLinkParams.fromJson(json); + } + if (DocumentColorParams.canParse(json, nullLspJsonReporter)) { + return DocumentColorParams.fromJson(json); + } + if (ColorPresentationParams.canParse(json, nullLspJsonReporter)) { + return ColorPresentationParams.fromJson(json); + } + if (FoldingRangeParams.canParse(json, nullLspJsonReporter)) { + return FoldingRangeParams.fromJson(json); + } + if (SelectionRangeParams.canParse(json, nullLspJsonReporter)) { + return SelectionRangeParams.fromJson(json); + } + final partialResultToken = json['partialResultToken'] is num + ? Either2.t1(json['partialResultToken']) + : (json['partialResultToken'] is String + ? Either2.t2(json['partialResultToken']) + : (json['partialResultToken'] == null + ? null + : (throw '''${json['partialResultToken']} was not one of (num, String)'''))); + return PartialResultParams(partialResultToken); + } + + /// An optional token that a server can use to report partial results (e.g. + /// streaming) to the client. + final Either2 partialResultToken; + + Map toJson() { + var __result = {}; + if (partialResultToken != null) { + __result['partialResultToken'] = partialResultToken; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('partialResultToken'); + try { + if (obj['partialResultToken'] != null && + !((obj['partialResultToken'] is num || + obj['partialResultToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type PartialResultParams'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is PartialResultParams && + other.runtimeType == PartialResultParams) { + return partialResultToken == other.partialResultToken && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, partialResultToken.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + class Position implements ToJsonable { static const jsonHandler = LspJsonHandler(Position.canParse, Position.fromJson); @@ -8697,11 +14867,403 @@ class Position implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } +class PrepareRenameParams implements TextDocumentPositionParams, ToJsonable { + static const jsonHandler = LspJsonHandler( + PrepareRenameParams.canParse, PrepareRenameParams.fromJson); + + PrepareRenameParams(this.textDocument, this.position) { + if (textDocument == null) { + throw 'textDocument is required but was not provided'; + } + if (position == null) { + throw 'position is required but was not provided'; + } + } + static PrepareRenameParams fromJson(Map json) { + final textDocument = json['textDocument'] != null + ? TextDocumentIdentifier.fromJson(json['textDocument']) + : null; + final position = + json['position'] != null ? Position.fromJson(json['position']) : null; + return PrepareRenameParams(textDocument, position); + } + + /// The position inside the text document. + final Position position; + + /// The text document. + final TextDocumentIdentifier textDocument; + + Map toJson() { + var __result = {}; + __result['textDocument'] = + textDocument ?? (throw 'textDocument is required but was not set'); + __result['position'] = + position ?? (throw 'position is required but was not set'); + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('textDocument'); + try { + if (!obj.containsKey('textDocument')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['textDocument'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) { + reporter.reportError('must be of type TextDocumentIdentifier'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('position'); + try { + if (!obj.containsKey('position')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['position'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(Position.canParse(obj['position'], reporter))) { + reporter.reportError('must be of type Position'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type PrepareRenameParams'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is PrepareRenameParams && + other.runtimeType == PrepareRenameParams) { + return textDocument == other.textDocument && + position == other.position && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); + hash = JenkinsSmiHash.combine(hash, position.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class ProgressParams implements ToJsonable { + static const jsonHandler = + LspJsonHandler(ProgressParams.canParse, ProgressParams.fromJson); + + ProgressParams(this.token, this.value) { + if (token == null) { + throw 'token is required but was not provided'; + } + if (value == null) { + throw 'value is required but was not provided'; + } + } + static ProgressParams fromJson(Map json) { + final token = json['token'] is num + ? Either2.t1(json['token']) + : (json['token'] is String + ? Either2.t2(json['token']) + : (throw '''${json['token']} was not one of (num, String)''')); + final value = json['value']; + return ProgressParams(token, value); + } + + /// The progress token provided by the client or server. + final Either2 token; + + /// The progress data. + final T value; + + Map toJson() { + var __result = {}; + __result['token'] = token ?? (throw 'token is required but was not set'); + __result['value'] = value ?? (throw 'value is required but was not set'); + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('token'); + try { + if (!obj.containsKey('token')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['token'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!((obj['token'] is num || obj['token'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('value'); + try { + if (!obj.containsKey('value')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['value'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(true /* T.canParse(obj['value']) */)) { + reporter.reportError('must be of type T'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type ProgressParams'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is ProgressParams && other.runtimeType == ProgressParams) { + return token == other.token && value == other.value && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, token.hashCode); + hash = JenkinsSmiHash.combine(hash, value.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class PublishDiagnosticsClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + PublishDiagnosticsClientCapabilities.canParse, + PublishDiagnosticsClientCapabilities.fromJson); + + PublishDiagnosticsClientCapabilities( + this.relatedInformation, this.tagSupport, this.versionSupport); + static PublishDiagnosticsClientCapabilities fromJson( + Map json) { + final relatedInformation = json['relatedInformation']; + final tagSupport = json['tagSupport'] != null + ? PublishDiagnosticsClientCapabilitiesTagSupport.fromJson( + json['tagSupport']) + : null; + final versionSupport = json['versionSupport']; + return PublishDiagnosticsClientCapabilities( + relatedInformation, tagSupport, versionSupport); + } + + /// Whether the clients accepts diagnostics with related information. + final bool relatedInformation; + + /// Client supports the tag property to provide meta data about a diagnostic. + /// Clients supporting tags have to handle unknown tags gracefully. + /// @since 3.15.0 + final PublishDiagnosticsClientCapabilitiesTagSupport tagSupport; + + /// Whether the client interprets the version property of the + /// `textDocument/publishDiagnostics` notification's parameter. + /// @since 3.15.0 + final bool versionSupport; + + Map toJson() { + var __result = {}; + if (relatedInformation != null) { + __result['relatedInformation'] = relatedInformation; + } + if (tagSupport != null) { + __result['tagSupport'] = tagSupport; + } + if (versionSupport != null) { + __result['versionSupport'] = versionSupport; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('relatedInformation'); + try { + if (obj['relatedInformation'] != null && + !(obj['relatedInformation'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('tagSupport'); + try { + if (obj['tagSupport'] != null && + !(PublishDiagnosticsClientCapabilitiesTagSupport.canParse( + obj['tagSupport'], reporter))) { + reporter.reportError( + 'must be of type PublishDiagnosticsClientCapabilitiesTagSupport'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('versionSupport'); + try { + if (obj['versionSupport'] != null && !(obj['versionSupport'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter + .reportError('must be of type PublishDiagnosticsClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is PublishDiagnosticsClientCapabilities && + other.runtimeType == PublishDiagnosticsClientCapabilities) { + return relatedInformation == other.relatedInformation && + tagSupport == other.tagSupport && + versionSupport == other.versionSupport && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, relatedInformation.hashCode); + hash = JenkinsSmiHash.combine(hash, tagSupport.hashCode); + hash = JenkinsSmiHash.combine(hash, versionSupport.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class PublishDiagnosticsClientCapabilitiesTagSupport implements ToJsonable { + static const jsonHandler = LspJsonHandler( + PublishDiagnosticsClientCapabilitiesTagSupport.canParse, + PublishDiagnosticsClientCapabilitiesTagSupport.fromJson); + + PublishDiagnosticsClientCapabilitiesTagSupport(this.valueSet) { + if (valueSet == null) { + throw 'valueSet is required but was not provided'; + } + } + static PublishDiagnosticsClientCapabilitiesTagSupport fromJson( + Map json) { + final valueSet = json['valueSet'] + ?.map((item) => item != null ? DiagnosticTag.fromJson(item) : null) + ?.cast() + ?.toList(); + return PublishDiagnosticsClientCapabilitiesTagSupport(valueSet); + } + + /// The tags supported by the client. + final List valueSet; + + Map toJson() { + var __result = {}; + __result['valueSet'] = + valueSet ?? (throw 'valueSet is required but was not set'); + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('valueSet'); + try { + if (!obj.containsKey('valueSet')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['valueSet'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!((obj['valueSet'] is List && + (obj['valueSet'] + .every((item) => DiagnosticTag.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError( + 'must be of type PublishDiagnosticsClientCapabilitiesTagSupport'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is PublishDiagnosticsClientCapabilitiesTagSupport && + other.runtimeType == PublishDiagnosticsClientCapabilitiesTagSupport) { + return listEqual(valueSet, other.valueSet, + (DiagnosticTag a, DiagnosticTag b) => a == b) && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, lspHashCode(valueSet)); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + class PublishDiagnosticsParams implements ToJsonable { static const jsonHandler = LspJsonHandler( PublishDiagnosticsParams.canParse, PublishDiagnosticsParams.fromJson); - PublishDiagnosticsParams(this.uri, this.diagnostics) { + PublishDiagnosticsParams(this.uri, this.version, this.diagnostics) { if (uri == null) { throw 'uri is required but was not provided'; } @@ -8711,11 +15273,12 @@ class PublishDiagnosticsParams implements ToJsonable { } static PublishDiagnosticsParams fromJson(Map json) { final uri = json['uri']; + final version = json['version']; final diagnostics = json['diagnostics'] ?.map((item) => item != null ? Diagnostic.fromJson(item) : null) ?.cast() ?.toList(); - return PublishDiagnosticsParams(uri, diagnostics); + return PublishDiagnosticsParams(uri, version, diagnostics); } /// An array of diagnostic information items. @@ -8724,9 +15287,17 @@ class PublishDiagnosticsParams implements ToJsonable { /// The URI for which diagnostic information is reported. final String uri; + /// Optional the version number of the document the diagnostics are published + /// for. + /// @since 3.15.0 + final num version; + Map toJson() { var __result = {}; __result['uri'] = uri ?? (throw 'uri is required but was not set'); + if (version != null) { + __result['version'] = version; + } __result['diagnostics'] = diagnostics ?? (throw 'diagnostics is required but was not set'); return __result; @@ -8751,6 +15322,15 @@ class PublishDiagnosticsParams implements ToJsonable { } finally { reporter.pop(); } + reporter.push('version'); + try { + if (obj['version'] != null && !(obj['version'] is num)) { + reporter.reportError('must be of type num'); + return false; + } + } finally { + reporter.pop(); + } reporter.push('diagnostics'); try { if (!obj.containsKey('diagnostics')) { @@ -8782,6 +15362,7 @@ class PublishDiagnosticsParams implements ToJsonable { if (other is PublishDiagnosticsParams && other.runtimeType == PublishDiagnosticsParams) { return uri == other.uri && + version == other.version && listEqual(diagnostics, other.diagnostics, (Diagnostic a, Diagnostic b) => a == b) && true; @@ -8793,6 +15374,7 @@ class PublishDiagnosticsParams implements ToJsonable { int get hashCode { var hash = 0; hash = JenkinsSmiHash.combine(hash, uri.hashCode); + hash = JenkinsSmiHash.combine(hash, version.hashCode); hash = JenkinsSmiHash.combine(hash, lspHashCode(diagnostics)); return JenkinsSmiHash.finish(hash); } @@ -8988,6 +15570,67 @@ class RangeAndPlaceholder implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } +class ReferenceClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + ReferenceClientCapabilities.canParse, + ReferenceClientCapabilities.fromJson); + + ReferenceClientCapabilities(this.dynamicRegistration); + static ReferenceClientCapabilities fromJson(Map json) { + final dynamicRegistration = json['dynamicRegistration']; + return ReferenceClientCapabilities(dynamicRegistration); + } + + /// Whether references supports dynamic registration. + final bool dynamicRegistration; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type ReferenceClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is ReferenceClientCapabilities && + other.runtimeType == ReferenceClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + class ReferenceContext implements ToJsonable { static const jsonHandler = LspJsonHandler(ReferenceContext.canParse, ReferenceContext.fromJson); @@ -9057,11 +15700,78 @@ class ReferenceContext implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -class ReferenceParams implements TextDocumentPositionParams, ToJsonable { +class ReferenceOptions implements WorkDoneProgressOptions, ToJsonable { + static const jsonHandler = + LspJsonHandler(ReferenceOptions.canParse, ReferenceOptions.fromJson); + + ReferenceOptions(this.workDoneProgress); + static ReferenceOptions fromJson(Map json) { + if (ReferenceRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return ReferenceRegistrationOptions.fromJson(json); + } + final workDoneProgress = json['workDoneProgress']; + return ReferenceOptions(workDoneProgress); + } + + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type ReferenceOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is ReferenceOptions && other.runtimeType == ReferenceOptions) { + return workDoneProgress == other.workDoneProgress && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class ReferenceParams + implements + TextDocumentPositionParams, + WorkDoneProgressParams, + PartialResultParams, + ToJsonable { static const jsonHandler = LspJsonHandler(ReferenceParams.canParse, ReferenceParams.fromJson); - ReferenceParams(this.context, this.textDocument, this.position) { + ReferenceParams(this.context, this.textDocument, this.position, + this.workDoneToken, this.partialResultToken) { if (context == null) { throw 'context is required but was not provided'; } @@ -9081,17 +15791,39 @@ class ReferenceParams implements TextDocumentPositionParams, ToJsonable { : null; final position = json['position'] != null ? Position.fromJson(json['position']) : null; - return ReferenceParams(context, textDocument, position); + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + final partialResultToken = json['partialResultToken'] is num + ? Either2.t1(json['partialResultToken']) + : (json['partialResultToken'] is String + ? Either2.t2(json['partialResultToken']) + : (json['partialResultToken'] == null + ? null + : (throw '''${json['partialResultToken']} was not one of (num, String)'''))); + return ReferenceParams( + context, textDocument, position, workDoneToken, partialResultToken); } final ReferenceContext context; + /// An optional token that a server can use to report partial results (e.g. + /// streaming) to the client. + final Either2 partialResultToken; + /// The position inside the text document. final Position position; /// The text document. final TextDocumentIdentifier textDocument; + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + Map toJson() { var __result = {}; __result['context'] = @@ -9100,6 +15832,12 @@ class ReferenceParams implements TextDocumentPositionParams, ToJsonable { textDocument ?? (throw 'textDocument is required but was not set'); __result['position'] = position ?? (throw 'position is required but was not set'); + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } + if (partialResultToken != null) { + __result['partialResultToken'] = partialResultToken; + } return __result; } @@ -9156,6 +15894,28 @@ class ReferenceParams implements TextDocumentPositionParams, ToJsonable { } finally { reporter.pop(); } + reporter.push('workDoneToken'); + try { + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('partialResultToken'); + try { + if (obj['partialResultToken'] != null && + !((obj['partialResultToken'] is num || + obj['partialResultToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type ReferenceParams'); @@ -9169,6 +15929,8 @@ class ReferenceParams implements TextDocumentPositionParams, ToJsonable { return context == other.context && textDocument == other.textDocument && position == other.position && + workDoneToken == other.workDoneToken && + partialResultToken == other.partialResultToken && true; } return false; @@ -9180,6 +15942,97 @@ class ReferenceParams implements TextDocumentPositionParams, ToJsonable { hash = JenkinsSmiHash.combine(hash, context.hashCode); hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); hash = JenkinsSmiHash.combine(hash, position.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); + hash = JenkinsSmiHash.combine(hash, partialResultToken.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class ReferenceRegistrationOptions + implements TextDocumentRegistrationOptions, ReferenceOptions, ToJsonable { + static const jsonHandler = LspJsonHandler( + ReferenceRegistrationOptions.canParse, + ReferenceRegistrationOptions.fromJson); + + ReferenceRegistrationOptions(this.documentSelector, this.workDoneProgress); + static ReferenceRegistrationOptions fromJson(Map json) { + final documentSelector = json['documentSelector'] + ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) + ?.cast() + ?.toList(); + final workDoneProgress = json['workDoneProgress']; + return ReferenceRegistrationOptions(documentSelector, workDoneProgress); + } + + /// 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. + final List documentSelector; + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + __result['documentSelector'] = documentSelector; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('documentSelector'); + try { + if (!obj.containsKey('documentSelector')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['documentSelector'] != null && + !((obj['documentSelector'] is List && + (obj['documentSelector'].every( + (item) => DocumentFilter.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type ReferenceRegistrationOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is ReferenceRegistrationOptions && + other.runtimeType == ReferenceRegistrationOptions) { + return listEqual(documentSelector, other.documentSelector, + (DocumentFilter a, DocumentFilter b) => a == b) && + workDoneProgress == other.workDoneProgress && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, lspHashCode(documentSelector)); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); return JenkinsSmiHash.finish(hash); } @@ -9379,6 +16232,87 @@ class RegistrationParams implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } +class RenameClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + RenameClientCapabilities.canParse, RenameClientCapabilities.fromJson); + + RenameClientCapabilities(this.dynamicRegistration, this.prepareSupport); + static RenameClientCapabilities fromJson(Map json) { + final dynamicRegistration = json['dynamicRegistration']; + final prepareSupport = json['prepareSupport']; + return RenameClientCapabilities(dynamicRegistration, prepareSupport); + } + + /// Whether rename supports dynamic registration. + final bool dynamicRegistration; + + /// Client supports testing for validity of rename operations before + /// execution. + /// @since version 3.12.0 + final bool prepareSupport; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + if (prepareSupport != null) { + __result['prepareSupport'] = prepareSupport; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('prepareSupport'); + try { + if (obj['prepareSupport'] != null && !(obj['prepareSupport'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type RenameClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is RenameClientCapabilities && + other.runtimeType == RenameClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && + prepareSupport == other.prepareSupport && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + hash = JenkinsSmiHash.combine(hash, prepareSupport.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + /// Rename file operation class RenameFile implements ToJsonable { static const jsonHandler = @@ -9602,25 +16536,32 @@ class RenameFileOptions implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -/// Rename options -class RenameOptions implements ToJsonable { +class RenameOptions implements WorkDoneProgressOptions, ToJsonable { static const jsonHandler = LspJsonHandler(RenameOptions.canParse, RenameOptions.fromJson); - RenameOptions(this.prepareProvider); + RenameOptions(this.prepareProvider, this.workDoneProgress); static RenameOptions fromJson(Map json) { + if (RenameRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return RenameRegistrationOptions.fromJson(json); + } final prepareProvider = json['prepareProvider']; - return RenameOptions(prepareProvider); + final workDoneProgress = json['workDoneProgress']; + return RenameOptions(prepareProvider, workDoneProgress); } /// Renames should be checked and tested before being executed. final bool prepareProvider; + final bool workDoneProgress; Map toJson() { var __result = {}; if (prepareProvider != null) { __result['prepareProvider'] = prepareProvider; } + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } return __result; } @@ -9636,6 +16577,16 @@ class RenameOptions implements ToJsonable { } finally { reporter.pop(); } + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type RenameOptions'); @@ -9646,7 +16597,9 @@ class RenameOptions implements ToJsonable { @override bool operator ==(Object other) { if (other is RenameOptions && other.runtimeType == RenameOptions) { - return prepareProvider == other.prepareProvider && true; + return prepareProvider == other.prepareProvider && + workDoneProgress == other.workDoneProgress && + true; } return false; } @@ -9655,6 +16608,7 @@ class RenameOptions implements ToJsonable { int get hashCode { var hash = 0; hash = JenkinsSmiHash.combine(hash, prepareProvider.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); return JenkinsSmiHash.finish(hash); } @@ -9662,54 +16616,86 @@ class RenameOptions implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -class RenameParams implements ToJsonable { +class RenameParams + implements TextDocumentPositionParams, WorkDoneProgressParams, ToJsonable { static const jsonHandler = LspJsonHandler(RenameParams.canParse, RenameParams.fromJson); - RenameParams(this.textDocument, this.position, this.newName) { + RenameParams( + this.newName, this.textDocument, this.position, this.workDoneToken) { + if (newName == null) { + throw 'newName is required but was not provided'; + } if (textDocument == null) { throw 'textDocument is required but was not provided'; } if (position == null) { throw 'position is required but was not provided'; } - if (newName == null) { - throw 'newName is required but was not provided'; - } } static RenameParams fromJson(Map json) { + final newName = json['newName']; final textDocument = json['textDocument'] != null ? TextDocumentIdentifier.fromJson(json['textDocument']) : null; final position = json['position'] != null ? Position.fromJson(json['position']) : null; - final newName = json['newName']; - return RenameParams(textDocument, position, newName); + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + return RenameParams(newName, textDocument, position, workDoneToken); } /// The new name of the symbol. If the given name is not valid the request /// must return a [ResponseError] with an appropriate message set. final String newName; - /// The position at which this request was sent. + /// The position inside the text document. final Position position; - /// The document to rename. + /// The text document. final TextDocumentIdentifier textDocument; + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + Map toJson() { var __result = {}; + __result['newName'] = + newName ?? (throw 'newName is required but was not set'); __result['textDocument'] = textDocument ?? (throw 'textDocument is required but was not set'); __result['position'] = position ?? (throw 'position is required but was not set'); - __result['newName'] = - newName ?? (throw 'newName is required but was not set'); + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } return __result; } static bool canParse(Object obj, LspJsonReporter reporter) { if (obj is Map) { + reporter.push('newName'); + try { + if (!obj.containsKey('newName')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['newName'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(obj['newName'] is String)) { + reporter.reportError('must be of type String'); + return false; + } + } finally { + reporter.pop(); + } reporter.push('textDocument'); try { if (!obj.containsKey('textDocument')) { @@ -9744,18 +16730,12 @@ class RenameParams implements ToJsonable { } finally { reporter.pop(); } - reporter.push('newName'); + reporter.push('workDoneToken'); try { - if (!obj.containsKey('newName')) { - reporter.reportError('must not be undefined'); - return false; - } - if (obj['newName'] == null) { - reporter.reportError('must not be null'); - return false; - } - if (!(obj['newName'] is String)) { - reporter.reportError('must be of type String'); + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); return false; } } finally { @@ -9771,9 +16751,10 @@ class RenameParams implements ToJsonable { @override bool operator ==(Object other) { if (other is RenameParams && other.runtimeType == RenameParams) { - return textDocument == other.textDocument && + return newName == other.newName && + textDocument == other.textDocument && position == other.position && - newName == other.newName && + workDoneToken == other.workDoneToken && true; } return false; @@ -9782,9 +16763,10 @@ class RenameParams implements ToJsonable { @override int get hashCode { var hash = 0; + hash = JenkinsSmiHash.combine(hash, newName.hashCode); hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); hash = JenkinsSmiHash.combine(hash, position.hashCode); - hash = JenkinsSmiHash.combine(hash, newName.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); return JenkinsSmiHash.finish(hash); } @@ -9793,48 +16775,45 @@ class RenameParams implements ToJsonable { } class RenameRegistrationOptions - implements TextDocumentRegistrationOptions, ToJsonable { + implements TextDocumentRegistrationOptions, RenameOptions, ToJsonable { static const jsonHandler = LspJsonHandler( RenameRegistrationOptions.canParse, RenameRegistrationOptions.fromJson); - RenameRegistrationOptions(this.prepareProvider, this.documentSelector); + RenameRegistrationOptions( + this.documentSelector, this.prepareProvider, this.workDoneProgress); static RenameRegistrationOptions fromJson(Map json) { - final prepareProvider = json['prepareProvider']; final documentSelector = json['documentSelector'] ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) ?.cast() ?.toList(); - return RenameRegistrationOptions(prepareProvider, documentSelector); + final prepareProvider = json['prepareProvider']; + final workDoneProgress = json['workDoneProgress']; + return RenameRegistrationOptions( + documentSelector, prepareProvider, workDoneProgress); } /// 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. final List documentSelector; - /// Renames should be checked and tested for validity before being executed. + /// Renames should be checked and tested before being executed. final bool prepareProvider; + final bool workDoneProgress; Map toJson() { var __result = {}; + __result['documentSelector'] = documentSelector; if (prepareProvider != null) { __result['prepareProvider'] = prepareProvider; } - __result['documentSelector'] = documentSelector; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } return __result; } static bool canParse(Object obj, LspJsonReporter reporter) { if (obj is Map) { - reporter.push('prepareProvider'); - try { - if (obj['prepareProvider'] != null && - !(obj['prepareProvider'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } reporter.push('documentSelector'); try { if (!obj.containsKey('documentSelector')) { @@ -9851,6 +16830,26 @@ class RenameRegistrationOptions } finally { reporter.pop(); } + reporter.push('prepareProvider'); + try { + if (obj['prepareProvider'] != null && + !(obj['prepareProvider'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type RenameRegistrationOptions'); @@ -9862,9 +16861,10 @@ class RenameRegistrationOptions bool operator ==(Object other) { if (other is RenameRegistrationOptions && other.runtimeType == RenameRegistrationOptions) { - return prepareProvider == other.prepareProvider && - listEqual(documentSelector, other.documentSelector, + return listEqual(documentSelector, other.documentSelector, (DocumentFilter a, DocumentFilter b) => a == b) && + prepareProvider == other.prepareProvider && + workDoneProgress == other.workDoneProgress && true; } return false; @@ -9873,8 +16873,9 @@ class RenameRegistrationOptions @override int get hashCode { var hash = 0; - hash = JenkinsSmiHash.combine(hash, prepareProvider.hashCode); hash = JenkinsSmiHash.combine(hash, lspHashCode(documentSelector)); + hash = JenkinsSmiHash.combine(hash, prepareProvider.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); return JenkinsSmiHash.finish(hash); } @@ -10064,7 +17065,7 @@ class ResourceOperationKind { o is ResourceOperationKind && o._value == _value; } -class ResponseError implements ToJsonable { +class ResponseError implements ToJsonable { static const jsonHandler = LspJsonHandler(ResponseError.canParse, ResponseError.fromJson); @@ -10076,12 +17077,12 @@ class ResponseError implements ToJsonable { throw 'message is required but was not provided'; } } - static ResponseError fromJson(Map json) { + static ResponseError fromJson(Map json) { final code = json['code'] != null ? ErrorCodes.fromJson(json['code']) : null; final message = json['message']; final data = json['data']; - return ResponseError(code, message, data); + return ResponseError(code, message, data); } /// A number indicating the error type that occurred. @@ -10152,7 +17153,7 @@ class ResponseError implements ToJsonable { } return true; } else { - reporter.reportError('must be of type ResponseError'); + reporter.reportError('must be of type ResponseError'); return false; } } @@ -10199,15 +17200,14 @@ class ResponseMessage implements Message, ToJsonable { ? null : (throw '''${json['id']} was not one of (num, String)'''))); final result = json['result']; - final error = json['error'] != null - ? ResponseError.fromJson(json['error']) - : null; + final error = + json['error'] != null ? ResponseError.fromJson(json['error']) : null; final jsonrpc = json['jsonrpc']; return ResponseMessage(id, result, error, jsonrpc); } /// The error object in case a request fails. - final ResponseError error; + final ResponseError error; /// The request id. final Either2 id; @@ -10260,7 +17260,7 @@ class ResponseMessage implements Message, ToJsonable { try { if (obj['error'] != null && !(ResponseError.canParse(obj['error'], reporter))) { - reporter.reportError('must be of type ResponseError'); + reporter.reportError('must be of type ResponseError'); return false; } } finally { @@ -10316,7 +17316,6 @@ class ResponseMessage implements Message, ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -/// Save options. class SaveOptions implements ToJsonable { static const jsonHandler = LspJsonHandler(SaveOptions.canParse, SaveOptions.fromJson); @@ -10375,33 +17374,525 @@ class SaveOptions implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } +class SelectionRange implements ToJsonable { + static const jsonHandler = + LspJsonHandler(SelectionRange.canParse, SelectionRange.fromJson); + + SelectionRange(this.range, this.parent) { + if (range == null) { + throw 'range is required but was not provided'; + } + } + static SelectionRange fromJson(Map json) { + final range = json['range'] != null ? Range.fromJson(json['range']) : null; + final parent = + json['parent'] != null ? SelectionRange.fromJson(json['parent']) : null; + return SelectionRange(range, parent); + } + + /// The parent selection range containing this range. Therefore `parent.range` + /// must contain `this.range`. + final SelectionRange parent; + + /// The range ([Range]) of this selection range. + final Range range; + + Map toJson() { + var __result = {}; + __result['range'] = range ?? (throw 'range is required but was not set'); + if (parent != null) { + __result['parent'] = parent; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('range'); + try { + if (!obj.containsKey('range')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['range'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(Range.canParse(obj['range'], reporter))) { + reporter.reportError('must be of type Range'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('parent'); + try { + if (obj['parent'] != null && + !(SelectionRange.canParse(obj['parent'], reporter))) { + reporter.reportError('must be of type SelectionRange'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type SelectionRange'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is SelectionRange && other.runtimeType == SelectionRange) { + return range == other.range && parent == other.parent && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, range.hashCode); + hash = JenkinsSmiHash.combine(hash, parent.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class SelectionRangeClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + SelectionRangeClientCapabilities.canParse, + SelectionRangeClientCapabilities.fromJson); + + SelectionRangeClientCapabilities(this.dynamicRegistration); + static SelectionRangeClientCapabilities fromJson(Map json) { + final dynamicRegistration = json['dynamicRegistration']; + return SelectionRangeClientCapabilities(dynamicRegistration); + } + + /// Whether implementation supports dynamic registration for selection range + /// providers. If this is set to `true` the client supports the new + /// `SelectionRangeRegistrationOptions` return value for the corresponding + /// server capability as well. + final bool dynamicRegistration; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type SelectionRangeClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is SelectionRangeClientCapabilities && + other.runtimeType == SelectionRangeClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class SelectionRangeOptions implements WorkDoneProgressOptions, ToJsonable { + static const jsonHandler = LspJsonHandler( + SelectionRangeOptions.canParse, SelectionRangeOptions.fromJson); + + SelectionRangeOptions(this.workDoneProgress); + static SelectionRangeOptions fromJson(Map json) { + if (SelectionRangeRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return SelectionRangeRegistrationOptions.fromJson(json); + } + final workDoneProgress = json['workDoneProgress']; + return SelectionRangeOptions(workDoneProgress); + } + + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type SelectionRangeOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is SelectionRangeOptions && + other.runtimeType == SelectionRangeOptions) { + return workDoneProgress == other.workDoneProgress && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class SelectionRangeParams + implements WorkDoneProgressParams, PartialResultParams, ToJsonable { + static const jsonHandler = LspJsonHandler( + SelectionRangeParams.canParse, SelectionRangeParams.fromJson); + + SelectionRangeParams(this.textDocument, this.positions, this.workDoneToken, + this.partialResultToken) { + if (textDocument == null) { + throw 'textDocument is required but was not provided'; + } + if (positions == null) { + throw 'positions is required but was not provided'; + } + } + static SelectionRangeParams fromJson(Map json) { + final textDocument = json['textDocument'] != null + ? TextDocumentIdentifier.fromJson(json['textDocument']) + : null; + final positions = json['positions'] + ?.map((item) => item != null ? Position.fromJson(item) : null) + ?.cast() + ?.toList(); + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + final partialResultToken = json['partialResultToken'] is num + ? Either2.t1(json['partialResultToken']) + : (json['partialResultToken'] is String + ? Either2.t2(json['partialResultToken']) + : (json['partialResultToken'] == null + ? null + : (throw '''${json['partialResultToken']} was not one of (num, String)'''))); + return SelectionRangeParams( + textDocument, positions, workDoneToken, partialResultToken); + } + + /// An optional token that a server can use to report partial results (e.g. + /// streaming) to the client. + final Either2 partialResultToken; + + /// The positions inside the text document. + final List positions; + + /// The text document. + final TextDocumentIdentifier textDocument; + + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + + Map toJson() { + var __result = {}; + __result['textDocument'] = + textDocument ?? (throw 'textDocument is required but was not set'); + __result['positions'] = + positions ?? (throw 'positions is required but was not set'); + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } + if (partialResultToken != null) { + __result['partialResultToken'] = partialResultToken; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('textDocument'); + try { + if (!obj.containsKey('textDocument')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['textDocument'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) { + reporter.reportError('must be of type TextDocumentIdentifier'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('positions'); + try { + if (!obj.containsKey('positions')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['positions'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!((obj['positions'] is List && + (obj['positions'] + .every((item) => Position.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneToken'); + try { + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('partialResultToken'); + try { + if (obj['partialResultToken'] != null && + !((obj['partialResultToken'] is num || + obj['partialResultToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type SelectionRangeParams'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is SelectionRangeParams && + other.runtimeType == SelectionRangeParams) { + return textDocument == other.textDocument && + listEqual( + positions, other.positions, (Position a, Position b) => a == b) && + workDoneToken == other.workDoneToken && + partialResultToken == other.partialResultToken && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); + hash = JenkinsSmiHash.combine(hash, lspHashCode(positions)); + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); + hash = JenkinsSmiHash.combine(hash, partialResultToken.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class SelectionRangeRegistrationOptions + implements + SelectionRangeOptions, + TextDocumentRegistrationOptions, + StaticRegistrationOptions, + ToJsonable { + static const jsonHandler = LspJsonHandler( + SelectionRangeRegistrationOptions.canParse, + SelectionRangeRegistrationOptions.fromJson); + + SelectionRangeRegistrationOptions( + this.workDoneProgress, this.documentSelector, this.id); + static SelectionRangeRegistrationOptions fromJson(Map json) { + final workDoneProgress = json['workDoneProgress']; + final documentSelector = json['documentSelector'] + ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) + ?.cast() + ?.toList(); + final id = json['id']; + return SelectionRangeRegistrationOptions( + workDoneProgress, documentSelector, id); + } + + /// 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. + final List documentSelector; + + /// The id used to register the request. The id can be used to deregister the + /// request again. See also Registration#id. + final String id; + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + __result['documentSelector'] = documentSelector; + if (id != null) { + __result['id'] = id; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('documentSelector'); + try { + if (!obj.containsKey('documentSelector')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['documentSelector'] != null && + !((obj['documentSelector'] is List && + (obj['documentSelector'].every( + (item) => DocumentFilter.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('id'); + try { + if (obj['id'] != null && !(obj['id'] is String)) { + reporter.reportError('must be of type String'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type SelectionRangeRegistrationOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is SelectionRangeRegistrationOptions && + other.runtimeType == SelectionRangeRegistrationOptions) { + return workDoneProgress == other.workDoneProgress && + listEqual(documentSelector, other.documentSelector, + (DocumentFilter a, DocumentFilter b) => a == b) && + id == other.id && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + hash = JenkinsSmiHash.combine(hash, lspHashCode(documentSelector)); + hash = JenkinsSmiHash.combine(hash, id.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + class ServerCapabilities implements ToJsonable { static const jsonHandler = LspJsonHandler(ServerCapabilities.canParse, ServerCapabilities.fromJson); ServerCapabilities( this.textDocumentSync, - this.hoverProvider, this.completionProvider, + this.hoverProvider, this.signatureHelpProvider, + this.declarationProvider, this.definitionProvider, this.typeDefinitionProvider, this.implementationProvider, this.referencesProvider, this.documentHighlightProvider, this.documentSymbolProvider, - this.workspaceSymbolProvider, this.codeActionProvider, this.codeLensProvider, + this.documentLinkProvider, + this.colorProvider, this.documentFormattingProvider, this.documentRangeFormattingProvider, this.documentOnTypeFormattingProvider, this.renameProvider, - this.documentLinkProvider, - this.colorProvider, this.foldingRangeProvider, - this.declarationProvider, this.executeCommandProvider, + this.selectionRangeProvider, + this.workspaceSymbolProvider, this.workspace, this.experimental); static ServerCapabilities fromJson(Map json) { @@ -10416,20 +17907,124 @@ class ServerCapabilities implements ToJsonable { : (json['textDocumentSync'] == null ? null : (throw '''${json['textDocumentSync']} was not one of (TextDocumentSyncOptions, num)'''))); - final hoverProvider = json['hoverProvider']; final completionProvider = json['completionProvider'] != null ? CompletionOptions.fromJson(json['completionProvider']) : null; + final hoverProvider = json['hoverProvider'] is bool + ? Either2.t1(json['hoverProvider']) + : (HoverOptions.canParse(json['hoverProvider'], nullLspJsonReporter) + ? Either2.t2(json['hoverProvider'] != null + ? HoverOptions.fromJson(json['hoverProvider']) + : null) + : (json['hoverProvider'] == null + ? null + : (throw '''${json['hoverProvider']} was not one of (bool, HoverOptions)'''))); final signatureHelpProvider = json['signatureHelpProvider'] != null ? SignatureHelpOptions.fromJson(json['signatureHelpProvider']) : null; - final definitionProvider = json['definitionProvider']; - final typeDefinitionProvider = json['typeDefinitionProvider']; - final implementationProvider = json['implementationProvider']; - final referencesProvider = json['referencesProvider']; - final documentHighlightProvider = json['documentHighlightProvider']; - final documentSymbolProvider = json['documentSymbolProvider']; - final workspaceSymbolProvider = json['workspaceSymbolProvider']; + final declarationProvider = json['declarationProvider'] is bool + ? Either3.t1( + json['declarationProvider']) + : (DeclarationOptions.canParse( + json['declarationProvider'], nullLspJsonReporter) + ? Either3.t2( + json['declarationProvider'] != null + ? DeclarationOptions.fromJson(json['declarationProvider']) + : null) + : (DeclarationRegistrationOptions.canParse( + json['declarationProvider'], nullLspJsonReporter) + ? Either3.t3( + json['declarationProvider'] != null + ? DeclarationRegistrationOptions.fromJson( + json['declarationProvider']) + : null) + : (json['declarationProvider'] == null + ? null + : (throw '''${json['declarationProvider']} was not one of (bool, DeclarationOptions, DeclarationRegistrationOptions)''')))); + final definitionProvider = json['definitionProvider'] is bool + ? Either2.t1(json['definitionProvider']) + : (DefinitionOptions.canParse( + json['definitionProvider'], nullLspJsonReporter) + ? Either2.t2( + json['definitionProvider'] != null + ? DefinitionOptions.fromJson(json['definitionProvider']) + : null) + : (json['definitionProvider'] == null + ? null + : (throw '''${json['definitionProvider']} was not one of (bool, DefinitionOptions)'''))); + final typeDefinitionProvider = json['typeDefinitionProvider'] is bool + ? Either3.t1( + json['typeDefinitionProvider']) + : (TypeDefinitionOptions.canParse( + json['typeDefinitionProvider'], nullLspJsonReporter) + ? Either3.t2(json['typeDefinitionProvider'] != null + ? TypeDefinitionOptions.fromJson(json['typeDefinitionProvider']) + : null) + : (TypeDefinitionRegistrationOptions.canParse( + json['typeDefinitionProvider'], nullLspJsonReporter) + ? Either3.t3( + json['typeDefinitionProvider'] != null + ? TypeDefinitionRegistrationOptions.fromJson( + json['typeDefinitionProvider']) + : null) + : (json['typeDefinitionProvider'] == null + ? null + : (throw '''${json['typeDefinitionProvider']} was not one of (bool, TypeDefinitionOptions, TypeDefinitionRegistrationOptions)''')))); + final implementationProvider = json['implementationProvider'] is bool + ? Either3.t1( + json['implementationProvider']) + : (ImplementationOptions.canParse( + json['implementationProvider'], nullLspJsonReporter) + ? Either3.t2(json['implementationProvider'] != null + ? ImplementationOptions.fromJson(json['implementationProvider']) + : null) + : (ImplementationRegistrationOptions.canParse( + json['implementationProvider'], nullLspJsonReporter) + ? Either3.t3( + json['implementationProvider'] != null + ? ImplementationRegistrationOptions.fromJson( + json['implementationProvider']) + : null) + : (json['implementationProvider'] == null + ? null + : (throw '''${json['implementationProvider']} was not one of (bool, ImplementationOptions, ImplementationRegistrationOptions)''')))); + final referencesProvider = json['referencesProvider'] is bool + ? Either2.t1(json['referencesProvider']) + : (ReferenceOptions.canParse( + json['referencesProvider'], nullLspJsonReporter) + ? Either2.t2( + json['referencesProvider'] != null + ? ReferenceOptions.fromJson(json['referencesProvider']) + : null) + : (json['referencesProvider'] == null + ? null + : (throw '''${json['referencesProvider']} was not one of (bool, ReferenceOptions)'''))); + final documentHighlightProvider = json['documentHighlightProvider'] is bool + ? Either2.t1( + json['documentHighlightProvider']) + : (DocumentHighlightOptions.canParse( + json['documentHighlightProvider'], nullLspJsonReporter) + ? Either2.t2( + json['documentHighlightProvider'] != null + ? DocumentHighlightOptions.fromJson( + json['documentHighlightProvider']) + : null) + : (json['documentHighlightProvider'] == null + ? null + : (throw '''${json['documentHighlightProvider']} was not one of (bool, DocumentHighlightOptions)'''))); + final documentSymbolProvider = json['documentSymbolProvider'] is bool + ? Either2.t1( + json['documentSymbolProvider']) + : (DocumentSymbolOptions.canParse( + json['documentSymbolProvider'], nullLspJsonReporter) + ? Either2.t2( + json['documentSymbolProvider'] != null + ? DocumentSymbolOptions.fromJson( + json['documentSymbolProvider']) + : null) + : (json['documentSymbolProvider'] == null + ? null + : (throw '''${json['documentSymbolProvider']} was not one of (bool, DocumentSymbolOptions)'''))); final codeActionProvider = json['codeActionProvider'] is bool ? Either2.t1(json['codeActionProvider']) : (CodeActionOptions.canParse( @@ -10444,9 +18039,56 @@ class ServerCapabilities implements ToJsonable { final codeLensProvider = json['codeLensProvider'] != null ? CodeLensOptions.fromJson(json['codeLensProvider']) : null; - final documentFormattingProvider = json['documentFormattingProvider']; - final documentRangeFormattingProvider = - json['documentRangeFormattingProvider']; + final documentLinkProvider = json['documentLinkProvider'] != null + ? DocumentLinkOptions.fromJson(json['documentLinkProvider']) + : null; + final colorProvider = json['colorProvider'] is bool + ? Either3.t1( + json['colorProvider']) + : (DocumentColorOptions.canParse( + json['colorProvider'], nullLspJsonReporter) + ? Either3.t2( + json['colorProvider'] != null + ? DocumentColorOptions.fromJson(json['colorProvider']) + : null) + : (DocumentColorRegistrationOptions.canParse( + json['colorProvider'], nullLspJsonReporter) + ? Either3.t3( + json['colorProvider'] != null + ? DocumentColorRegistrationOptions.fromJson( + json['colorProvider']) + : null) + : (json['colorProvider'] == null + ? null + : (throw '''${json['colorProvider']} was not one of (bool, DocumentColorOptions, DocumentColorRegistrationOptions)''')))); + final documentFormattingProvider = json['documentFormattingProvider'] + is bool + ? Either2.t1( + json['documentFormattingProvider']) + : (DocumentFormattingOptions.canParse( + json['documentFormattingProvider'], nullLspJsonReporter) + ? Either2.t2( + json['documentFormattingProvider'] != null + ? DocumentFormattingOptions.fromJson( + json['documentFormattingProvider']) + : null) + : (json['documentFormattingProvider'] == null + ? null + : (throw '''${json['documentFormattingProvider']} was not one of (bool, DocumentFormattingOptions)'''))); + final documentRangeFormattingProvider = json[ + 'documentRangeFormattingProvider'] is bool + ? Either2.t1( + json['documentRangeFormattingProvider']) + : (DocumentRangeFormattingOptions.canParse( + json['documentRangeFormattingProvider'], nullLspJsonReporter) + ? Either2.t2( + json['documentRangeFormattingProvider'] != null + ? DocumentRangeFormattingOptions.fromJson( + json['documentRangeFormattingProvider']) + : null) + : (json['documentRangeFormattingProvider'] == null + ? null + : (throw '''${json['documentRangeFormattingProvider']} was not one of (bool, DocumentRangeFormattingOptions)'''))); final documentOnTypeFormattingProvider = json['documentOnTypeFormattingProvider'] != null ? DocumentOnTypeFormattingOptions.fromJson( @@ -10461,42 +18103,75 @@ class ServerCapabilities implements ToJsonable { : (json['renameProvider'] == null ? null : (throw '''${json['renameProvider']} was not one of (bool, RenameOptions)'''))); - final documentLinkProvider = json['documentLinkProvider'] != null - ? DocumentLinkOptions.fromJson(json['documentLinkProvider']) - : null; - final colorProvider = json['colorProvider']; - final foldingRangeProvider = json['foldingRangeProvider']; - final declarationProvider = json['declarationProvider']; + final foldingRangeProvider = json['foldingRangeProvider'] is bool + ? Either3.t1( + json['foldingRangeProvider']) + : (FoldingRangeOptions.canParse( + json['foldingRangeProvider'], nullLspJsonReporter) + ? Either3.t2( + json['foldingRangeProvider'] != null + ? FoldingRangeOptions.fromJson(json['foldingRangeProvider']) + : null) + : (FoldingRangeRegistrationOptions.canParse( + json['foldingRangeProvider'], nullLspJsonReporter) + ? Either3.t3( + json['foldingRangeProvider'] != null + ? FoldingRangeRegistrationOptions.fromJson( + json['foldingRangeProvider']) + : null) + : (json['foldingRangeProvider'] == null + ? null + : (throw '''${json['foldingRangeProvider']} was not one of (bool, FoldingRangeOptions, FoldingRangeRegistrationOptions)''')))); final executeCommandProvider = json['executeCommandProvider'] != null ? ExecuteCommandOptions.fromJson(json['executeCommandProvider']) : null; + final selectionRangeProvider = json['selectionRangeProvider'] is bool + ? Either3.t1( + json['selectionRangeProvider']) + : (SelectionRangeOptions.canParse( + json['selectionRangeProvider'], nullLspJsonReporter) + ? Either3.t2(json['selectionRangeProvider'] != null + ? SelectionRangeOptions.fromJson(json['selectionRangeProvider']) + : null) + : (SelectionRangeRegistrationOptions.canParse( + json['selectionRangeProvider'], nullLspJsonReporter) + ? Either3.t3( + json['selectionRangeProvider'] != null + ? SelectionRangeRegistrationOptions.fromJson( + json['selectionRangeProvider']) + : null) + : (json['selectionRangeProvider'] == null + ? null + : (throw '''${json['selectionRangeProvider']} was not one of (bool, SelectionRangeOptions, SelectionRangeRegistrationOptions)''')))); + final workspaceSymbolProvider = json['workspaceSymbolProvider']; final workspace = json['workspace'] != null ? ServerCapabilitiesWorkspace.fromJson(json['workspace']) : null; final experimental = json['experimental']; return ServerCapabilities( textDocumentSync, - hoverProvider, completionProvider, + hoverProvider, signatureHelpProvider, + declarationProvider, definitionProvider, typeDefinitionProvider, implementationProvider, referencesProvider, documentHighlightProvider, documentSymbolProvider, - workspaceSymbolProvider, codeActionProvider, codeLensProvider, + documentLinkProvider, + colorProvider, documentFormattingProvider, documentRangeFormattingProvider, documentOnTypeFormattingProvider, renameProvider, - documentLinkProvider, - colorProvider, foldingRangeProvider, - declarationProvider, executeCommandProvider, + selectionRangeProvider, + workspaceSymbolProvider, workspace, experimental); } @@ -10510,26 +18185,26 @@ class ServerCapabilities implements ToJsonable { final CodeLensOptions codeLensProvider; /// The server provides color provider support. - /// - /// Since 3.6.0 - final dynamic colorProvider; + /// @since 3.6.0 + final Either3 + colorProvider; /// The server provides completion support. final CompletionOptions completionProvider; /// The server provides go to declaration support. - /// - /// Since 3.14.0 - final dynamic declarationProvider; + /// @since 3.14.0 + final Either3 + declarationProvider; /// The server provides goto definition support. - final bool definitionProvider; + final Either2 definitionProvider; /// The server provides document formatting. - final bool documentFormattingProvider; + final Either2 documentFormattingProvider; /// The server provides document highlight support. - final bool documentHighlightProvider; + final Either2 documentHighlightProvider; /// The server provides document link support. final DocumentLinkOptions documentLinkProvider; @@ -10538,10 +18213,11 @@ class ServerCapabilities implements ToJsonable { final DocumentOnTypeFormattingOptions documentOnTypeFormattingProvider; /// The server provides document range formatting. - final bool documentRangeFormattingProvider; + final Either2 + documentRangeFormattingProvider; /// The server provides document symbol support. - final bool documentSymbolProvider; + final Either2 documentSymbolProvider; /// The server provides execute command support. final ExecuteCommandOptions executeCommandProvider; @@ -10550,26 +18226,31 @@ class ServerCapabilities implements ToJsonable { final dynamic experimental; /// The server provides folding provider support. - /// - /// Since 3.10.0 - final dynamic foldingRangeProvider; + /// @since 3.10.0 + final Either3 + foldingRangeProvider; /// The server provides hover support. - final bool hoverProvider; + final Either2 hoverProvider; - /// The server provides Goto Implementation support. - /// - /// Since 3.6.0 - final dynamic implementationProvider; + /// The server provides goto implementation support. + /// @since 3.6.0 + final Either3 + implementationProvider; /// The server provides find references support. - final bool referencesProvider; + final Either2 referencesProvider; /// The server provides rename support. RenameOptions may only be specified if /// the client states that it supports `prepareSupport` in its initial /// `initialize` request. final Either2 renameProvider; + /// The server provides selection range support. + /// @since 3.15.0 + final Either3 + selectionRangeProvider; + /// The server provides signature help support. final SignatureHelpOptions signatureHelpProvider; @@ -10579,10 +18260,10 @@ class ServerCapabilities implements ToJsonable { /// `TextDocumentSyncKind.None`. final Either2 textDocumentSync; - /// The server provides Goto Type Definition support. - /// - /// Since 3.6.0 - final dynamic typeDefinitionProvider; + /// The server provides goto type definition support. + /// @since 3.6.0 + final Either3 + typeDefinitionProvider; /// Workspace specific server capabilities final ServerCapabilitiesWorkspace workspace; @@ -10595,15 +18276,18 @@ class ServerCapabilities implements ToJsonable { if (textDocumentSync != null) { __result['textDocumentSync'] = textDocumentSync; } - if (hoverProvider != null) { - __result['hoverProvider'] = hoverProvider; - } if (completionProvider != null) { __result['completionProvider'] = completionProvider; } + if (hoverProvider != null) { + __result['hoverProvider'] = hoverProvider; + } if (signatureHelpProvider != null) { __result['signatureHelpProvider'] = signatureHelpProvider; } + if (declarationProvider != null) { + __result['declarationProvider'] = declarationProvider; + } if (definitionProvider != null) { __result['definitionProvider'] = definitionProvider; } @@ -10622,15 +18306,18 @@ class ServerCapabilities implements ToJsonable { if (documentSymbolProvider != null) { __result['documentSymbolProvider'] = documentSymbolProvider; } - if (workspaceSymbolProvider != null) { - __result['workspaceSymbolProvider'] = workspaceSymbolProvider; - } if (codeActionProvider != null) { __result['codeActionProvider'] = codeActionProvider; } if (codeLensProvider != null) { __result['codeLensProvider'] = codeLensProvider; } + if (documentLinkProvider != null) { + __result['documentLinkProvider'] = documentLinkProvider; + } + if (colorProvider != null) { + __result['colorProvider'] = colorProvider; + } if (documentFormattingProvider != null) { __result['documentFormattingProvider'] = documentFormattingProvider; } @@ -10645,21 +18332,18 @@ class ServerCapabilities implements ToJsonable { if (renameProvider != null) { __result['renameProvider'] = renameProvider; } - if (documentLinkProvider != null) { - __result['documentLinkProvider'] = documentLinkProvider; - } - if (colorProvider != null) { - __result['colorProvider'] = colorProvider; - } if (foldingRangeProvider != null) { __result['foldingRangeProvider'] = foldingRangeProvider; } - if (declarationProvider != null) { - __result['declarationProvider'] = declarationProvider; - } if (executeCommandProvider != null) { __result['executeCommandProvider'] = executeCommandProvider; } + if (selectionRangeProvider != null) { + __result['selectionRangeProvider'] = selectionRangeProvider; + } + if (workspaceSymbolProvider != null) { + __result['workspaceSymbolProvider'] = workspaceSymbolProvider; + } if (workspace != null) { __result['workspace'] = workspace; } @@ -10684,15 +18368,6 @@ class ServerCapabilities implements ToJsonable { } finally { reporter.pop(); } - reporter.push('hoverProvider'); - try { - if (obj['hoverProvider'] != null && !(obj['hoverProvider'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } reporter.push('completionProvider'); try { if (obj['completionProvider'] != null && @@ -10704,6 +18379,17 @@ class ServerCapabilities implements ToJsonable { } finally { reporter.pop(); } + reporter.push('hoverProvider'); + try { + if (obj['hoverProvider'] != null && + !((obj['hoverProvider'] is bool || + HoverOptions.canParse(obj['hoverProvider'], reporter)))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } reporter.push('signatureHelpProvider'); try { if (obj['signatureHelpProvider'] != null && @@ -10715,11 +18401,29 @@ class ServerCapabilities implements ToJsonable { } finally { reporter.pop(); } + reporter.push('declarationProvider'); + try { + if (obj['declarationProvider'] != null && + !((obj['declarationProvider'] is bool || + DeclarationOptions.canParse( + obj['declarationProvider'], reporter) || + DeclarationRegistrationOptions.canParse( + obj['declarationProvider'], reporter)))) { + reporter.reportError( + 'must be of type Either3'); + return false; + } + } finally { + reporter.pop(); + } reporter.push('definitionProvider'); try { if (obj['definitionProvider'] != null && - !(obj['definitionProvider'] is bool)) { - reporter.reportError('must be of type bool'); + !((obj['definitionProvider'] is bool || + DefinitionOptions.canParse( + obj['definitionProvider'], reporter)))) { + reporter + .reportError('must be of type Either2'); return false; } } finally { @@ -10727,8 +18431,14 @@ class ServerCapabilities implements ToJsonable { } reporter.push('typeDefinitionProvider'); try { - if (obj['typeDefinitionProvider'] != null && !(true)) { - reporter.reportError('must be of type dynamic'); + if (obj['typeDefinitionProvider'] != null && + !((obj['typeDefinitionProvider'] is bool || + TypeDefinitionOptions.canParse( + obj['typeDefinitionProvider'], reporter) || + TypeDefinitionRegistrationOptions.canParse( + obj['typeDefinitionProvider'], reporter)))) { + reporter.reportError( + 'must be of type Either3'); return false; } } finally { @@ -10736,8 +18446,14 @@ class ServerCapabilities implements ToJsonable { } reporter.push('implementationProvider'); try { - if (obj['implementationProvider'] != null && !(true)) { - reporter.reportError('must be of type dynamic'); + if (obj['implementationProvider'] != null && + !((obj['implementationProvider'] is bool || + ImplementationOptions.canParse( + obj['implementationProvider'], reporter) || + ImplementationRegistrationOptions.canParse( + obj['implementationProvider'], reporter)))) { + reporter.reportError( + 'must be of type Either3'); return false; } } finally { @@ -10746,8 +18462,11 @@ class ServerCapabilities implements ToJsonable { reporter.push('referencesProvider'); try { if (obj['referencesProvider'] != null && - !(obj['referencesProvider'] is bool)) { - reporter.reportError('must be of type bool'); + !((obj['referencesProvider'] is bool || + ReferenceOptions.canParse( + obj['referencesProvider'], reporter)))) { + reporter + .reportError('must be of type Either2'); return false; } } finally { @@ -10756,8 +18475,11 @@ class ServerCapabilities implements ToJsonable { reporter.push('documentHighlightProvider'); try { if (obj['documentHighlightProvider'] != null && - !(obj['documentHighlightProvider'] is bool)) { - reporter.reportError('must be of type bool'); + !((obj['documentHighlightProvider'] is bool || + DocumentHighlightOptions.canParse( + obj['documentHighlightProvider'], reporter)))) { + reporter.reportError( + 'must be of type Either2'); return false; } } finally { @@ -10766,18 +18488,11 @@ class ServerCapabilities implements ToJsonable { reporter.push('documentSymbolProvider'); try { if (obj['documentSymbolProvider'] != null && - !(obj['documentSymbolProvider'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('workspaceSymbolProvider'); - try { - if (obj['workspaceSymbolProvider'] != null && - !(obj['workspaceSymbolProvider'] is bool)) { - reporter.reportError('must be of type bool'); + !((obj['documentSymbolProvider'] is bool || + DocumentSymbolOptions.canParse( + obj['documentSymbolProvider'], reporter)))) { + reporter.reportError( + 'must be of type Either2'); return false; } } finally { @@ -10806,11 +18521,39 @@ class ServerCapabilities implements ToJsonable { } finally { reporter.pop(); } + reporter.push('documentLinkProvider'); + try { + if (obj['documentLinkProvider'] != null && + !(DocumentLinkOptions.canParse( + obj['documentLinkProvider'], reporter))) { + reporter.reportError('must be of type DocumentLinkOptions'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('colorProvider'); + try { + if (obj['colorProvider'] != null && + !((obj['colorProvider'] is bool || + DocumentColorOptions.canParse(obj['colorProvider'], reporter) || + DocumentColorRegistrationOptions.canParse( + obj['colorProvider'], reporter)))) { + reporter.reportError( + 'must be of type Either3'); + return false; + } + } finally { + reporter.pop(); + } reporter.push('documentFormattingProvider'); try { if (obj['documentFormattingProvider'] != null && - !(obj['documentFormattingProvider'] is bool)) { - reporter.reportError('must be of type bool'); + !((obj['documentFormattingProvider'] is bool || + DocumentFormattingOptions.canParse( + obj['documentFormattingProvider'], reporter)))) { + reporter.reportError( + 'must be of type Either2'); return false; } } finally { @@ -10819,8 +18562,11 @@ class ServerCapabilities implements ToJsonable { reporter.push('documentRangeFormattingProvider'); try { if (obj['documentRangeFormattingProvider'] != null && - !(obj['documentRangeFormattingProvider'] is bool)) { - reporter.reportError('must be of type bool'); + !((obj['documentRangeFormattingProvider'] is bool || + DocumentRangeFormattingOptions.canParse( + obj['documentRangeFormattingProvider'], reporter)))) { + reporter.reportError( + 'must be of type Either2'); return false; } } finally { @@ -10849,39 +18595,16 @@ class ServerCapabilities implements ToJsonable { } finally { reporter.pop(); } - reporter.push('documentLinkProvider'); - try { - if (obj['documentLinkProvider'] != null && - !(DocumentLinkOptions.canParse( - obj['documentLinkProvider'], reporter))) { - reporter.reportError('must be of type DocumentLinkOptions'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('colorProvider'); - try { - if (obj['colorProvider'] != null && !(true)) { - reporter.reportError('must be of type dynamic'); - return false; - } - } finally { - reporter.pop(); - } reporter.push('foldingRangeProvider'); try { - if (obj['foldingRangeProvider'] != null && !(true)) { - reporter.reportError('must be of type dynamic'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('declarationProvider'); - try { - if (obj['declarationProvider'] != null && !(true)) { - reporter.reportError('must be of type dynamic'); + if (obj['foldingRangeProvider'] != null && + !((obj['foldingRangeProvider'] is bool || + FoldingRangeOptions.canParse( + obj['foldingRangeProvider'], reporter) || + FoldingRangeRegistrationOptions.canParse( + obj['foldingRangeProvider'], reporter)))) { + reporter.reportError( + 'must be of type Either3'); return false; } } finally { @@ -10898,6 +18621,31 @@ class ServerCapabilities implements ToJsonable { } finally { reporter.pop(); } + reporter.push('selectionRangeProvider'); + try { + if (obj['selectionRangeProvider'] != null && + !((obj['selectionRangeProvider'] is bool || + SelectionRangeOptions.canParse( + obj['selectionRangeProvider'], reporter) || + SelectionRangeRegistrationOptions.canParse( + obj['selectionRangeProvider'], reporter)))) { + reporter.reportError( + 'must be of type Either3'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workspaceSymbolProvider'); + try { + if (obj['workspaceSymbolProvider'] != null && + !(obj['workspaceSymbolProvider'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } reporter.push('workspace'); try { if (obj['workspace'] != null && @@ -10930,29 +18678,30 @@ class ServerCapabilities implements ToJsonable { if (other is ServerCapabilities && other.runtimeType == ServerCapabilities) { return textDocumentSync == other.textDocumentSync && - hoverProvider == other.hoverProvider && completionProvider == other.completionProvider && + hoverProvider == other.hoverProvider && signatureHelpProvider == other.signatureHelpProvider && + declarationProvider == other.declarationProvider && definitionProvider == other.definitionProvider && typeDefinitionProvider == other.typeDefinitionProvider && implementationProvider == other.implementationProvider && referencesProvider == other.referencesProvider && documentHighlightProvider == other.documentHighlightProvider && documentSymbolProvider == other.documentSymbolProvider && - workspaceSymbolProvider == other.workspaceSymbolProvider && codeActionProvider == other.codeActionProvider && codeLensProvider == other.codeLensProvider && + documentLinkProvider == other.documentLinkProvider && + colorProvider == other.colorProvider && documentFormattingProvider == other.documentFormattingProvider && documentRangeFormattingProvider == other.documentRangeFormattingProvider && documentOnTypeFormattingProvider == other.documentOnTypeFormattingProvider && renameProvider == other.renameProvider && - documentLinkProvider == other.documentLinkProvider && - colorProvider == other.colorProvider && foldingRangeProvider == other.foldingRangeProvider && - declarationProvider == other.declarationProvider && executeCommandProvider == other.executeCommandProvider && + selectionRangeProvider == other.selectionRangeProvider && + workspaceSymbolProvider == other.workspaceSymbolProvider && workspace == other.workspace && experimental == other.experimental && true; @@ -10964,29 +18713,30 @@ class ServerCapabilities implements ToJsonable { int get hashCode { var hash = 0; hash = JenkinsSmiHash.combine(hash, textDocumentSync.hashCode); - hash = JenkinsSmiHash.combine(hash, hoverProvider.hashCode); hash = JenkinsSmiHash.combine(hash, completionProvider.hashCode); + hash = JenkinsSmiHash.combine(hash, hoverProvider.hashCode); hash = JenkinsSmiHash.combine(hash, signatureHelpProvider.hashCode); + hash = JenkinsSmiHash.combine(hash, declarationProvider.hashCode); hash = JenkinsSmiHash.combine(hash, definitionProvider.hashCode); hash = JenkinsSmiHash.combine(hash, typeDefinitionProvider.hashCode); hash = JenkinsSmiHash.combine(hash, implementationProvider.hashCode); hash = JenkinsSmiHash.combine(hash, referencesProvider.hashCode); hash = JenkinsSmiHash.combine(hash, documentHighlightProvider.hashCode); hash = JenkinsSmiHash.combine(hash, documentSymbolProvider.hashCode); - hash = JenkinsSmiHash.combine(hash, workspaceSymbolProvider.hashCode); hash = JenkinsSmiHash.combine(hash, codeActionProvider.hashCode); hash = JenkinsSmiHash.combine(hash, codeLensProvider.hashCode); + hash = JenkinsSmiHash.combine(hash, documentLinkProvider.hashCode); + hash = JenkinsSmiHash.combine(hash, colorProvider.hashCode); hash = JenkinsSmiHash.combine(hash, documentFormattingProvider.hashCode); hash = JenkinsSmiHash.combine(hash, documentRangeFormattingProvider.hashCode); hash = JenkinsSmiHash.combine(hash, documentOnTypeFormattingProvider.hashCode); hash = JenkinsSmiHash.combine(hash, renameProvider.hashCode); - hash = JenkinsSmiHash.combine(hash, documentLinkProvider.hashCode); - hash = JenkinsSmiHash.combine(hash, colorProvider.hashCode); hash = JenkinsSmiHash.combine(hash, foldingRangeProvider.hashCode); - hash = JenkinsSmiHash.combine(hash, declarationProvider.hashCode); hash = JenkinsSmiHash.combine(hash, executeCommandProvider.hashCode); + hash = JenkinsSmiHash.combine(hash, selectionRangeProvider.hashCode); + hash = JenkinsSmiHash.combine(hash, workspaceSymbolProvider.hashCode); hash = JenkinsSmiHash.combine(hash, workspace.hashCode); hash = JenkinsSmiHash.combine(hash, experimental.hashCode); return JenkinsSmiHash.finish(hash); @@ -11004,15 +18754,14 @@ class ServerCapabilitiesWorkspace implements ToJsonable { ServerCapabilitiesWorkspace(this.workspaceFolders); static ServerCapabilitiesWorkspace fromJson(Map json) { final workspaceFolders = json['workspaceFolders'] != null - ? ServerCapabilitiesWorkspaceFolders.fromJson(json['workspaceFolders']) + ? WorkspaceFoldersServerCapabilities.fromJson(json['workspaceFolders']) : null; return ServerCapabilitiesWorkspace(workspaceFolders); } /// The server supports workspace folder. - /// - /// Since 3.6.0 - final ServerCapabilitiesWorkspaceFolders workspaceFolders; + /// @since 3.6.0 + final WorkspaceFoldersServerCapabilities workspaceFolders; Map toJson() { var __result = {}; @@ -11027,10 +18776,10 @@ class ServerCapabilitiesWorkspace implements ToJsonable { reporter.push('workspaceFolders'); try { if (obj['workspaceFolders'] != null && - !(ServerCapabilitiesWorkspaceFolders.canParse( + !(WorkspaceFoldersServerCapabilities.canParse( obj['workspaceFolders'], reporter))) { reporter.reportError( - 'must be of type ServerCapabilitiesWorkspaceFolders'); + 'must be of type WorkspaceFoldersServerCapabilities'); return false; } } finally { @@ -11063,93 +18812,6 @@ class ServerCapabilitiesWorkspace implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -class ServerCapabilitiesWorkspaceFolders implements ToJsonable { - static const jsonHandler = LspJsonHandler( - ServerCapabilitiesWorkspaceFolders.canParse, - ServerCapabilitiesWorkspaceFolders.fromJson); - - ServerCapabilitiesWorkspaceFolders(this.supported, this.changeNotifications); - static ServerCapabilitiesWorkspaceFolders fromJson( - Map json) { - final supported = json['supported']; - final changeNotifications = json['changeNotifications']; - return ServerCapabilitiesWorkspaceFolders(supported, changeNotifications); - } - - /// Whether the server wants to receive workspace folder change notifications. - /// - /// If a strings is provided the string is treated as a 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. - final bool changeNotifications; - - /// The server has support for workspace folders - final bool supported; - - Map toJson() { - var __result = {}; - if (supported != null) { - __result['supported'] = supported; - } - if (changeNotifications != null) { - __result['changeNotifications'] = changeNotifications; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('supported'); - try { - if (obj['supported'] != null && !(obj['supported'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('changeNotifications'); - try { - if (obj['changeNotifications'] != null && - !(obj['changeNotifications'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter - .reportError('must be of type ServerCapabilitiesWorkspaceFolders'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is ServerCapabilitiesWorkspaceFolders && - other.runtimeType == ServerCapabilitiesWorkspaceFolders) { - return supported == other.supported && - changeNotifications == other.changeNotifications && - true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, supported.hashCode); - hash = JenkinsSmiHash.combine(hash, changeNotifications.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - class ShowMessageParams implements ToJsonable { static const jsonHandler = LspJsonHandler(ShowMessageParams.canParse, ShowMessageParams.fromJson); @@ -11401,14 +19063,18 @@ class SignatureHelp implements ToJsonable { final num activeParameter; /// The active signature. If omitted or the value lies outside the range of - /// `signatures` the value defaults to zero or is ignored if - /// `signatures.length === 0`. Whenever possible implementors should make an - /// active decision about the active signature and shouldn't rely on a default - /// value. In future version of the protocol this property might become - /// mandatory to better express this. + /// `signatures` the value defaults to zero or is ignore if the + /// `SignatureHelp` as no signatures. + /// + /// Whenever possible implementors should make an active decision about the + /// active signature and shouldn't rely on a default value. + /// + /// In future version of the protocol this property might become mandatory to + /// better express this. final num activeSignature; - /// One or more signatures. + /// One or more signatures. If no signaures are availabe the signature help + /// request should return `null`. final List signatures; Map toJson() { @@ -11497,28 +19163,488 @@ class SignatureHelp implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -/// Signature help options. -class SignatureHelpOptions implements ToJsonable { +class SignatureHelpClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + SignatureHelpClientCapabilities.canParse, + SignatureHelpClientCapabilities.fromJson); + + SignatureHelpClientCapabilities( + this.dynamicRegistration, this.signatureInformation, this.contextSupport); + static SignatureHelpClientCapabilities fromJson(Map json) { + final dynamicRegistration = json['dynamicRegistration']; + final signatureInformation = json['signatureInformation'] != null + ? SignatureHelpClientCapabilitiesSignatureInformation.fromJson( + json['signatureInformation']) + : null; + final contextSupport = json['contextSupport']; + return SignatureHelpClientCapabilities( + dynamicRegistration, signatureInformation, contextSupport); + } + + /// The client supports to send additional context information for a + /// `textDocument/signatureHelp` request. A client that opts into + /// contextSupport will also support the `retriggerCharacters` on + /// `SignatureHelpOptions`. + /// @since 3.15.0 + final bool contextSupport; + + /// Whether signature help supports dynamic registration. + final bool dynamicRegistration; + + /// The client supports the following `SignatureInformation` specific + /// properties. + final SignatureHelpClientCapabilitiesSignatureInformation + signatureInformation; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + if (signatureInformation != null) { + __result['signatureInformation'] = signatureInformation; + } + if (contextSupport != null) { + __result['contextSupport'] = contextSupport; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('signatureInformation'); + try { + if (obj['signatureInformation'] != null && + !(SignatureHelpClientCapabilitiesSignatureInformation.canParse( + obj['signatureInformation'], reporter))) { + reporter.reportError( + 'must be of type SignatureHelpClientCapabilitiesSignatureInformation'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('contextSupport'); + try { + if (obj['contextSupport'] != null && !(obj['contextSupport'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type SignatureHelpClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is SignatureHelpClientCapabilities && + other.runtimeType == SignatureHelpClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && + signatureInformation == other.signatureInformation && + contextSupport == other.contextSupport && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + hash = JenkinsSmiHash.combine(hash, signatureInformation.hashCode); + hash = JenkinsSmiHash.combine(hash, contextSupport.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class SignatureHelpClientCapabilitiesParameterInformation + implements ToJsonable { + static const jsonHandler = LspJsonHandler( + SignatureHelpClientCapabilitiesParameterInformation.canParse, + SignatureHelpClientCapabilitiesParameterInformation.fromJson); + + SignatureHelpClientCapabilitiesParameterInformation(this.labelOffsetSupport); + static SignatureHelpClientCapabilitiesParameterInformation fromJson( + Map json) { + final labelOffsetSupport = json['labelOffsetSupport']; + return SignatureHelpClientCapabilitiesParameterInformation( + labelOffsetSupport); + } + + /// The client supports processing label offsets instead of a simple label + /// string. + /// @since 3.14.0 + final bool labelOffsetSupport; + + Map toJson() { + var __result = {}; + if (labelOffsetSupport != null) { + __result['labelOffsetSupport'] = labelOffsetSupport; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('labelOffsetSupport'); + try { + if (obj['labelOffsetSupport'] != null && + !(obj['labelOffsetSupport'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError( + 'must be of type SignatureHelpClientCapabilitiesParameterInformation'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is SignatureHelpClientCapabilitiesParameterInformation && + other.runtimeType == + SignatureHelpClientCapabilitiesParameterInformation) { + return labelOffsetSupport == other.labelOffsetSupport && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, labelOffsetSupport.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class SignatureHelpClientCapabilitiesSignatureInformation + implements ToJsonable { + static const jsonHandler = LspJsonHandler( + SignatureHelpClientCapabilitiesSignatureInformation.canParse, + SignatureHelpClientCapabilitiesSignatureInformation.fromJson); + + SignatureHelpClientCapabilitiesSignatureInformation( + this.documentationFormat, this.parameterInformation); + static SignatureHelpClientCapabilitiesSignatureInformation fromJson( + Map json) { + final documentationFormat = json['documentationFormat'] + ?.map((item) => item != null ? MarkupKind.fromJson(item) : null) + ?.cast() + ?.toList(); + final parameterInformation = json['parameterInformation'] != null + ? SignatureHelpClientCapabilitiesParameterInformation.fromJson( + json['parameterInformation']) + : null; + return SignatureHelpClientCapabilitiesSignatureInformation( + documentationFormat, parameterInformation); + } + + /// Client supports the follow content formats for the documentation property. + /// The order describes the preferred format of the client. + final List documentationFormat; + + /// Client capabilities specific to parameter information. + final SignatureHelpClientCapabilitiesParameterInformation + parameterInformation; + + Map toJson() { + var __result = {}; + if (documentationFormat != null) { + __result['documentationFormat'] = documentationFormat; + } + if (parameterInformation != null) { + __result['parameterInformation'] = parameterInformation; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('documentationFormat'); + try { + if (obj['documentationFormat'] != null && + !((obj['documentationFormat'] is List && + (obj['documentationFormat'] + .every((item) => MarkupKind.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('parameterInformation'); + try { + if (obj['parameterInformation'] != null && + !(SignatureHelpClientCapabilitiesParameterInformation.canParse( + obj['parameterInformation'], reporter))) { + reporter.reportError( + 'must be of type SignatureHelpClientCapabilitiesParameterInformation'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError( + 'must be of type SignatureHelpClientCapabilitiesSignatureInformation'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is SignatureHelpClientCapabilitiesSignatureInformation && + other.runtimeType == + SignatureHelpClientCapabilitiesSignatureInformation) { + return listEqual(documentationFormat, other.documentationFormat, + (MarkupKind a, MarkupKind b) => a == b) && + parameterInformation == other.parameterInformation && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, lspHashCode(documentationFormat)); + hash = JenkinsSmiHash.combine(hash, parameterInformation.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +/// Additional information about the context in which a signature help request +/// was triggered. +/// @since 3.15.0 +class SignatureHelpContext implements ToJsonable { + static const jsonHandler = LspJsonHandler( + SignatureHelpContext.canParse, SignatureHelpContext.fromJson); + + SignatureHelpContext(this.triggerKind, this.triggerCharacter, + this.isRetrigger, this.activeSignatureHelp) { + if (triggerKind == null) { + throw 'triggerKind is required but was not provided'; + } + if (isRetrigger == null) { + throw 'isRetrigger is required but was not provided'; + } + } + static SignatureHelpContext fromJson(Map json) { + final triggerKind = json['triggerKind'] != null + ? SignatureHelpTriggerKind.fromJson(json['triggerKind']) + : null; + final triggerCharacter = json['triggerCharacter']; + final isRetrigger = json['isRetrigger']; + final activeSignatureHelp = json['activeSignatureHelp'] != null + ? SignatureHelp.fromJson(json['activeSignatureHelp']) + : null; + return SignatureHelpContext( + triggerKind, triggerCharacter, isRetrigger, activeSignatureHelp); + } + + /// The currently active `SignatureHelp`. + /// + /// The `activeSignatureHelp` has its `SignatureHelp.activeSignature` field + /// updated based on the user navigating through available signatures. + final SignatureHelp activeSignatureHelp; + + /// `true` if signature help was already showing when it was triggered. + /// + /// Retriggers occur when the signature help is already active and can be + /// caused by actions such as typing a trigger character, a cursor move, or + /// document content changes. + final bool isRetrigger; + + /// Character that caused signature help to be triggered. + /// + /// This is undefined when `triggerKind !== + /// SignatureHelpTriggerKind.TriggerCharacter` + final String triggerCharacter; + + /// Action that caused signature help to be triggered. + final SignatureHelpTriggerKind triggerKind; + + Map toJson() { + var __result = {}; + __result['triggerKind'] = + triggerKind ?? (throw 'triggerKind is required but was not set'); + if (triggerCharacter != null) { + __result['triggerCharacter'] = triggerCharacter; + } + __result['isRetrigger'] = + isRetrigger ?? (throw 'isRetrigger is required but was not set'); + if (activeSignatureHelp != null) { + __result['activeSignatureHelp'] = activeSignatureHelp; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('triggerKind'); + try { + if (!obj.containsKey('triggerKind')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['triggerKind'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(SignatureHelpTriggerKind.canParse( + obj['triggerKind'], reporter))) { + reporter.reportError('must be of type SignatureHelpTriggerKind'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('triggerCharacter'); + try { + if (obj['triggerCharacter'] != null && + !(obj['triggerCharacter'] is String)) { + reporter.reportError('must be of type String'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('isRetrigger'); + try { + if (!obj.containsKey('isRetrigger')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['isRetrigger'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(obj['isRetrigger'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('activeSignatureHelp'); + try { + if (obj['activeSignatureHelp'] != null && + !(SignatureHelp.canParse(obj['activeSignatureHelp'], reporter))) { + reporter.reportError('must be of type SignatureHelp'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type SignatureHelpContext'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is SignatureHelpContext && + other.runtimeType == SignatureHelpContext) { + return triggerKind == other.triggerKind && + triggerCharacter == other.triggerCharacter && + isRetrigger == other.isRetrigger && + activeSignatureHelp == other.activeSignatureHelp && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, triggerKind.hashCode); + hash = JenkinsSmiHash.combine(hash, triggerCharacter.hashCode); + hash = JenkinsSmiHash.combine(hash, isRetrigger.hashCode); + hash = JenkinsSmiHash.combine(hash, activeSignatureHelp.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class SignatureHelpOptions implements WorkDoneProgressOptions, ToJsonable { static const jsonHandler = LspJsonHandler( SignatureHelpOptions.canParse, SignatureHelpOptions.fromJson); - SignatureHelpOptions(this.triggerCharacters); + SignatureHelpOptions( + this.triggerCharacters, this.retriggerCharacters, this.workDoneProgress); static SignatureHelpOptions fromJson(Map json) { + if (SignatureHelpRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return SignatureHelpRegistrationOptions.fromJson(json); + } final triggerCharacters = json['triggerCharacters'] ?.map((item) => item) ?.cast() ?.toList(); - return SignatureHelpOptions(triggerCharacters); + final retriggerCharacters = json['retriggerCharacters'] + ?.map((item) => item) + ?.cast() + ?.toList(); + final workDoneProgress = json['workDoneProgress']; + return SignatureHelpOptions( + triggerCharacters, retriggerCharacters, workDoneProgress); } + /// List of characters that re-trigger signature help. + /// + /// These trigger characters are only active when signature help is already + /// showing. All trigger characters are also counted as re-trigger characters. + /// @since 3.15.0 + final List retriggerCharacters; + /// The characters that trigger signature help automatically. final List triggerCharacters; + final bool workDoneProgress; Map toJson() { var __result = {}; if (triggerCharacters != null) { __result['triggerCharacters'] = triggerCharacters; } + if (retriggerCharacters != null) { + __result['retriggerCharacters'] = retriggerCharacters; + } + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } return __result; } @@ -11535,6 +19661,28 @@ class SignatureHelpOptions implements ToJsonable { } finally { reporter.pop(); } + reporter.push('retriggerCharacters'); + try { + if (obj['retriggerCharacters'] != null && + !((obj['retriggerCharacters'] is List && + (obj['retriggerCharacters'] + .every((item) => item is String))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type SignatureHelpOptions'); @@ -11548,6 +19696,9 @@ class SignatureHelpOptions implements ToJsonable { other.runtimeType == SignatureHelpOptions) { return listEqual(triggerCharacters, other.triggerCharacters, (String a, String b) => a == b) && + listEqual(retriggerCharacters, other.retriggerCharacters, + (String a, String b) => a == b) && + workDoneProgress == other.workDoneProgress && true; } return false; @@ -11557,6 +19708,162 @@ class SignatureHelpOptions implements ToJsonable { int get hashCode { var hash = 0; hash = JenkinsSmiHash.combine(hash, lspHashCode(triggerCharacters)); + hash = JenkinsSmiHash.combine(hash, lspHashCode(retriggerCharacters)); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class SignatureHelpParams + implements TextDocumentPositionParams, WorkDoneProgressParams, ToJsonable { + static const jsonHandler = LspJsonHandler( + SignatureHelpParams.canParse, SignatureHelpParams.fromJson); + + SignatureHelpParams( + this.context, this.textDocument, this.position, this.workDoneToken) { + if (textDocument == null) { + throw 'textDocument is required but was not provided'; + } + if (position == null) { + throw 'position is required but was not provided'; + } + } + static SignatureHelpParams fromJson(Map json) { + final context = json['context'] != null + ? SignatureHelpContext.fromJson(json['context']) + : null; + final textDocument = json['textDocument'] != null + ? TextDocumentIdentifier.fromJson(json['textDocument']) + : null; + final position = + json['position'] != null ? Position.fromJson(json['position']) : null; + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + return SignatureHelpParams(context, textDocument, position, workDoneToken); + } + + /// The signature help context. This is only available if the client specifies + /// to send this using the client capability + /// `textDocument.signatureHelp.contextSupport === true` + /// @since 3.15.0 + final SignatureHelpContext context; + + /// The position inside the text document. + final Position position; + + /// The text document. + final TextDocumentIdentifier textDocument; + + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + + Map toJson() { + var __result = {}; + if (context != null) { + __result['context'] = context; + } + __result['textDocument'] = + textDocument ?? (throw 'textDocument is required but was not set'); + __result['position'] = + position ?? (throw 'position is required but was not set'); + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('context'); + try { + if (obj['context'] != null && + !(SignatureHelpContext.canParse(obj['context'], reporter))) { + reporter.reportError('must be of type SignatureHelpContext'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('textDocument'); + try { + if (!obj.containsKey('textDocument')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['textDocument'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) { + reporter.reportError('must be of type TextDocumentIdentifier'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('position'); + try { + if (!obj.containsKey('position')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['position'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(Position.canParse(obj['position'], reporter))) { + reporter.reportError('must be of type Position'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneToken'); + try { + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type SignatureHelpParams'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is SignatureHelpParams && + other.runtimeType == SignatureHelpParams) { + return context == other.context && + textDocument == other.textDocument && + position == other.position && + workDoneToken == other.workDoneToken && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, context.hashCode); + hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); + hash = JenkinsSmiHash.combine(hash, position.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); return JenkinsSmiHash.finish(hash); } @@ -11565,55 +19872,66 @@ class SignatureHelpOptions implements ToJsonable { } class SignatureHelpRegistrationOptions - implements TextDocumentRegistrationOptions, ToJsonable { + implements + TextDocumentRegistrationOptions, + SignatureHelpOptions, + ToJsonable { static const jsonHandler = LspJsonHandler( SignatureHelpRegistrationOptions.canParse, SignatureHelpRegistrationOptions.fromJson); - SignatureHelpRegistrationOptions( - this.triggerCharacters, this.documentSelector); + SignatureHelpRegistrationOptions(this.documentSelector, + this.triggerCharacters, this.retriggerCharacters, this.workDoneProgress); static SignatureHelpRegistrationOptions fromJson(Map json) { - final triggerCharacters = json['triggerCharacters'] - ?.map((item) => item) - ?.cast() - ?.toList(); final documentSelector = json['documentSelector'] ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) ?.cast() ?.toList(); - return SignatureHelpRegistrationOptions( - triggerCharacters, documentSelector); + final triggerCharacters = json['triggerCharacters'] + ?.map((item) => item) + ?.cast() + ?.toList(); + final retriggerCharacters = json['retriggerCharacters'] + ?.map((item) => item) + ?.cast() + ?.toList(); + final workDoneProgress = json['workDoneProgress']; + return SignatureHelpRegistrationOptions(documentSelector, triggerCharacters, + retriggerCharacters, workDoneProgress); } /// 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. final List documentSelector; + /// List of characters that re-trigger signature help. + /// + /// These trigger characters are only active when signature help is already + /// showing. All trigger characters are also counted as re-trigger characters. + /// @since 3.15.0 + final List retriggerCharacters; + /// The characters that trigger signature help automatically. final List triggerCharacters; + final bool workDoneProgress; Map toJson() { var __result = {}; + __result['documentSelector'] = documentSelector; if (triggerCharacters != null) { __result['triggerCharacters'] = triggerCharacters; } - __result['documentSelector'] = documentSelector; + if (retriggerCharacters != null) { + __result['retriggerCharacters'] = retriggerCharacters; + } + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } return __result; } static bool canParse(Object obj, LspJsonReporter reporter) { if (obj is Map) { - reporter.push('triggerCharacters'); - try { - if (obj['triggerCharacters'] != null && - !((obj['triggerCharacters'] is List && - (obj['triggerCharacters'].every((item) => item is String))))) { - reporter.reportError('must be of type List'); - return false; - } - } finally { - reporter.pop(); - } reporter.push('documentSelector'); try { if (!obj.containsKey('documentSelector')) { @@ -11630,6 +19948,39 @@ class SignatureHelpRegistrationOptions } finally { reporter.pop(); } + reporter.push('triggerCharacters'); + try { + if (obj['triggerCharacters'] != null && + !((obj['triggerCharacters'] is List && + (obj['triggerCharacters'].every((item) => item is String))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('retriggerCharacters'); + try { + if (obj['retriggerCharacters'] != null && + !((obj['retriggerCharacters'] is List && + (obj['retriggerCharacters'] + .every((item) => item is String))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type SignatureHelpRegistrationOptions'); @@ -11641,10 +19992,13 @@ class SignatureHelpRegistrationOptions bool operator ==(Object other) { if (other is SignatureHelpRegistrationOptions && other.runtimeType == SignatureHelpRegistrationOptions) { - return listEqual(triggerCharacters, other.triggerCharacters, - (String a, String b) => a == b) && - listEqual(documentSelector, other.documentSelector, + return listEqual(documentSelector, other.documentSelector, (DocumentFilter a, DocumentFilter b) => a == b) && + listEqual(triggerCharacters, other.triggerCharacters, + (String a, String b) => a == b) && + listEqual(retriggerCharacters, other.retriggerCharacters, + (String a, String b) => a == b) && + workDoneProgress == other.workDoneProgress && true; } return false; @@ -11653,8 +20007,10 @@ class SignatureHelpRegistrationOptions @override int get hashCode { var hash = 0; - hash = JenkinsSmiHash.combine(hash, lspHashCode(triggerCharacters)); hash = JenkinsSmiHash.combine(hash, lspHashCode(documentSelector)); + hash = JenkinsSmiHash.combine(hash, lspHashCode(triggerCharacters)); + hash = JenkinsSmiHash.combine(hash, lspHashCode(retriggerCharacters)); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); return JenkinsSmiHash.finish(hash); } @@ -11662,6 +20018,40 @@ class SignatureHelpRegistrationOptions String toString() => jsonEncoder.convert(toJson()); } +/// How a signature help was triggered. +/// @since 3.15.0 +class SignatureHelpTriggerKind { + const SignatureHelpTriggerKind(this._value); + const SignatureHelpTriggerKind.fromJson(this._value); + + final num _value; + + static bool canParse(Object obj, LspJsonReporter reporter) { + return obj is num; + } + + /// Signature help was invoked manually by the user or by a command. + static const Invoked = SignatureHelpTriggerKind(1); + + /// Signature help was triggered by a trigger character. + static const TriggerCharacter = SignatureHelpTriggerKind(2); + + /// Signature help was triggered by the cursor moving or by the document + /// content changing. + static const ContentChange = SignatureHelpTriggerKind(3); + + Object toJson() => _value; + + @override + String toString() => _value.toString(); + + @override + int get hashCode => _value.hashCode; + + bool operator ==(Object o) => + o is SignatureHelpTriggerKind && o._value == _value; +} + /// Represents the signature of something callable. A signature can have a /// label, like a function-name, a doc-comment, and a set of parameters. class SignatureInformation implements ToJsonable { @@ -11797,6 +20187,24 @@ class StaticRegistrationOptions implements ToJsonable { StaticRegistrationOptions(this.id); static StaticRegistrationOptions fromJson(Map json) { + if (DeclarationRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return DeclarationRegistrationOptions.fromJson(json); + } + if (TypeDefinitionRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return TypeDefinitionRegistrationOptions.fromJson(json); + } + if (ImplementationRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return ImplementationRegistrationOptions.fromJson(json); + } + if (DocumentColorRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return DocumentColorRegistrationOptions.fromJson(json); + } + if (FoldingRangeRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return FoldingRangeRegistrationOptions.fromJson(json); + } + if (SelectionRangeRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return SelectionRangeRegistrationOptions.fromJson(json); + } final id = json['id']; return StaticRegistrationOptions(id); } @@ -12195,195 +20603,192 @@ class TextDocumentClientCapabilities implements ToJsonable { this.completion, this.hover, this.signatureHelp, - this.references, - this.documentHighlight, - this.documentSymbol, - this.formatting, - this.rangeFormatting, - this.onTypeFormatting, this.declaration, this.definition, this.typeDefinition, this.implementation, + this.references, + this.documentHighlight, + this.documentSymbol, this.codeAction, this.codeLens, this.documentLink, this.colorProvider, + this.formatting, + this.rangeFormatting, + this.onTypeFormatting, this.rename, this.publishDiagnostics, - this.foldingRange); + this.foldingRange, + this.selectionRange); static TextDocumentClientCapabilities fromJson(Map json) { final synchronization = json['synchronization'] != null - ? TextDocumentClientCapabilitiesSynchronization.fromJson( - json['synchronization']) + ? TextDocumentSyncClientCapabilities.fromJson(json['synchronization']) : null; final completion = json['completion'] != null - ? TextDocumentClientCapabilitiesCompletion.fromJson(json['completion']) + ? CompletionClientCapabilities.fromJson(json['completion']) : null; final hover = json['hover'] != null - ? TextDocumentClientCapabilitiesHover.fromJson(json['hover']) + ? HoverClientCapabilities.fromJson(json['hover']) : null; final signatureHelp = json['signatureHelp'] != null - ? TextDocumentClientCapabilitiesSignatureHelp.fromJson( - json['signatureHelp']) + ? SignatureHelpClientCapabilities.fromJson(json['signatureHelp']) + : null; + final declaration = json['declaration'] != null + ? DeclarationClientCapabilities.fromJson(json['declaration']) + : null; + final definition = json['definition'] != null + ? DefinitionClientCapabilities.fromJson(json['definition']) + : null; + final typeDefinition = json['typeDefinition'] != null + ? TypeDefinitionClientCapabilities.fromJson(json['typeDefinition']) + : null; + final implementation = json['implementation'] != null + ? ImplementationClientCapabilities.fromJson(json['implementation']) : null; final references = json['references'] != null - ? TextDocumentClientCapabilitiesReferences.fromJson(json['references']) + ? ReferenceClientCapabilities.fromJson(json['references']) : null; final documentHighlight = json['documentHighlight'] != null - ? TextDocumentClientCapabilitiesDocumentHighlight.fromJson( + ? DocumentHighlightClientCapabilities.fromJson( json['documentHighlight']) : null; final documentSymbol = json['documentSymbol'] != null - ? TextDocumentClientCapabilitiesDocumentSymbol.fromJson( - json['documentSymbol']) + ? DocumentSymbolClientCapabilities.fromJson(json['documentSymbol']) + : null; + final codeAction = json['codeAction'] != null + ? CodeActionClientCapabilities.fromJson(json['codeAction']) + : null; + final codeLens = json['codeLens'] != null + ? CodeLensClientCapabilities.fromJson(json['codeLens']) + : null; + final documentLink = json['documentLink'] != null + ? DocumentLinkClientCapabilities.fromJson(json['documentLink']) + : null; + final colorProvider = json['colorProvider'] != null + ? DocumentColorClientCapabilities.fromJson(json['colorProvider']) : null; final formatting = json['formatting'] != null - ? TextDocumentClientCapabilitiesFormatting.fromJson(json['formatting']) + ? DocumentFormattingClientCapabilities.fromJson(json['formatting']) : null; final rangeFormatting = json['rangeFormatting'] != null - ? TextDocumentClientCapabilitiesRangeFormatting.fromJson( + ? DocumentRangeFormattingClientCapabilities.fromJson( json['rangeFormatting']) : null; final onTypeFormatting = json['onTypeFormatting'] != null - ? TextDocumentClientCapabilitiesOnTypeFormatting.fromJson( + ? DocumentOnTypeFormattingClientCapabilities.fromJson( json['onTypeFormatting']) : null; - final declaration = json['declaration'] != null - ? TextDocumentClientCapabilitiesDeclaration.fromJson( - json['declaration']) - : null; - final definition = json['definition'] != null - ? TextDocumentClientCapabilitiesDefinition.fromJson(json['definition']) - : null; - final typeDefinition = json['typeDefinition'] != null - ? TextDocumentClientCapabilitiesTypeDefinition.fromJson( - json['typeDefinition']) - : null; - final implementation = json['implementation'] != null - ? TextDocumentClientCapabilitiesImplementation.fromJson( - json['implementation']) - : null; - final codeAction = json['codeAction'] != null - ? TextDocumentClientCapabilitiesCodeAction.fromJson(json['codeAction']) - : null; - final codeLens = json['codeLens'] != null - ? TextDocumentClientCapabilitiesCodeLens.fromJson(json['codeLens']) - : null; - final documentLink = json['documentLink'] != null - ? TextDocumentClientCapabilitiesDocumentLink.fromJson( - json['documentLink']) - : null; - final colorProvider = json['colorProvider'] != null - ? TextDocumentClientCapabilitiesColorProvider.fromJson( - json['colorProvider']) - : null; final rename = json['rename'] != null - ? TextDocumentClientCapabilitiesRename.fromJson(json['rename']) + ? RenameClientCapabilities.fromJson(json['rename']) : null; final publishDiagnostics = json['publishDiagnostics'] != null - ? TextDocumentClientCapabilitiesPublishDiagnostics.fromJson( + ? PublishDiagnosticsClientCapabilities.fromJson( json['publishDiagnostics']) : null; final foldingRange = json['foldingRange'] != null - ? TextDocumentClientCapabilitiesFoldingRange.fromJson( - json['foldingRange']) + ? FoldingRangeClientCapabilities.fromJson(json['foldingRange']) + : null; + final selectionRange = json['selectionRange'] != null + ? SelectionRangeClientCapabilities.fromJson(json['selectionRange']) : null; return TextDocumentClientCapabilities( synchronization, completion, hover, signatureHelp, - references, - documentHighlight, - documentSymbol, - formatting, - rangeFormatting, - onTypeFormatting, declaration, definition, typeDefinition, implementation, + references, + documentHighlight, + documentSymbol, codeAction, codeLens, documentLink, colorProvider, + formatting, + rangeFormatting, + onTypeFormatting, rename, publishDiagnostics, - foldingRange); + foldingRange, + selectionRange); } - /// Capabilities specific to the `textDocument/codeAction` - final TextDocumentClientCapabilitiesCodeAction codeAction; + /// Capabilities specific to the `textDocument/codeAction` request. + final CodeActionClientCapabilities codeAction; - /// Capabilities specific to the `textDocument/codeLens` - final TextDocumentClientCapabilitiesCodeLens codeLens; + /// Capabilities specific to the `textDocument/codeLens` request. + final CodeLensClientCapabilities codeLens; /// Capabilities specific to the `textDocument/documentColor` and the /// `textDocument/colorPresentation` request. - /// - /// Since 3.6.0 - final TextDocumentClientCapabilitiesColorProvider colorProvider; + /// @since 3.6.0 + final DocumentColorClientCapabilities colorProvider; - /// Capabilities specific to the `textDocument/completion` - final TextDocumentClientCapabilitiesCompletion completion; + /// Capabilities specific to the `textDocument/completion` request. + final CompletionClientCapabilities completion; - /// Capabilities specific to the `textDocument/declaration` - final TextDocumentClientCapabilitiesDeclaration declaration; + /// Capabilities specific to the `textDocument/declaration` request. + /// @since 3.14.0 + final DeclarationClientCapabilities declaration; - /// Capabilities specific to the `textDocument/definition`. - /// - /// Since 3.14.0 - final TextDocumentClientCapabilitiesDefinition definition; + /// Capabilities specific to the `textDocument/definition` request. + final DefinitionClientCapabilities definition; - /// Capabilities specific to the `textDocument/documentHighlight` - final TextDocumentClientCapabilitiesDocumentHighlight documentHighlight; + /// Capabilities specific to the `textDocument/documentHighlight` request. + final DocumentHighlightClientCapabilities documentHighlight; - /// Capabilities specific to the `textDocument/documentLink` - final TextDocumentClientCapabilitiesDocumentLink documentLink; + /// Capabilities specific to the `textDocument/documentLink` request. + final DocumentLinkClientCapabilities documentLink; - /// Capabilities specific to the `textDocument/documentSymbol` - final TextDocumentClientCapabilitiesDocumentSymbol documentSymbol; + /// Capabilities specific to the `textDocument/documentSymbol` request. + final DocumentSymbolClientCapabilities documentSymbol; - /// Capabilities specific to `textDocument/foldingRange` requests. - /// - /// Since 3.10.0 - final TextDocumentClientCapabilitiesFoldingRange foldingRange; + /// Capabilities specific to the `textDocument/foldingRange` request. + /// @since 3.10.0 + final FoldingRangeClientCapabilities foldingRange; - /// Capabilities specific to the `textDocument/formatting` - final TextDocumentClientCapabilitiesFormatting formatting; + /// Capabilities specific to the `textDocument/formatting` request. + final DocumentFormattingClientCapabilities formatting; - /// Capabilities specific to the `textDocument/hover` - final TextDocumentClientCapabilitiesHover hover; + /// Capabilities specific to the `textDocument/hover` request. + final HoverClientCapabilities hover; - /// Capabilities specific to the `textDocument/implementation`. - /// - /// Since 3.6.0 - final TextDocumentClientCapabilitiesImplementation implementation; + /// Capabilities specific to the `textDocument/implementation` request. + /// @since 3.6.0 + final ImplementationClientCapabilities implementation; - /// Capabilities specific to the `textDocument/onTypeFormatting` - final TextDocumentClientCapabilitiesOnTypeFormatting onTypeFormatting; + /// request. Capabilities specific to the `textDocument/onTypeFormatting` + /// request. + final DocumentOnTypeFormattingClientCapabilities onTypeFormatting; - /// Capabilities specific to `textDocument/publishDiagnostics`. - final TextDocumentClientCapabilitiesPublishDiagnostics publishDiagnostics; + /// Capabilities specific to the `textDocument/publishDiagnostics` + /// notification. + final PublishDiagnosticsClientCapabilities publishDiagnostics; - /// Capabilities specific to the `textDocument/rangeFormatting` - final TextDocumentClientCapabilitiesRangeFormatting rangeFormatting; + /// Capabilities specific to the `textDocument/rangeFormatting` request. + final DocumentRangeFormattingClientCapabilities rangeFormatting; - /// Capabilities specific to the `textDocument/references` - final TextDocumentClientCapabilitiesReferences references; + /// Capabilities specific to the `textDocument/references` request. + final ReferenceClientCapabilities references; - /// Capabilities specific to the `textDocument/rename` - final TextDocumentClientCapabilitiesRename rename; + /// Capabilities specific to the `textDocument/rename` request. + final RenameClientCapabilities rename; - /// Capabilities specific to the `textDocument/signatureHelp` - final TextDocumentClientCapabilitiesSignatureHelp signatureHelp; - final TextDocumentClientCapabilitiesSynchronization synchronization; + /// Capabilities specific to the `textDocument/selectionRange` request. + /// @since 3.15.0 + final SelectionRangeClientCapabilities selectionRange; - /// Capabilities specific to the `textDocument/typeDefinition` - /// - /// Since 3.6.0 - final TextDocumentClientCapabilitiesTypeDefinition typeDefinition; + /// Capabilities specific to the `textDocument/signatureHelp` request. + final SignatureHelpClientCapabilities signatureHelp; + final TextDocumentSyncClientCapabilities synchronization; + + /// Capabilities specific to the `textDocument/typeDefinition` request. + /// @since 3.6.0 + final TypeDefinitionClientCapabilities typeDefinition; Map toJson() { var __result = {}; @@ -12399,24 +20804,6 @@ class TextDocumentClientCapabilities implements ToJsonable { if (signatureHelp != null) { __result['signatureHelp'] = signatureHelp; } - if (references != null) { - __result['references'] = references; - } - if (documentHighlight != null) { - __result['documentHighlight'] = documentHighlight; - } - if (documentSymbol != null) { - __result['documentSymbol'] = documentSymbol; - } - if (formatting != null) { - __result['formatting'] = formatting; - } - if (rangeFormatting != null) { - __result['rangeFormatting'] = rangeFormatting; - } - if (onTypeFormatting != null) { - __result['onTypeFormatting'] = onTypeFormatting; - } if (declaration != null) { __result['declaration'] = declaration; } @@ -12429,6 +20816,15 @@ class TextDocumentClientCapabilities implements ToJsonable { if (implementation != null) { __result['implementation'] = implementation; } + if (references != null) { + __result['references'] = references; + } + if (documentHighlight != null) { + __result['documentHighlight'] = documentHighlight; + } + if (documentSymbol != null) { + __result['documentSymbol'] = documentSymbol; + } if (codeAction != null) { __result['codeAction'] = codeAction; } @@ -12441,6 +20837,15 @@ class TextDocumentClientCapabilities implements ToJsonable { if (colorProvider != null) { __result['colorProvider'] = colorProvider; } + if (formatting != null) { + __result['formatting'] = formatting; + } + if (rangeFormatting != null) { + __result['rangeFormatting'] = rangeFormatting; + } + if (onTypeFormatting != null) { + __result['onTypeFormatting'] = onTypeFormatting; + } if (rename != null) { __result['rename'] = rename; } @@ -12450,6 +20855,9 @@ class TextDocumentClientCapabilities implements ToJsonable { if (foldingRange != null) { __result['foldingRange'] = foldingRange; } + if (selectionRange != null) { + __result['selectionRange'] = selectionRange; + } return __result; } @@ -12458,10 +20866,10 @@ class TextDocumentClientCapabilities implements ToJsonable { reporter.push('synchronization'); try { if (obj['synchronization'] != null && - !(TextDocumentClientCapabilitiesSynchronization.canParse( + !(TextDocumentSyncClientCapabilities.canParse( obj['synchronization'], reporter))) { reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesSynchronization'); + 'must be of type TextDocumentSyncClientCapabilities'); return false; } } finally { @@ -12470,10 +20878,9 @@ class TextDocumentClientCapabilities implements ToJsonable { reporter.push('completion'); try { if (obj['completion'] != null && - !(TextDocumentClientCapabilitiesCompletion.canParse( + !(CompletionClientCapabilities.canParse( obj['completion'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesCompletion'); + reporter.reportError('must be of type CompletionClientCapabilities'); return false; } } finally { @@ -12482,10 +20889,8 @@ class TextDocumentClientCapabilities implements ToJsonable { reporter.push('hover'); try { if (obj['hover'] != null && - !(TextDocumentClientCapabilitiesHover.canParse( - obj['hover'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesHover'); + !(HoverClientCapabilities.canParse(obj['hover'], reporter))) { + reporter.reportError('must be of type HoverClientCapabilities'); return false; } } finally { @@ -12494,82 +20899,10 @@ class TextDocumentClientCapabilities implements ToJsonable { reporter.push('signatureHelp'); try { if (obj['signatureHelp'] != null && - !(TextDocumentClientCapabilitiesSignatureHelp.canParse( + !(SignatureHelpClientCapabilities.canParse( obj['signatureHelp'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesSignatureHelp'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('references'); - try { - if (obj['references'] != null && - !(TextDocumentClientCapabilitiesReferences.canParse( - obj['references'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesReferences'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('documentHighlight'); - try { - if (obj['documentHighlight'] != null && - !(TextDocumentClientCapabilitiesDocumentHighlight.canParse( - obj['documentHighlight'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesDocumentHighlight'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('documentSymbol'); - try { - if (obj['documentSymbol'] != null && - !(TextDocumentClientCapabilitiesDocumentSymbol.canParse( - obj['documentSymbol'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesDocumentSymbol'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('formatting'); - try { - if (obj['formatting'] != null && - !(TextDocumentClientCapabilitiesFormatting.canParse( - obj['formatting'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesFormatting'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('rangeFormatting'); - try { - if (obj['rangeFormatting'] != null && - !(TextDocumentClientCapabilitiesRangeFormatting.canParse( - obj['rangeFormatting'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesRangeFormatting'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('onTypeFormatting'); - try { - if (obj['onTypeFormatting'] != null && - !(TextDocumentClientCapabilitiesOnTypeFormatting.canParse( - obj['onTypeFormatting'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesOnTypeFormatting'); + reporter + .reportError('must be of type SignatureHelpClientCapabilities'); return false; } } finally { @@ -12578,10 +20911,9 @@ class TextDocumentClientCapabilities implements ToJsonable { reporter.push('declaration'); try { if (obj['declaration'] != null && - !(TextDocumentClientCapabilitiesDeclaration.canParse( + !(DeclarationClientCapabilities.canParse( obj['declaration'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesDeclaration'); + reporter.reportError('must be of type DeclarationClientCapabilities'); return false; } } finally { @@ -12590,10 +20922,9 @@ class TextDocumentClientCapabilities implements ToJsonable { reporter.push('definition'); try { if (obj['definition'] != null && - !(TextDocumentClientCapabilitiesDefinition.canParse( + !(DefinitionClientCapabilities.canParse( obj['definition'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesDefinition'); + reporter.reportError('must be of type DefinitionClientCapabilities'); return false; } } finally { @@ -12602,10 +20933,10 @@ class TextDocumentClientCapabilities implements ToJsonable { reporter.push('typeDefinition'); try { if (obj['typeDefinition'] != null && - !(TextDocumentClientCapabilitiesTypeDefinition.canParse( + !(TypeDefinitionClientCapabilities.canParse( obj['typeDefinition'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesTypeDefinition'); + reporter + .reportError('must be of type TypeDefinitionClientCapabilities'); return false; } } finally { @@ -12614,10 +20945,45 @@ class TextDocumentClientCapabilities implements ToJsonable { reporter.push('implementation'); try { if (obj['implementation'] != null && - !(TextDocumentClientCapabilitiesImplementation.canParse( + !(ImplementationClientCapabilities.canParse( obj['implementation'], reporter))) { + reporter + .reportError('must be of type ImplementationClientCapabilities'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('references'); + try { + if (obj['references'] != null && + !(ReferenceClientCapabilities.canParse( + obj['references'], reporter))) { + reporter.reportError('must be of type ReferenceClientCapabilities'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('documentHighlight'); + try { + if (obj['documentHighlight'] != null && + !(DocumentHighlightClientCapabilities.canParse( + obj['documentHighlight'], reporter))) { reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesImplementation'); + 'must be of type DocumentHighlightClientCapabilities'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('documentSymbol'); + try { + if (obj['documentSymbol'] != null && + !(DocumentSymbolClientCapabilities.canParse( + obj['documentSymbol'], reporter))) { + reporter + .reportError('must be of type DocumentSymbolClientCapabilities'); return false; } } finally { @@ -12626,10 +20992,9 @@ class TextDocumentClientCapabilities implements ToJsonable { reporter.push('codeAction'); try { if (obj['codeAction'] != null && - !(TextDocumentClientCapabilitiesCodeAction.canParse( + !(CodeActionClientCapabilities.canParse( obj['codeAction'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesCodeAction'); + reporter.reportError('must be of type CodeActionClientCapabilities'); return false; } } finally { @@ -12638,10 +21003,8 @@ class TextDocumentClientCapabilities implements ToJsonable { reporter.push('codeLens'); try { if (obj['codeLens'] != null && - !(TextDocumentClientCapabilitiesCodeLens.canParse( - obj['codeLens'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesCodeLens'); + !(CodeLensClientCapabilities.canParse(obj['codeLens'], reporter))) { + reporter.reportError('must be of type CodeLensClientCapabilities'); return false; } } finally { @@ -12650,10 +21013,10 @@ class TextDocumentClientCapabilities implements ToJsonable { reporter.push('documentLink'); try { if (obj['documentLink'] != null && - !(TextDocumentClientCapabilitiesDocumentLink.canParse( + !(DocumentLinkClientCapabilities.canParse( obj['documentLink'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesDocumentLink'); + reporter + .reportError('must be of type DocumentLinkClientCapabilities'); return false; } } finally { @@ -12662,10 +21025,46 @@ class TextDocumentClientCapabilities implements ToJsonable { reporter.push('colorProvider'); try { if (obj['colorProvider'] != null && - !(TextDocumentClientCapabilitiesColorProvider.canParse( + !(DocumentColorClientCapabilities.canParse( obj['colorProvider'], reporter))) { + reporter + .reportError('must be of type DocumentColorClientCapabilities'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('formatting'); + try { + if (obj['formatting'] != null && + !(DocumentFormattingClientCapabilities.canParse( + obj['formatting'], reporter))) { reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesColorProvider'); + 'must be of type DocumentFormattingClientCapabilities'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('rangeFormatting'); + try { + if (obj['rangeFormatting'] != null && + !(DocumentRangeFormattingClientCapabilities.canParse( + obj['rangeFormatting'], reporter))) { + reporter.reportError( + 'must be of type DocumentRangeFormattingClientCapabilities'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('onTypeFormatting'); + try { + if (obj['onTypeFormatting'] != null && + !(DocumentOnTypeFormattingClientCapabilities.canParse( + obj['onTypeFormatting'], reporter))) { + reporter.reportError( + 'must be of type DocumentOnTypeFormattingClientCapabilities'); return false; } } finally { @@ -12674,10 +21073,8 @@ class TextDocumentClientCapabilities implements ToJsonable { reporter.push('rename'); try { if (obj['rename'] != null && - !(TextDocumentClientCapabilitiesRename.canParse( - obj['rename'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesRename'); + !(RenameClientCapabilities.canParse(obj['rename'], reporter))) { + reporter.reportError('must be of type RenameClientCapabilities'); return false; } } finally { @@ -12686,10 +21083,10 @@ class TextDocumentClientCapabilities implements ToJsonable { reporter.push('publishDiagnostics'); try { if (obj['publishDiagnostics'] != null && - !(TextDocumentClientCapabilitiesPublishDiagnostics.canParse( + !(PublishDiagnosticsClientCapabilities.canParse( obj['publishDiagnostics'], reporter))) { reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesPublishDiagnostics'); + 'must be of type PublishDiagnosticsClientCapabilities'); return false; } } finally { @@ -12698,10 +21095,22 @@ class TextDocumentClientCapabilities implements ToJsonable { reporter.push('foldingRange'); try { if (obj['foldingRange'] != null && - !(TextDocumentClientCapabilitiesFoldingRange.canParse( + !(FoldingRangeClientCapabilities.canParse( obj['foldingRange'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesFoldingRange'); + reporter + .reportError('must be of type FoldingRangeClientCapabilities'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('selectionRange'); + try { + if (obj['selectionRange'] != null && + !(SelectionRangeClientCapabilities.canParse( + obj['selectionRange'], reporter))) { + reporter + .reportError('must be of type SelectionRangeClientCapabilities'); return false; } } finally { @@ -12722,23 +21131,24 @@ class TextDocumentClientCapabilities implements ToJsonable { completion == other.completion && hover == other.hover && signatureHelp == other.signatureHelp && - references == other.references && - documentHighlight == other.documentHighlight && - documentSymbol == other.documentSymbol && - formatting == other.formatting && - rangeFormatting == other.rangeFormatting && - onTypeFormatting == other.onTypeFormatting && declaration == other.declaration && definition == other.definition && typeDefinition == other.typeDefinition && implementation == other.implementation && + references == other.references && + documentHighlight == other.documentHighlight && + documentSymbol == other.documentSymbol && codeAction == other.codeAction && codeLens == other.codeLens && documentLink == other.documentLink && colorProvider == other.colorProvider && + formatting == other.formatting && + rangeFormatting == other.rangeFormatting && + onTypeFormatting == other.onTypeFormatting && rename == other.rename && publishDiagnostics == other.publishDiagnostics && foldingRange == other.foldingRange && + selectionRange == other.selectionRange && true; } return false; @@ -12751,23 +21161,24 @@ class TextDocumentClientCapabilities implements ToJsonable { hash = JenkinsSmiHash.combine(hash, completion.hashCode); hash = JenkinsSmiHash.combine(hash, hover.hashCode); hash = JenkinsSmiHash.combine(hash, signatureHelp.hashCode); - hash = JenkinsSmiHash.combine(hash, references.hashCode); - hash = JenkinsSmiHash.combine(hash, documentHighlight.hashCode); - hash = JenkinsSmiHash.combine(hash, documentSymbol.hashCode); - hash = JenkinsSmiHash.combine(hash, formatting.hashCode); - hash = JenkinsSmiHash.combine(hash, rangeFormatting.hashCode); - hash = JenkinsSmiHash.combine(hash, onTypeFormatting.hashCode); hash = JenkinsSmiHash.combine(hash, declaration.hashCode); hash = JenkinsSmiHash.combine(hash, definition.hashCode); hash = JenkinsSmiHash.combine(hash, typeDefinition.hashCode); hash = JenkinsSmiHash.combine(hash, implementation.hashCode); + hash = JenkinsSmiHash.combine(hash, references.hashCode); + hash = JenkinsSmiHash.combine(hash, documentHighlight.hashCode); + hash = JenkinsSmiHash.combine(hash, documentSymbol.hashCode); hash = JenkinsSmiHash.combine(hash, codeAction.hashCode); hash = JenkinsSmiHash.combine(hash, codeLens.hashCode); hash = JenkinsSmiHash.combine(hash, documentLink.hashCode); hash = JenkinsSmiHash.combine(hash, colorProvider.hashCode); + hash = JenkinsSmiHash.combine(hash, formatting.hashCode); + hash = JenkinsSmiHash.combine(hash, rangeFormatting.hashCode); + hash = JenkinsSmiHash.combine(hash, onTypeFormatting.hashCode); hash = JenkinsSmiHash.combine(hash, rename.hashCode); hash = JenkinsSmiHash.combine(hash, publishDiagnostics.hashCode); hash = JenkinsSmiHash.combine(hash, foldingRange.hashCode); + hash = JenkinsSmiHash.combine(hash, selectionRange.hashCode); return JenkinsSmiHash.finish(hash); } @@ -12775,2441 +21186,40 @@ class TextDocumentClientCapabilities implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -class TextDocumentClientCapabilitiesCodeAction implements ToJsonable { +class TextDocumentContentChangeEvent1 implements ToJsonable { static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesCodeAction.canParse, - TextDocumentClientCapabilitiesCodeAction.fromJson); + TextDocumentContentChangeEvent1.canParse, + TextDocumentContentChangeEvent1.fromJson); - TextDocumentClientCapabilitiesCodeAction( - this.dynamicRegistration, this.codeActionLiteralSupport); - static TextDocumentClientCapabilitiesCodeAction fromJson( - Map json) { - final dynamicRegistration = json['dynamicRegistration']; - final codeActionLiteralSupport = json['codeActionLiteralSupport'] != null - ? TextDocumentClientCapabilitiesCodeActionLiteralSupport.fromJson( - json['codeActionLiteralSupport']) - : null; - return TextDocumentClientCapabilitiesCodeAction( - dynamicRegistration, codeActionLiteralSupport); - } - - /// The client support code action literals as a valid response of the - /// `textDocument/codeAction` request. - /// - /// Since 3.8.0 - final TextDocumentClientCapabilitiesCodeActionLiteralSupport - codeActionLiteralSupport; - - /// Whether code action supports dynamic registration. - final bool dynamicRegistration; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - if (codeActionLiteralSupport != null) { - __result['codeActionLiteralSupport'] = codeActionLiteralSupport; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('codeActionLiteralSupport'); - try { - if (obj['codeActionLiteralSupport'] != null && - !(TextDocumentClientCapabilitiesCodeActionLiteralSupport.canParse( - obj['codeActionLiteralSupport'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesCodeActionLiteralSupport'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesCodeAction'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesCodeAction && - other.runtimeType == TextDocumentClientCapabilitiesCodeAction) { - return dynamicRegistration == other.dynamicRegistration && - codeActionLiteralSupport == other.codeActionLiteralSupport && - true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - hash = JenkinsSmiHash.combine(hash, codeActionLiteralSupport.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesCodeActionKind implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesCodeActionKind.canParse, - TextDocumentClientCapabilitiesCodeActionKind.fromJson); - - TextDocumentClientCapabilitiesCodeActionKind(this.valueSet) { - if (valueSet == null) { - throw 'valueSet is required but was not provided'; - } - } - static TextDocumentClientCapabilitiesCodeActionKind fromJson( - Map json) { - final valueSet = json['valueSet'] - ?.map((item) => item != null ? CodeActionKind.fromJson(item) : null) - ?.cast() - ?.toList(); - return TextDocumentClientCapabilitiesCodeActionKind(valueSet); - } - - /// The code action kind values the client supports. When this property exists - /// the client also guarantees that it will handle values outside its set - /// gracefully and falls back to a default value when unknown. - final List valueSet; - - Map toJson() { - var __result = {}; - __result['valueSet'] = - valueSet ?? (throw 'valueSet is required but was not set'); - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('valueSet'); - try { - if (!obj.containsKey('valueSet')) { - reporter.reportError('must not be undefined'); - return false; - } - if (obj['valueSet'] == null) { - reporter.reportError('must not be null'); - return false; - } - if (!((obj['valueSet'] is List && - (obj['valueSet'] - .every((item) => CodeActionKind.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesCodeActionKind'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesCodeActionKind && - other.runtimeType == TextDocumentClientCapabilitiesCodeActionKind) { - return listEqual(valueSet, other.valueSet, - (CodeActionKind a, CodeActionKind b) => a == b) && - true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, lspHashCode(valueSet)); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesCodeActionLiteralSupport - implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesCodeActionLiteralSupport.canParse, - TextDocumentClientCapabilitiesCodeActionLiteralSupport.fromJson); - - TextDocumentClientCapabilitiesCodeActionLiteralSupport(this.codeActionKind) { - if (codeActionKind == null) { - throw 'codeActionKind is required but was not provided'; - } - } - static TextDocumentClientCapabilitiesCodeActionLiteralSupport fromJson( - Map json) { - final codeActionKind = json['codeActionKind'] != null - ? TextDocumentClientCapabilitiesCodeActionKind.fromJson( - json['codeActionKind']) - : null; - return TextDocumentClientCapabilitiesCodeActionLiteralSupport( - codeActionKind); - } - - /// The code action kind is support with the following value set. - final TextDocumentClientCapabilitiesCodeActionKind codeActionKind; - - Map toJson() { - var __result = {}; - __result['codeActionKind'] = - codeActionKind ?? (throw 'codeActionKind is required but was not set'); - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('codeActionKind'); - try { - if (!obj.containsKey('codeActionKind')) { - reporter.reportError('must not be undefined'); - return false; - } - if (obj['codeActionKind'] == null) { - reporter.reportError('must not be null'); - return false; - } - if (!(TextDocumentClientCapabilitiesCodeActionKind.canParse( - obj['codeActionKind'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesCodeActionKind'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesCodeActionLiteralSupport'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesCodeActionLiteralSupport && - other.runtimeType == - TextDocumentClientCapabilitiesCodeActionLiteralSupport) { - return codeActionKind == other.codeActionKind && true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, codeActionKind.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesCodeLens implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesCodeLens.canParse, - TextDocumentClientCapabilitiesCodeLens.fromJson); - - TextDocumentClientCapabilitiesCodeLens(this.dynamicRegistration); - static TextDocumentClientCapabilitiesCodeLens fromJson( - Map json) { - final dynamicRegistration = json['dynamicRegistration']; - return TextDocumentClientCapabilitiesCodeLens(dynamicRegistration); - } - - /// Whether code lens supports dynamic registration. - final bool dynamicRegistration; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesCodeLens'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesCodeLens && - other.runtimeType == TextDocumentClientCapabilitiesCodeLens) { - return dynamicRegistration == other.dynamicRegistration && true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesColorProvider implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesColorProvider.canParse, - TextDocumentClientCapabilitiesColorProvider.fromJson); - - TextDocumentClientCapabilitiesColorProvider(this.dynamicRegistration); - static TextDocumentClientCapabilitiesColorProvider fromJson( - Map json) { - final dynamicRegistration = json['dynamicRegistration']; - return TextDocumentClientCapabilitiesColorProvider(dynamicRegistration); - } - - /// Whether colorProvider supports dynamic registration. If this is set to - /// `true` the client supports the new `(ColorProviderOptions & - /// TextDocumentRegistrationOptions & StaticRegistrationOptions)` return value - /// for the corresponding server capability as well. - final bool dynamicRegistration; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesColorProvider'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesColorProvider && - other.runtimeType == TextDocumentClientCapabilitiesColorProvider) { - return dynamicRegistration == other.dynamicRegistration && true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesCompletion implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesCompletion.canParse, - TextDocumentClientCapabilitiesCompletion.fromJson); - - TextDocumentClientCapabilitiesCompletion(this.dynamicRegistration, - this.completionItem, this.completionItemKind, this.contextSupport); - static TextDocumentClientCapabilitiesCompletion fromJson( - Map json) { - final dynamicRegistration = json['dynamicRegistration']; - final completionItem = json['completionItem'] != null - ? TextDocumentClientCapabilitiesCompletionItem.fromJson( - json['completionItem']) - : null; - final completionItemKind = json['completionItemKind'] != null - ? TextDocumentClientCapabilitiesCompletionItemKind.fromJson( - json['completionItemKind']) - : null; - final contextSupport = json['contextSupport']; - return TextDocumentClientCapabilitiesCompletion(dynamicRegistration, - completionItem, completionItemKind, contextSupport); - } - - /// The client supports the following `CompletionItem` specific capabilities. - final TextDocumentClientCapabilitiesCompletionItem completionItem; - final TextDocumentClientCapabilitiesCompletionItemKind completionItemKind; - - /// The client supports to send additional context information for a - /// `textDocument/completion` request. - final bool contextSupport; - - /// Whether completion supports dynamic registration. - final bool dynamicRegistration; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - if (completionItem != null) { - __result['completionItem'] = completionItem; - } - if (completionItemKind != null) { - __result['completionItemKind'] = completionItemKind; - } - if (contextSupport != null) { - __result['contextSupport'] = contextSupport; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('completionItem'); - try { - if (obj['completionItem'] != null && - !(TextDocumentClientCapabilitiesCompletionItem.canParse( - obj['completionItem'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesCompletionItem'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('completionItemKind'); - try { - if (obj['completionItemKind'] != null && - !(TextDocumentClientCapabilitiesCompletionItemKind.canParse( - obj['completionItemKind'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesCompletionItemKind'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('contextSupport'); - try { - if (obj['contextSupport'] != null && !(obj['contextSupport'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesCompletion'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesCompletion && - other.runtimeType == TextDocumentClientCapabilitiesCompletion) { - return dynamicRegistration == other.dynamicRegistration && - completionItem == other.completionItem && - completionItemKind == other.completionItemKind && - contextSupport == other.contextSupport && - true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - hash = JenkinsSmiHash.combine(hash, completionItem.hashCode); - hash = JenkinsSmiHash.combine(hash, completionItemKind.hashCode); - hash = JenkinsSmiHash.combine(hash, contextSupport.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesCompletionItem implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesCompletionItem.canParse, - TextDocumentClientCapabilitiesCompletionItem.fromJson); - - TextDocumentClientCapabilitiesCompletionItem( - this.snippetSupport, - this.commitCharactersSupport, - this.documentationFormat, - this.deprecatedSupport, - this.preselectSupport); - static TextDocumentClientCapabilitiesCompletionItem fromJson( - Map json) { - final snippetSupport = json['snippetSupport']; - final commitCharactersSupport = json['commitCharactersSupport']; - final documentationFormat = json['documentationFormat'] - ?.map((item) => item != null ? MarkupKind.fromJson(item) : null) - ?.cast() - ?.toList(); - final deprecatedSupport = json['deprecatedSupport']; - final preselectSupport = json['preselectSupport']; - return TextDocumentClientCapabilitiesCompletionItem( - snippetSupport, - commitCharactersSupport, - documentationFormat, - deprecatedSupport, - preselectSupport); - } - - /// The client supports commit characters on a completion item. - final bool commitCharactersSupport; - - /// The client supports the deprecated property on a completion item. - final bool deprecatedSupport; - - /// The client supports the following content formats for the documentation - /// property. The order describes the preferred format of the client. - final List documentationFormat; - - /// The client supports the preselect property on a completion item. - final bool preselectSupport; - - /// The client supports snippets as insert text. - /// - /// A snippet can define tab stops and placeholders with `$1`, `$2` and - /// `${3:foo}`. `$0` defines the final tab stop, it defaults to the end of the - /// snippet. Placeholders with equal identifiers are linked, that is typing in - /// one will update others too. - final bool snippetSupport; - - Map toJson() { - var __result = {}; - if (snippetSupport != null) { - __result['snippetSupport'] = snippetSupport; - } - if (commitCharactersSupport != null) { - __result['commitCharactersSupport'] = commitCharactersSupport; - } - if (documentationFormat != null) { - __result['documentationFormat'] = documentationFormat; - } - if (deprecatedSupport != null) { - __result['deprecatedSupport'] = deprecatedSupport; - } - if (preselectSupport != null) { - __result['preselectSupport'] = preselectSupport; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('snippetSupport'); - try { - if (obj['snippetSupport'] != null && !(obj['snippetSupport'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('commitCharactersSupport'); - try { - if (obj['commitCharactersSupport'] != null && - !(obj['commitCharactersSupport'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('documentationFormat'); - try { - if (obj['documentationFormat'] != null && - !((obj['documentationFormat'] is List && - (obj['documentationFormat'] - .every((item) => MarkupKind.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('deprecatedSupport'); - try { - if (obj['deprecatedSupport'] != null && - !(obj['deprecatedSupport'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('preselectSupport'); - try { - if (obj['preselectSupport'] != null && - !(obj['preselectSupport'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesCompletionItem'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesCompletionItem && - other.runtimeType == TextDocumentClientCapabilitiesCompletionItem) { - return snippetSupport == other.snippetSupport && - commitCharactersSupport == other.commitCharactersSupport && - listEqual(documentationFormat, other.documentationFormat, - (MarkupKind a, MarkupKind b) => a == b) && - deprecatedSupport == other.deprecatedSupport && - preselectSupport == other.preselectSupport && - true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, snippetSupport.hashCode); - hash = JenkinsSmiHash.combine(hash, commitCharactersSupport.hashCode); - hash = JenkinsSmiHash.combine(hash, lspHashCode(documentationFormat)); - hash = JenkinsSmiHash.combine(hash, deprecatedSupport.hashCode); - hash = JenkinsSmiHash.combine(hash, preselectSupport.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesCompletionItemKind implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesCompletionItemKind.canParse, - TextDocumentClientCapabilitiesCompletionItemKind.fromJson); - - TextDocumentClientCapabilitiesCompletionItemKind(this.valueSet); - static TextDocumentClientCapabilitiesCompletionItemKind fromJson( - Map json) { - final valueSet = json['valueSet'] - ?.map((item) => item != null ? CompletionItemKind.fromJson(item) : null) - ?.cast() - ?.toList(); - return TextDocumentClientCapabilitiesCompletionItemKind(valueSet); - } - - /// The completion item kind values the client supports. When this property - /// exists the client also guarantees that it will handle values outside its - /// set gracefully and falls back to a default value when unknown. - /// - /// If this property is not present the client only supports the completion - /// items kinds from `Text` to `Reference` as defined in the initial version - /// of the protocol. - final List valueSet; - - Map toJson() { - var __result = {}; - if (valueSet != null) { - __result['valueSet'] = valueSet; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('valueSet'); - try { - if (obj['valueSet'] != null && - !((obj['valueSet'] is List && - (obj['valueSet'].every( - (item) => CompletionItemKind.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesCompletionItemKind'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesCompletionItemKind && - other.runtimeType == TextDocumentClientCapabilitiesCompletionItemKind) { - return listEqual(valueSet, other.valueSet, - (CompletionItemKind a, CompletionItemKind b) => a == b) && - true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, lspHashCode(valueSet)); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesDeclaration implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesDeclaration.canParse, - TextDocumentClientCapabilitiesDeclaration.fromJson); - - TextDocumentClientCapabilitiesDeclaration( - this.dynamicRegistration, this.linkSupport); - static TextDocumentClientCapabilitiesDeclaration fromJson( - Map json) { - final dynamicRegistration = json['dynamicRegistration']; - final linkSupport = json['linkSupport']; - return TextDocumentClientCapabilitiesDeclaration( - dynamicRegistration, linkSupport); - } - - /// Whether declaration supports dynamic registration. If this is set to - /// `true` the client supports the new `(TextDocumentRegistrationOptions & - /// StaticRegistrationOptions)` return value for the corresponding server - /// capability as well. - final bool dynamicRegistration; - - /// The client supports additional metadata in the form of declaration links. - /// - /// Since 3.14.0 - final bool linkSupport; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - if (linkSupport != null) { - __result['linkSupport'] = linkSupport; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('linkSupport'); - try { - if (obj['linkSupport'] != null && !(obj['linkSupport'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesDeclaration'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesDeclaration && - other.runtimeType == TextDocumentClientCapabilitiesDeclaration) { - return dynamicRegistration == other.dynamicRegistration && - linkSupport == other.linkSupport && - true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - hash = JenkinsSmiHash.combine(hash, linkSupport.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesDefinition implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesDefinition.canParse, - TextDocumentClientCapabilitiesDefinition.fromJson); - - TextDocumentClientCapabilitiesDefinition( - this.dynamicRegistration, this.linkSupport); - static TextDocumentClientCapabilitiesDefinition fromJson( - Map json) { - final dynamicRegistration = json['dynamicRegistration']; - final linkSupport = json['linkSupport']; - return TextDocumentClientCapabilitiesDefinition( - dynamicRegistration, linkSupport); - } - - /// Whether definition supports dynamic registration. - final bool dynamicRegistration; - - /// The client supports additional metadata in the form of definition links. - final bool linkSupport; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - if (linkSupport != null) { - __result['linkSupport'] = linkSupport; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('linkSupport'); - try { - if (obj['linkSupport'] != null && !(obj['linkSupport'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesDefinition'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesDefinition && - other.runtimeType == TextDocumentClientCapabilitiesDefinition) { - return dynamicRegistration == other.dynamicRegistration && - linkSupport == other.linkSupport && - true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - hash = JenkinsSmiHash.combine(hash, linkSupport.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesDocumentHighlight implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesDocumentHighlight.canParse, - TextDocumentClientCapabilitiesDocumentHighlight.fromJson); - - TextDocumentClientCapabilitiesDocumentHighlight(this.dynamicRegistration); - static TextDocumentClientCapabilitiesDocumentHighlight fromJson( - Map json) { - final dynamicRegistration = json['dynamicRegistration']; - return TextDocumentClientCapabilitiesDocumentHighlight(dynamicRegistration); - } - - /// Whether document highlight supports dynamic registration. - final bool dynamicRegistration; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesDocumentHighlight'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesDocumentHighlight && - other.runtimeType == TextDocumentClientCapabilitiesDocumentHighlight) { - return dynamicRegistration == other.dynamicRegistration && true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesDocumentLink implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesDocumentLink.canParse, - TextDocumentClientCapabilitiesDocumentLink.fromJson); - - TextDocumentClientCapabilitiesDocumentLink(this.dynamicRegistration); - static TextDocumentClientCapabilitiesDocumentLink fromJson( - Map json) { - final dynamicRegistration = json['dynamicRegistration']; - return TextDocumentClientCapabilitiesDocumentLink(dynamicRegistration); - } - - /// Whether document link supports dynamic registration. - final bool dynamicRegistration; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesDocumentLink'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesDocumentLink && - other.runtimeType == TextDocumentClientCapabilitiesDocumentLink) { - return dynamicRegistration == other.dynamicRegistration && true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesDocumentSymbol implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesDocumentSymbol.canParse, - TextDocumentClientCapabilitiesDocumentSymbol.fromJson); - - TextDocumentClientCapabilitiesDocumentSymbol(this.dynamicRegistration, - this.symbolKind, this.hierarchicalDocumentSymbolSupport); - static TextDocumentClientCapabilitiesDocumentSymbol fromJson( - Map json) { - final dynamicRegistration = json['dynamicRegistration']; - final symbolKind = json['symbolKind'] != null - ? TextDocumentClientCapabilitiesSymbolKind.fromJson(json['symbolKind']) - : null; - final hierarchicalDocumentSymbolSupport = - json['hierarchicalDocumentSymbolSupport']; - return TextDocumentClientCapabilitiesDocumentSymbol( - dynamicRegistration, symbolKind, hierarchicalDocumentSymbolSupport); - } - - /// Whether document symbol supports dynamic registration. - final bool dynamicRegistration; - - /// The client supports hierarchical document symbols. - final bool hierarchicalDocumentSymbolSupport; - - /// Specific capabilities for the `SymbolKind`. - final TextDocumentClientCapabilitiesSymbolKind symbolKind; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - if (symbolKind != null) { - __result['symbolKind'] = symbolKind; - } - if (hierarchicalDocumentSymbolSupport != null) { - __result['hierarchicalDocumentSymbolSupport'] = - hierarchicalDocumentSymbolSupport; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('symbolKind'); - try { - if (obj['symbolKind'] != null && - !(TextDocumentClientCapabilitiesSymbolKind.canParse( - obj['symbolKind'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesSymbolKind'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('hierarchicalDocumentSymbolSupport'); - try { - if (obj['hierarchicalDocumentSymbolSupport'] != null && - !(obj['hierarchicalDocumentSymbolSupport'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesDocumentSymbol'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesDocumentSymbol && - other.runtimeType == TextDocumentClientCapabilitiesDocumentSymbol) { - return dynamicRegistration == other.dynamicRegistration && - symbolKind == other.symbolKind && - hierarchicalDocumentSymbolSupport == - other.hierarchicalDocumentSymbolSupport && - true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - hash = JenkinsSmiHash.combine(hash, symbolKind.hashCode); - hash = JenkinsSmiHash.combine( - hash, hierarchicalDocumentSymbolSupport.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesFoldingRange implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesFoldingRange.canParse, - TextDocumentClientCapabilitiesFoldingRange.fromJson); - - TextDocumentClientCapabilitiesFoldingRange( - this.dynamicRegistration, this.rangeLimit, this.lineFoldingOnly); - static TextDocumentClientCapabilitiesFoldingRange fromJson( - Map json) { - final dynamicRegistration = json['dynamicRegistration']; - final rangeLimit = json['rangeLimit']; - final lineFoldingOnly = json['lineFoldingOnly']; - return TextDocumentClientCapabilitiesFoldingRange( - dynamicRegistration, rangeLimit, lineFoldingOnly); - } - - /// Whether implementation supports dynamic registration for folding range - /// providers. If this is set to `true` the client supports the new - /// `(FoldingRangeProviderOptions & TextDocumentRegistrationOptions & - /// StaticRegistrationOptions)` return value for the corresponding server - /// capability as well. - final bool dynamicRegistration; - - /// If set, the client signals that it only supports folding complete lines. - /// If set, client will ignore specified `startCharacter` and `endCharacter` - /// properties in a FoldingRange. - final bool lineFoldingOnly; - - /// The maximum number of folding ranges that the client prefers to receive - /// per document. The value serves as a hint, servers are free to follow the - /// limit. - final num rangeLimit; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - if (rangeLimit != null) { - __result['rangeLimit'] = rangeLimit; - } - if (lineFoldingOnly != null) { - __result['lineFoldingOnly'] = lineFoldingOnly; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('rangeLimit'); - try { - if (obj['rangeLimit'] != null && !(obj['rangeLimit'] is num)) { - reporter.reportError('must be of type num'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('lineFoldingOnly'); - try { - if (obj['lineFoldingOnly'] != null && - !(obj['lineFoldingOnly'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesFoldingRange'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesFoldingRange && - other.runtimeType == TextDocumentClientCapabilitiesFoldingRange) { - return dynamicRegistration == other.dynamicRegistration && - rangeLimit == other.rangeLimit && - lineFoldingOnly == other.lineFoldingOnly && - true; + TextDocumentContentChangeEvent1(this.range, this.rangeLength, this.text) { + if (range == null) { + throw 'range is required but was not provided'; } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - hash = JenkinsSmiHash.combine(hash, rangeLimit.hashCode); - hash = JenkinsSmiHash.combine(hash, lineFoldingOnly.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesFormatting implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesFormatting.canParse, - TextDocumentClientCapabilitiesFormatting.fromJson); - - TextDocumentClientCapabilitiesFormatting(this.dynamicRegistration); - static TextDocumentClientCapabilitiesFormatting fromJson( - Map json) { - final dynamicRegistration = json['dynamicRegistration']; - return TextDocumentClientCapabilitiesFormatting(dynamicRegistration); - } - - /// Whether formatting supports dynamic registration. - final bool dynamicRegistration; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesFormatting'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesFormatting && - other.runtimeType == TextDocumentClientCapabilitiesFormatting) { - return dynamicRegistration == other.dynamicRegistration && true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesHover implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesHover.canParse, - TextDocumentClientCapabilitiesHover.fromJson); - - TextDocumentClientCapabilitiesHover( - this.dynamicRegistration, this.contentFormat); - static TextDocumentClientCapabilitiesHover fromJson( - Map json) { - final dynamicRegistration = json['dynamicRegistration']; - final contentFormat = json['contentFormat'] - ?.map((item) => item != null ? MarkupKind.fromJson(item) : null) - ?.cast() - ?.toList(); - return TextDocumentClientCapabilitiesHover( - dynamicRegistration, contentFormat); - } - - /// The client supports the follow content formats for the content property. - /// The order describes the preferred format of the client. - final List contentFormat; - - /// Whether hover supports dynamic registration. - final bool dynamicRegistration; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - if (contentFormat != null) { - __result['contentFormat'] = contentFormat; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('contentFormat'); - try { - if (obj['contentFormat'] != null && - !((obj['contentFormat'] is List && - (obj['contentFormat'] - .every((item) => MarkupKind.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter - .reportError('must be of type TextDocumentClientCapabilitiesHover'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesHover && - other.runtimeType == TextDocumentClientCapabilitiesHover) { - return dynamicRegistration == other.dynamicRegistration && - listEqual(contentFormat, other.contentFormat, - (MarkupKind a, MarkupKind b) => a == b) && - true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - hash = JenkinsSmiHash.combine(hash, lspHashCode(contentFormat)); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesImplementation implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesImplementation.canParse, - TextDocumentClientCapabilitiesImplementation.fromJson); - - TextDocumentClientCapabilitiesImplementation( - this.dynamicRegistration, this.linkSupport); - static TextDocumentClientCapabilitiesImplementation fromJson( - Map json) { - final dynamicRegistration = json['dynamicRegistration']; - final linkSupport = json['linkSupport']; - return TextDocumentClientCapabilitiesImplementation( - dynamicRegistration, linkSupport); - } - - /// Whether implementation supports dynamic registration. If this is set to - /// `true` the client supports the new `(TextDocumentRegistrationOptions & - /// StaticRegistrationOptions)` return value for the corresponding server - /// capability as well. - final bool dynamicRegistration; - - /// The client supports additional metadata in the form of definition links. - /// - /// Since 3.14.0 - final bool linkSupport; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - if (linkSupport != null) { - __result['linkSupport'] = linkSupport; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('linkSupport'); - try { - if (obj['linkSupport'] != null && !(obj['linkSupport'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesImplementation'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesImplementation && - other.runtimeType == TextDocumentClientCapabilitiesImplementation) { - return dynamicRegistration == other.dynamicRegistration && - linkSupport == other.linkSupport && - true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - hash = JenkinsSmiHash.combine(hash, linkSupport.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesOnTypeFormatting implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesOnTypeFormatting.canParse, - TextDocumentClientCapabilitiesOnTypeFormatting.fromJson); - - TextDocumentClientCapabilitiesOnTypeFormatting(this.dynamicRegistration); - static TextDocumentClientCapabilitiesOnTypeFormatting fromJson( - Map json) { - final dynamicRegistration = json['dynamicRegistration']; - return TextDocumentClientCapabilitiesOnTypeFormatting(dynamicRegistration); - } - - /// Whether on type formatting supports dynamic registration. - final bool dynamicRegistration; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesOnTypeFormatting'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesOnTypeFormatting && - other.runtimeType == TextDocumentClientCapabilitiesOnTypeFormatting) { - return dynamicRegistration == other.dynamicRegistration && true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesParameterInformation implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesParameterInformation.canParse, - TextDocumentClientCapabilitiesParameterInformation.fromJson); - - TextDocumentClientCapabilitiesParameterInformation(this.labelOffsetSupport); - static TextDocumentClientCapabilitiesParameterInformation fromJson( - Map json) { - final labelOffsetSupport = json['labelOffsetSupport']; - return TextDocumentClientCapabilitiesParameterInformation( - labelOffsetSupport); - } - - /// The client supports processing label offsets instead of a simple label - /// string. - /// - /// Since 3.14.0 - final bool labelOffsetSupport; - - Map toJson() { - var __result = {}; - if (labelOffsetSupport != null) { - __result['labelOffsetSupport'] = labelOffsetSupport; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('labelOffsetSupport'); - try { - if (obj['labelOffsetSupport'] != null && - !(obj['labelOffsetSupport'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesParameterInformation'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesParameterInformation && - other.runtimeType == - TextDocumentClientCapabilitiesParameterInformation) { - return labelOffsetSupport == other.labelOffsetSupport && true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, labelOffsetSupport.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesPublishDiagnostics implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesPublishDiagnostics.canParse, - TextDocumentClientCapabilitiesPublishDiagnostics.fromJson); - - TextDocumentClientCapabilitiesPublishDiagnostics(this.relatedInformation); - static TextDocumentClientCapabilitiesPublishDiagnostics fromJson( - Map json) { - final relatedInformation = json['relatedInformation']; - return TextDocumentClientCapabilitiesPublishDiagnostics(relatedInformation); - } - - /// Whether the clients accepts diagnostics with related information. - final bool relatedInformation; - - Map toJson() { - var __result = {}; - if (relatedInformation != null) { - __result['relatedInformation'] = relatedInformation; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('relatedInformation'); - try { - if (obj['relatedInformation'] != null && - !(obj['relatedInformation'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesPublishDiagnostics'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesPublishDiagnostics && - other.runtimeType == TextDocumentClientCapabilitiesPublishDiagnostics) { - return relatedInformation == other.relatedInformation && true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, relatedInformation.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesRangeFormatting implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesRangeFormatting.canParse, - TextDocumentClientCapabilitiesRangeFormatting.fromJson); - - TextDocumentClientCapabilitiesRangeFormatting(this.dynamicRegistration); - static TextDocumentClientCapabilitiesRangeFormatting fromJson( - Map json) { - final dynamicRegistration = json['dynamicRegistration']; - return TextDocumentClientCapabilitiesRangeFormatting(dynamicRegistration); - } - - /// Whether range formatting supports dynamic registration. - final bool dynamicRegistration; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesRangeFormatting'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesRangeFormatting && - other.runtimeType == TextDocumentClientCapabilitiesRangeFormatting) { - return dynamicRegistration == other.dynamicRegistration && true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesReferences implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesReferences.canParse, - TextDocumentClientCapabilitiesReferences.fromJson); - - TextDocumentClientCapabilitiesReferences(this.dynamicRegistration); - static TextDocumentClientCapabilitiesReferences fromJson( - Map json) { - final dynamicRegistration = json['dynamicRegistration']; - return TextDocumentClientCapabilitiesReferences(dynamicRegistration); - } - - /// Whether references supports dynamic registration. - final bool dynamicRegistration; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesReferences'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesReferences && - other.runtimeType == TextDocumentClientCapabilitiesReferences) { - return dynamicRegistration == other.dynamicRegistration && true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesRename implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesRename.canParse, - TextDocumentClientCapabilitiesRename.fromJson); - - TextDocumentClientCapabilitiesRename( - this.dynamicRegistration, this.prepareSupport); - static TextDocumentClientCapabilitiesRename fromJson( - Map json) { - final dynamicRegistration = json['dynamicRegistration']; - final prepareSupport = json['prepareSupport']; - return TextDocumentClientCapabilitiesRename( - dynamicRegistration, prepareSupport); - } - - /// Whether rename supports dynamic registration. - final bool dynamicRegistration; - - /// The client supports testing for validity of rename operations before - /// execution. - final bool prepareSupport; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - if (prepareSupport != null) { - __result['prepareSupport'] = prepareSupport; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('prepareSupport'); - try { - if (obj['prepareSupport'] != null && !(obj['prepareSupport'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter - .reportError('must be of type TextDocumentClientCapabilitiesRename'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesRename && - other.runtimeType == TextDocumentClientCapabilitiesRename) { - return dynamicRegistration == other.dynamicRegistration && - prepareSupport == other.prepareSupport && - true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - hash = JenkinsSmiHash.combine(hash, prepareSupport.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesSignatureHelp implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesSignatureHelp.canParse, - TextDocumentClientCapabilitiesSignatureHelp.fromJson); - - TextDocumentClientCapabilitiesSignatureHelp( - this.dynamicRegistration, this.signatureInformation); - static TextDocumentClientCapabilitiesSignatureHelp fromJson( - Map json) { - final dynamicRegistration = json['dynamicRegistration']; - final signatureInformation = json['signatureInformation'] != null - ? TextDocumentClientCapabilitiesSignatureInformation.fromJson( - json['signatureInformation']) - : null; - return TextDocumentClientCapabilitiesSignatureHelp( - dynamicRegistration, signatureInformation); - } - - /// Whether signature help supports dynamic registration. - final bool dynamicRegistration; - - /// The client supports the following `SignatureInformation` specific - /// properties. - final TextDocumentClientCapabilitiesSignatureInformation signatureInformation; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - if (signatureInformation != null) { - __result['signatureInformation'] = signatureInformation; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('signatureInformation'); - try { - if (obj['signatureInformation'] != null && - !(TextDocumentClientCapabilitiesSignatureInformation.canParse( - obj['signatureInformation'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesSignatureInformation'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesSignatureHelp'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesSignatureHelp && - other.runtimeType == TextDocumentClientCapabilitiesSignatureHelp) { - return dynamicRegistration == other.dynamicRegistration && - signatureInformation == other.signatureInformation && - true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - hash = JenkinsSmiHash.combine(hash, signatureInformation.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesSignatureInformation implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesSignatureInformation.canParse, - TextDocumentClientCapabilitiesSignatureInformation.fromJson); - - TextDocumentClientCapabilitiesSignatureInformation( - this.documentationFormat, this.parameterInformation); - static TextDocumentClientCapabilitiesSignatureInformation fromJson( - Map json) { - final documentationFormat = json['documentationFormat'] - ?.map((item) => item != null ? MarkupKind.fromJson(item) : null) - ?.cast() - ?.toList(); - final parameterInformation = json['parameterInformation'] != null - ? TextDocumentClientCapabilitiesParameterInformation.fromJson( - json['parameterInformation']) - : null; - return TextDocumentClientCapabilitiesSignatureInformation( - documentationFormat, parameterInformation); - } - - /// The client supports the follow content formats for the documentation - /// property. The order describes the preferred format of the client. - final List documentationFormat; - - /// Client capabilities specific to parameter information. - final TextDocumentClientCapabilitiesParameterInformation parameterInformation; - - Map toJson() { - var __result = {}; - if (documentationFormat != null) { - __result['documentationFormat'] = documentationFormat; - } - if (parameterInformation != null) { - __result['parameterInformation'] = parameterInformation; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('documentationFormat'); - try { - if (obj['documentationFormat'] != null && - !((obj['documentationFormat'] is List && - (obj['documentationFormat'] - .every((item) => MarkupKind.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('parameterInformation'); - try { - if (obj['parameterInformation'] != null && - !(TextDocumentClientCapabilitiesParameterInformation.canParse( - obj['parameterInformation'], reporter))) { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesParameterInformation'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesSignatureInformation'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesSignatureInformation && - other.runtimeType == - TextDocumentClientCapabilitiesSignatureInformation) { - return listEqual(documentationFormat, other.documentationFormat, - (MarkupKind a, MarkupKind b) => a == b) && - parameterInformation == other.parameterInformation && - true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, lspHashCode(documentationFormat)); - hash = JenkinsSmiHash.combine(hash, parameterInformation.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesSymbolKind implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesSymbolKind.canParse, - TextDocumentClientCapabilitiesSymbolKind.fromJson); - - TextDocumentClientCapabilitiesSymbolKind(this.valueSet); - static TextDocumentClientCapabilitiesSymbolKind fromJson( - Map json) { - final valueSet = json['valueSet'] - ?.map((item) => item != null ? SymbolKind.fromJson(item) : null) - ?.cast() - ?.toList(); - return TextDocumentClientCapabilitiesSymbolKind(valueSet); - } - - /// The symbol kind values the client supports. When this property exists the - /// client also guarantees that it will handle values outside its set - /// gracefully and falls back to a default value when unknown. - /// - /// If this property is not present the client only supports the symbol kinds - /// from `File` to `Array` as defined in the initial version of the protocol. - final List valueSet; - - Map toJson() { - var __result = {}; - if (valueSet != null) { - __result['valueSet'] = valueSet; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('valueSet'); - try { - if (obj['valueSet'] != null && - !((obj['valueSet'] is List && - (obj['valueSet'] - .every((item) => SymbolKind.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesSymbolKind'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesSymbolKind && - other.runtimeType == TextDocumentClientCapabilitiesSymbolKind) { - return listEqual(valueSet, other.valueSet, - (SymbolKind a, SymbolKind b) => a == b) && - true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, lspHashCode(valueSet)); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesSynchronization implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesSynchronization.canParse, - TextDocumentClientCapabilitiesSynchronization.fromJson); - - TextDocumentClientCapabilitiesSynchronization(this.dynamicRegistration, - this.willSave, this.willSaveWaitUntil, this.didSave); - static TextDocumentClientCapabilitiesSynchronization fromJson( - Map json) { - final dynamicRegistration = json['dynamicRegistration']; - final willSave = json['willSave']; - final willSaveWaitUntil = json['willSaveWaitUntil']; - final didSave = json['didSave']; - return TextDocumentClientCapabilitiesSynchronization( - dynamicRegistration, willSave, willSaveWaitUntil, didSave); - } - - /// The client supports did save notifications. - final bool didSave; - - /// Whether text document synchronization supports dynamic registration. - final bool dynamicRegistration; - - /// The client supports sending will save notifications. - final bool willSave; - - /// The client supports sending a will save request and waits for a response - /// providing text edits which will be applied to the document before it is - /// saved. - final bool willSaveWaitUntil; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - if (willSave != null) { - __result['willSave'] = willSave; - } - if (willSaveWaitUntil != null) { - __result['willSaveWaitUntil'] = willSaveWaitUntil; - } - if (didSave != null) { - __result['didSave'] = didSave; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('willSave'); - try { - if (obj['willSave'] != null && !(obj['willSave'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('willSaveWaitUntil'); - try { - if (obj['willSaveWaitUntil'] != null && - !(obj['willSaveWaitUntil'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('didSave'); - try { - if (obj['didSave'] != null && !(obj['didSave'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesSynchronization'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesSynchronization && - other.runtimeType == TextDocumentClientCapabilitiesSynchronization) { - return dynamicRegistration == other.dynamicRegistration && - willSave == other.willSave && - willSaveWaitUntil == other.willSaveWaitUntil && - didSave == other.didSave && - true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - hash = JenkinsSmiHash.combine(hash, willSave.hashCode); - hash = JenkinsSmiHash.combine(hash, willSaveWaitUntil.hashCode); - hash = JenkinsSmiHash.combine(hash, didSave.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class TextDocumentClientCapabilitiesTypeDefinition implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentClientCapabilitiesTypeDefinition.canParse, - TextDocumentClientCapabilitiesTypeDefinition.fromJson); - - TextDocumentClientCapabilitiesTypeDefinition( - this.dynamicRegistration, this.linkSupport); - static TextDocumentClientCapabilitiesTypeDefinition fromJson( - Map json) { - final dynamicRegistration = json['dynamicRegistration']; - final linkSupport = json['linkSupport']; - return TextDocumentClientCapabilitiesTypeDefinition( - dynamicRegistration, linkSupport); - } - - /// Whether typeDefinition supports dynamic registration. If this is set to - /// `true` the client supports the new `(TextDocumentRegistrationOptions & - /// StaticRegistrationOptions)` return value for the corresponding server - /// capability as well. - final bool dynamicRegistration; - - /// The client supports additional metadata in the form of definition links. - /// - /// Since 3.14.0 - final bool linkSupport; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - if (linkSupport != null) { - __result['linkSupport'] = linkSupport; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('linkSupport'); - try { - if (obj['linkSupport'] != null && !(obj['linkSupport'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type TextDocumentClientCapabilitiesTypeDefinition'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is TextDocumentClientCapabilitiesTypeDefinition && - other.runtimeType == TextDocumentClientCapabilitiesTypeDefinition) { - return dynamicRegistration == other.dynamicRegistration && - linkSupport == other.linkSupport && - true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - hash = JenkinsSmiHash.combine(hash, linkSupport.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -/// An event describing a change to a text document. If range and rangeLength -/// are omitted the new text is considered to be the full content of the -/// document. -class TextDocumentContentChangeEvent implements ToJsonable { - static const jsonHandler = LspJsonHandler( - TextDocumentContentChangeEvent.canParse, - TextDocumentContentChangeEvent.fromJson); - - TextDocumentContentChangeEvent(this.range, this.rangeLength, this.text) { if (text == null) { throw 'text is required but was not provided'; } } - static TextDocumentContentChangeEvent fromJson(Map json) { + static TextDocumentContentChangeEvent1 fromJson(Map json) { final range = json['range'] != null ? Range.fromJson(json['range']) : null; final rangeLength = json['rangeLength']; final text = json['text']; - return TextDocumentContentChangeEvent(range, rangeLength, text); + return TextDocumentContentChangeEvent1(range, rangeLength, text); } /// The range of the document that changed. final Range range; - /// The length of the range that got replaced. + /// The optional length of the range that got replaced. + /// @deprecated use range instead. + @core.deprecated final num rangeLength; - /// The new text of the range/document. + /// The new text for the provided range. final String text; Map toJson() { var __result = {}; - if (range != null) { - __result['range'] = range; - } + __result['range'] = range ?? (throw 'range is required but was not set'); if (rangeLength != null) { __result['rangeLength'] = rangeLength; } @@ -15221,7 +21231,15 @@ class TextDocumentContentChangeEvent implements ToJsonable { if (obj is Map) { reporter.push('range'); try { - if (obj['range'] != null && !(Range.canParse(obj['range'], reporter))) { + if (!obj.containsKey('range')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['range'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(Range.canParse(obj['range'], reporter))) { reporter.reportError('must be of type Range'); return false; } @@ -15256,15 +21274,15 @@ class TextDocumentContentChangeEvent implements ToJsonable { } return true; } else { - reporter.reportError('must be of type TextDocumentContentChangeEvent'); + reporter.reportError('must be of type TextDocumentContentChangeEvent1'); return false; } } @override bool operator ==(Object other) { - if (other is TextDocumentContentChangeEvent && - other.runtimeType == TextDocumentContentChangeEvent) { + if (other is TextDocumentContentChangeEvent1 && + other.runtimeType == TextDocumentContentChangeEvent1) { return range == other.range && rangeLength == other.rangeLength && text == other.text && @@ -15286,6 +21304,76 @@ class TextDocumentContentChangeEvent implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } +class TextDocumentContentChangeEvent2 implements ToJsonable { + static const jsonHandler = LspJsonHandler( + TextDocumentContentChangeEvent2.canParse, + TextDocumentContentChangeEvent2.fromJson); + + TextDocumentContentChangeEvent2(this.text) { + if (text == null) { + throw 'text is required but was not provided'; + } + } + static TextDocumentContentChangeEvent2 fromJson(Map json) { + final text = json['text']; + return TextDocumentContentChangeEvent2(text); + } + + /// The new text of the whole document. + final String text; + + Map toJson() { + var __result = {}; + __result['text'] = text ?? (throw 'text is required but was not set'); + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('text'); + try { + if (!obj.containsKey('text')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['text'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(obj['text'] is String)) { + reporter.reportError('must be of type String'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type TextDocumentContentChangeEvent2'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is TextDocumentContentChangeEvent2 && + other.runtimeType == TextDocumentContentChangeEvent2) { + return text == other.text && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, text.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + class TextDocumentEdit implements ToJsonable { static const jsonHandler = LspJsonHandler(TextDocumentEdit.canParse, TextDocumentEdit.fromJson); @@ -15633,9 +21721,39 @@ class TextDocumentPositionParams implements ToJsonable { if (CompletionParams.canParse(json, nullLspJsonReporter)) { return CompletionParams.fromJson(json); } + if (HoverParams.canParse(json, nullLspJsonReporter)) { + return HoverParams.fromJson(json); + } + if (SignatureHelpParams.canParse(json, nullLspJsonReporter)) { + return SignatureHelpParams.fromJson(json); + } + if (DeclarationParams.canParse(json, nullLspJsonReporter)) { + return DeclarationParams.fromJson(json); + } + if (DefinitionParams.canParse(json, nullLspJsonReporter)) { + return DefinitionParams.fromJson(json); + } + if (TypeDefinitionParams.canParse(json, nullLspJsonReporter)) { + return TypeDefinitionParams.fromJson(json); + } + if (ImplementationParams.canParse(json, nullLspJsonReporter)) { + return ImplementationParams.fromJson(json); + } if (ReferenceParams.canParse(json, nullLspJsonReporter)) { return ReferenceParams.fromJson(json); } + if (DocumentHighlightParams.canParse(json, nullLspJsonReporter)) { + return DocumentHighlightParams.fromJson(json); + } + if (DocumentOnTypeFormattingParams.canParse(json, nullLspJsonReporter)) { + return DocumentOnTypeFormattingParams.fromJson(json); + } + if (RenameParams.canParse(json, nullLspJsonReporter)) { + return RenameParams.fromJson(json); + } + if (PrepareRenameParams.canParse(json, nullLspJsonReporter)) { + return PrepareRenameParams.fromJson(json); + } final textDocument = json['textDocument'] != null ? TextDocumentIdentifier.fromJson(json['textDocument']) : null; @@ -15725,6 +21843,7 @@ class TextDocumentPositionParams implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } +/// General text document registration options. class TextDocumentRegistrationOptions implements ToJsonable { static const jsonHandler = LspJsonHandler( TextDocumentRegistrationOptions.canParse, @@ -15743,9 +21862,34 @@ class TextDocumentRegistrationOptions implements ToJsonable { if (CompletionRegistrationOptions.canParse(json, nullLspJsonReporter)) { return CompletionRegistrationOptions.fromJson(json); } + if (HoverRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return HoverRegistrationOptions.fromJson(json); + } if (SignatureHelpRegistrationOptions.canParse(json, nullLspJsonReporter)) { return SignatureHelpRegistrationOptions.fromJson(json); } + if (DeclarationRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return DeclarationRegistrationOptions.fromJson(json); + } + if (DefinitionRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return DefinitionRegistrationOptions.fromJson(json); + } + if (TypeDefinitionRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return TypeDefinitionRegistrationOptions.fromJson(json); + } + if (ImplementationRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return ImplementationRegistrationOptions.fromJson(json); + } + if (ReferenceRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return ReferenceRegistrationOptions.fromJson(json); + } + if (DocumentHighlightRegistrationOptions.canParse( + json, nullLspJsonReporter)) { + return DocumentHighlightRegistrationOptions.fromJson(json); + } + if (DocumentSymbolRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return DocumentSymbolRegistrationOptions.fromJson(json); + } if (CodeActionRegistrationOptions.canParse(json, nullLspJsonReporter)) { return CodeActionRegistrationOptions.fromJson(json); } @@ -15755,6 +21899,17 @@ class TextDocumentRegistrationOptions implements ToJsonable { if (DocumentLinkRegistrationOptions.canParse(json, nullLspJsonReporter)) { return DocumentLinkRegistrationOptions.fromJson(json); } + if (DocumentColorRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return DocumentColorRegistrationOptions.fromJson(json); + } + if (DocumentFormattingRegistrationOptions.canParse( + json, nullLspJsonReporter)) { + return DocumentFormattingRegistrationOptions.fromJson(json); + } + if (DocumentRangeFormattingRegistrationOptions.canParse( + json, nullLspJsonReporter)) { + return DocumentRangeFormattingRegistrationOptions.fromJson(json); + } if (DocumentOnTypeFormattingRegistrationOptions.canParse( json, nullLspJsonReporter)) { return DocumentOnTypeFormattingRegistrationOptions.fromJson(json); @@ -15762,6 +21917,12 @@ class TextDocumentRegistrationOptions implements ToJsonable { if (RenameRegistrationOptions.canParse(json, nullLspJsonReporter)) { return RenameRegistrationOptions.fromJson(json); } + if (FoldingRangeRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return FoldingRangeRegistrationOptions.fromJson(json); + } + if (SelectionRangeRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return SelectionRangeRegistrationOptions.fromJson(json); + } final documentSelector = json['documentSelector'] ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) ?.cast() @@ -15951,6 +22112,129 @@ class TextDocumentSaveRegistrationOptions String toString() => jsonEncoder.convert(toJson()); } +class TextDocumentSyncClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + TextDocumentSyncClientCapabilities.canParse, + TextDocumentSyncClientCapabilities.fromJson); + + TextDocumentSyncClientCapabilities(this.dynamicRegistration, this.willSave, + this.willSaveWaitUntil, this.didSave); + static TextDocumentSyncClientCapabilities fromJson( + Map json) { + final dynamicRegistration = json['dynamicRegistration']; + final willSave = json['willSave']; + final willSaveWaitUntil = json['willSaveWaitUntil']; + final didSave = json['didSave']; + return TextDocumentSyncClientCapabilities( + dynamicRegistration, willSave, willSaveWaitUntil, didSave); + } + + /// The client supports did save notifications. + final bool didSave; + + /// Whether text document synchronization supports dynamic registration. + final bool dynamicRegistration; + + /// The client supports sending will save notifications. + final bool willSave; + + /// The client supports sending a will save request and waits for a response + /// providing text edits which will be applied to the document before it is + /// saved. + final bool willSaveWaitUntil; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + if (willSave != null) { + __result['willSave'] = willSave; + } + if (willSaveWaitUntil != null) { + __result['willSaveWaitUntil'] = willSaveWaitUntil; + } + if (didSave != null) { + __result['didSave'] = didSave; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('willSave'); + try { + if (obj['willSave'] != null && !(obj['willSave'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('willSaveWaitUntil'); + try { + if (obj['willSaveWaitUntil'] != null && + !(obj['willSaveWaitUntil'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('didSave'); + try { + if (obj['didSave'] != null && !(obj['didSave'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter + .reportError('must be of type TextDocumentSyncClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is TextDocumentSyncClientCapabilities && + other.runtimeType == TextDocumentSyncClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && + willSave == other.willSave && + willSaveWaitUntil == other.willSaveWaitUntil && + didSave == other.didSave && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + hash = JenkinsSmiHash.combine(hash, willSave.hashCode); + hash = JenkinsSmiHash.combine(hash, willSaveWaitUntil.hashCode); + hash = JenkinsSmiHash.combine(hash, didSave.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + /// Defines how the host (editor) should sync document changes to the language /// server. class TextDocumentSyncKind { @@ -15997,8 +22281,15 @@ class TextDocumentSyncOptions implements ToJsonable { : null; final willSave = json['willSave']; final willSaveWaitUntil = json['willSaveWaitUntil']; - final save = - json['save'] != null ? SaveOptions.fromJson(json['save']) : null; + final save = json['save'] is bool + ? Either2.t1(json['save']) + : (SaveOptions.canParse(json['save'], nullLspJsonReporter) + ? Either2.t2(json['save'] != null + ? SaveOptions.fromJson(json['save']) + : null) + : (json['save'] == null + ? null + : (throw '''${json['save']} was not one of (bool, SaveOptions)'''))); return TextDocumentSyncOptions( openClose, change, willSave, willSaveWaitUntil, save); } @@ -16015,7 +22306,7 @@ class TextDocumentSyncOptions implements ToJsonable { /// If present save notifications are sent to the server. If omitted the /// notification should not be sent. - final SaveOptions save; + final Either2 save; /// If present will save notifications are sent to the server. If omitted the /// notification should not be sent. @@ -16088,8 +22379,9 @@ class TextDocumentSyncOptions implements ToJsonable { reporter.push('save'); try { if (obj['save'] != null && - !(SaveOptions.canParse(obj['save'], reporter))) { - reporter.reportError('must be of type SaveOptions'); + !((obj['save'] is bool || + SaveOptions.canParse(obj['save'], reporter)))) { + reporter.reportError('must be of type Either2'); return false; } } finally { @@ -16227,6 +22519,427 @@ class TextEdit implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } +class TypeDefinitionClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + TypeDefinitionClientCapabilities.canParse, + TypeDefinitionClientCapabilities.fromJson); + + TypeDefinitionClientCapabilities(this.dynamicRegistration, this.linkSupport); + static TypeDefinitionClientCapabilities fromJson(Map json) { + final dynamicRegistration = json['dynamicRegistration']; + final linkSupport = json['linkSupport']; + return TypeDefinitionClientCapabilities(dynamicRegistration, linkSupport); + } + + /// Whether implementation supports dynamic registration. If this is set to + /// `true` the client supports the new `TypeDefinitionRegistrationOptions` + /// return value for the corresponding server capability as well. + final bool dynamicRegistration; + + /// The client supports additional metadata in the form of definition links. + /// @since 3.14.0 + final bool linkSupport; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + if (linkSupport != null) { + __result['linkSupport'] = linkSupport; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('linkSupport'); + try { + if (obj['linkSupport'] != null && !(obj['linkSupport'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type TypeDefinitionClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is TypeDefinitionClientCapabilities && + other.runtimeType == TypeDefinitionClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && + linkSupport == other.linkSupport && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + hash = JenkinsSmiHash.combine(hash, linkSupport.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class TypeDefinitionOptions implements WorkDoneProgressOptions, ToJsonable { + static const jsonHandler = LspJsonHandler( + TypeDefinitionOptions.canParse, TypeDefinitionOptions.fromJson); + + TypeDefinitionOptions(this.workDoneProgress); + static TypeDefinitionOptions fromJson(Map json) { + if (TypeDefinitionRegistrationOptions.canParse(json, nullLspJsonReporter)) { + return TypeDefinitionRegistrationOptions.fromJson(json); + } + final workDoneProgress = json['workDoneProgress']; + return TypeDefinitionOptions(workDoneProgress); + } + + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type TypeDefinitionOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is TypeDefinitionOptions && + other.runtimeType == TypeDefinitionOptions) { + return workDoneProgress == other.workDoneProgress && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class TypeDefinitionParams + implements + TextDocumentPositionParams, + WorkDoneProgressParams, + PartialResultParams, + ToJsonable { + static const jsonHandler = LspJsonHandler( + TypeDefinitionParams.canParse, TypeDefinitionParams.fromJson); + + TypeDefinitionParams(this.textDocument, this.position, this.workDoneToken, + this.partialResultToken) { + if (textDocument == null) { + throw 'textDocument is required but was not provided'; + } + if (position == null) { + throw 'position is required but was not provided'; + } + } + static TypeDefinitionParams fromJson(Map json) { + final textDocument = json['textDocument'] != null + ? TextDocumentIdentifier.fromJson(json['textDocument']) + : null; + final position = + json['position'] != null ? Position.fromJson(json['position']) : null; + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + final partialResultToken = json['partialResultToken'] is num + ? Either2.t1(json['partialResultToken']) + : (json['partialResultToken'] is String + ? Either2.t2(json['partialResultToken']) + : (json['partialResultToken'] == null + ? null + : (throw '''${json['partialResultToken']} was not one of (num, String)'''))); + return TypeDefinitionParams( + textDocument, position, workDoneToken, partialResultToken); + } + + /// An optional token that a server can use to report partial results (e.g. + /// streaming) to the client. + final Either2 partialResultToken; + + /// The position inside the text document. + final Position position; + + /// The text document. + final TextDocumentIdentifier textDocument; + + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + + Map toJson() { + var __result = {}; + __result['textDocument'] = + textDocument ?? (throw 'textDocument is required but was not set'); + __result['position'] = + position ?? (throw 'position is required but was not set'); + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } + if (partialResultToken != null) { + __result['partialResultToken'] = partialResultToken; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('textDocument'); + try { + if (!obj.containsKey('textDocument')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['textDocument'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) { + reporter.reportError('must be of type TextDocumentIdentifier'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('position'); + try { + if (!obj.containsKey('position')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['position'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(Position.canParse(obj['position'], reporter))) { + reporter.reportError('must be of type Position'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneToken'); + try { + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('partialResultToken'); + try { + if (obj['partialResultToken'] != null && + !((obj['partialResultToken'] is num || + obj['partialResultToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type TypeDefinitionParams'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is TypeDefinitionParams && + other.runtimeType == TypeDefinitionParams) { + return textDocument == other.textDocument && + position == other.position && + workDoneToken == other.workDoneToken && + partialResultToken == other.partialResultToken && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); + hash = JenkinsSmiHash.combine(hash, position.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); + hash = JenkinsSmiHash.combine(hash, partialResultToken.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class TypeDefinitionRegistrationOptions + implements + TextDocumentRegistrationOptions, + TypeDefinitionOptions, + StaticRegistrationOptions, + ToJsonable { + static const jsonHandler = LspJsonHandler( + TypeDefinitionRegistrationOptions.canParse, + TypeDefinitionRegistrationOptions.fromJson); + + TypeDefinitionRegistrationOptions( + this.documentSelector, this.workDoneProgress, this.id); + static TypeDefinitionRegistrationOptions fromJson(Map json) { + final documentSelector = json['documentSelector'] + ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) + ?.cast() + ?.toList(); + final workDoneProgress = json['workDoneProgress']; + final id = json['id']; + return TypeDefinitionRegistrationOptions( + documentSelector, workDoneProgress, id); + } + + /// 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. + final List documentSelector; + + /// The id used to register the request. The id can be used to deregister the + /// request again. See also Registration#id. + final String id; + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + __result['documentSelector'] = documentSelector; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + if (id != null) { + __result['id'] = id; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('documentSelector'); + try { + if (!obj.containsKey('documentSelector')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['documentSelector'] != null && + !((obj['documentSelector'] is List && + (obj['documentSelector'].every( + (item) => DocumentFilter.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('id'); + try { + if (obj['id'] != null && !(obj['id'] is String)) { + reporter.reportError('must be of type String'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type TypeDefinitionRegistrationOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is TypeDefinitionRegistrationOptions && + other.runtimeType == TypeDefinitionRegistrationOptions) { + return listEqual(documentSelector, other.documentSelector, + (DocumentFilter a, DocumentFilter b) => a == b) && + workDoneProgress == other.workDoneProgress && + id == other.id && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, lspHashCode(documentSelector)); + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + hash = JenkinsSmiHash.combine(hash, id.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + /// General parameters to unregister a capability. class Unregistration implements ToJsonable { static const jsonHandler = @@ -16340,6 +23053,9 @@ class UnregistrationParams implements ToJsonable { return UnregistrationParams(unregisterations); } + /// This should correctly be named `unregistrations`. However changing this // + /// is a breaking change and needs to wait until we deliver a 4.x version // + /// of the specification. final List unregisterations; Map toJson() { @@ -16423,7 +23139,7 @@ class VersionedTextDocumentIdentifier /// identifier is sent from the server to the client and the file is not open /// in the editor (the server has not received an open notification before) /// the server can send `null` to indicate that the version is known and the - /// content on disk is the truth (as speced with document content ownership). + /// content on disk is the master (as speced with document content ownership). /// /// The version number of a document will increase after each change, /// including undo/redo. The number doesn't need to be consecutive. @@ -16627,568 +23343,129 @@ class WillSaveTextDocumentParams implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -/// Workspace specific client capabilities. -class WorkspaceClientCapabilities implements ToJsonable { +class WorkDoneProgressBegin implements ToJsonable { static const jsonHandler = LspJsonHandler( - WorkspaceClientCapabilities.canParse, - WorkspaceClientCapabilities.fromJson); + WorkDoneProgressBegin.canParse, WorkDoneProgressBegin.fromJson); - WorkspaceClientCapabilities( - this.applyEdit, - this.workspaceEdit, - this.didChangeConfiguration, - this.didChangeWatchedFiles, - this.symbol, - this.executeCommand, - this.workspaceFolders, - this.configuration); - static WorkspaceClientCapabilities fromJson(Map json) { - final applyEdit = json['applyEdit']; - final workspaceEdit = json['workspaceEdit'] != null - ? WorkspaceClientCapabilitiesWorkspaceEdit.fromJson( - json['workspaceEdit']) - : null; - final didChangeConfiguration = json['didChangeConfiguration'] != null - ? WorkspaceClientCapabilitiesDidChangeConfiguration.fromJson( - json['didChangeConfiguration']) - : null; - final didChangeWatchedFiles = json['didChangeWatchedFiles'] != null - ? WorkspaceClientCapabilitiesDidChangeWatchedFiles.fromJson( - json['didChangeWatchedFiles']) - : null; - final symbol = json['symbol'] != null - ? WorkspaceClientCapabilitiesSymbol.fromJson(json['symbol']) - : null; - final executeCommand = json['executeCommand'] != null - ? WorkspaceClientCapabilitiesExecuteCommand.fromJson( - json['executeCommand']) - : null; - final workspaceFolders = json['workspaceFolders']; - final configuration = json['configuration']; - return WorkspaceClientCapabilities( - applyEdit, - workspaceEdit, - didChangeConfiguration, - didChangeWatchedFiles, - symbol, - executeCommand, - workspaceFolders, - configuration); + WorkDoneProgressBegin( + this.kind, this.title, this.cancellable, this.message, this.percentage) { + if (kind == null) { + throw 'kind is required but was not provided'; + } + if (title == null) { + throw 'title is required but was not provided'; + } + } + static WorkDoneProgressBegin fromJson(Map json) { + final kind = json['kind']; + final title = json['title']; + final cancellable = json['cancellable']; + final message = json['message']; + final percentage = json['percentage']; + return WorkDoneProgressBegin(kind, title, cancellable, message, percentage); } - /// The client supports applying batch edits to the workspace by supporting - /// the request 'workspace/applyEdit' - final bool applyEdit; + /// Controls if a cancel button should show to allow the user to cancel the + /// long running operation. Clients that don't support cancellation are + /// allowed to ignore the setting. + final bool cancellable; + final String kind; - /// The client supports `workspace/configuration` requests. + /// Optional, more detailed associated progress message. Contains + /// complementary information to the `title`. /// - /// Since 3.6.0 - final bool configuration; + /// Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". If + /// unset, the previous progress message (if any) is still valid. + final String message; - /// Capabilities specific to the `workspace/didChangeConfiguration` - /// notification. - final WorkspaceClientCapabilitiesDidChangeConfiguration - didChangeConfiguration; - - /// Capabilities specific to the `workspace/didChangeWatchedFiles` - /// notification. - final WorkspaceClientCapabilitiesDidChangeWatchedFiles didChangeWatchedFiles; - - /// Capabilities specific to the `workspace/executeCommand` request. - final WorkspaceClientCapabilitiesExecuteCommand executeCommand; - - /// Capabilities specific to the `workspace/symbol` request. - final WorkspaceClientCapabilitiesSymbol symbol; - - /// Capabilities specific to `WorkspaceEdit`s - final WorkspaceClientCapabilitiesWorkspaceEdit workspaceEdit; - - /// The client has support for workspace folders. + /// Optional progress percentage to display (value 100 is considered 100%). If + /// not provided infinite progress is assumed and clients are allowed to + /// ignore the `percentage` value in subsequent in report notifications. /// - /// Since 3.6.0 - final bool workspaceFolders; + /// The value should be steadily rising. Clients are free to ignore values + /// that are not following this rule. + final num percentage; - Map toJson() { - var __result = {}; - if (applyEdit != null) { - __result['applyEdit'] = applyEdit; - } - if (workspaceEdit != null) { - __result['workspaceEdit'] = workspaceEdit; - } - if (didChangeConfiguration != null) { - __result['didChangeConfiguration'] = didChangeConfiguration; - } - if (didChangeWatchedFiles != null) { - __result['didChangeWatchedFiles'] = didChangeWatchedFiles; - } - if (symbol != null) { - __result['symbol'] = symbol; - } - if (executeCommand != null) { - __result['executeCommand'] = executeCommand; - } - if (workspaceFolders != null) { - __result['workspaceFolders'] = workspaceFolders; - } - if (configuration != null) { - __result['configuration'] = configuration; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('applyEdit'); - try { - if (obj['applyEdit'] != null && !(obj['applyEdit'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('workspaceEdit'); - try { - if (obj['workspaceEdit'] != null && - !(WorkspaceClientCapabilitiesWorkspaceEdit.canParse( - obj['workspaceEdit'], reporter))) { - reporter.reportError( - 'must be of type WorkspaceClientCapabilitiesWorkspaceEdit'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('didChangeConfiguration'); - try { - if (obj['didChangeConfiguration'] != null && - !(WorkspaceClientCapabilitiesDidChangeConfiguration.canParse( - obj['didChangeConfiguration'], reporter))) { - reporter.reportError( - 'must be of type WorkspaceClientCapabilitiesDidChangeConfiguration'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('didChangeWatchedFiles'); - try { - if (obj['didChangeWatchedFiles'] != null && - !(WorkspaceClientCapabilitiesDidChangeWatchedFiles.canParse( - obj['didChangeWatchedFiles'], reporter))) { - reporter.reportError( - 'must be of type WorkspaceClientCapabilitiesDidChangeWatchedFiles'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('symbol'); - try { - if (obj['symbol'] != null && - !(WorkspaceClientCapabilitiesSymbol.canParse( - obj['symbol'], reporter))) { - reporter - .reportError('must be of type WorkspaceClientCapabilitiesSymbol'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('executeCommand'); - try { - if (obj['executeCommand'] != null && - !(WorkspaceClientCapabilitiesExecuteCommand.canParse( - obj['executeCommand'], reporter))) { - reporter.reportError( - 'must be of type WorkspaceClientCapabilitiesExecuteCommand'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('workspaceFolders'); - try { - if (obj['workspaceFolders'] != null && - !(obj['workspaceFolders'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('configuration'); - try { - if (obj['configuration'] != null && !(obj['configuration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError('must be of type WorkspaceClientCapabilities'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is WorkspaceClientCapabilities && - other.runtimeType == WorkspaceClientCapabilities) { - return applyEdit == other.applyEdit && - workspaceEdit == other.workspaceEdit && - didChangeConfiguration == other.didChangeConfiguration && - didChangeWatchedFiles == other.didChangeWatchedFiles && - symbol == other.symbol && - executeCommand == other.executeCommand && - workspaceFolders == other.workspaceFolders && - configuration == other.configuration && - true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, applyEdit.hashCode); - hash = JenkinsSmiHash.combine(hash, workspaceEdit.hashCode); - hash = JenkinsSmiHash.combine(hash, didChangeConfiguration.hashCode); - hash = JenkinsSmiHash.combine(hash, didChangeWatchedFiles.hashCode); - hash = JenkinsSmiHash.combine(hash, symbol.hashCode); - hash = JenkinsSmiHash.combine(hash, executeCommand.hashCode); - hash = JenkinsSmiHash.combine(hash, workspaceFolders.hashCode); - hash = JenkinsSmiHash.combine(hash, configuration.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class WorkspaceClientCapabilitiesDidChangeConfiguration implements ToJsonable { - static const jsonHandler = LspJsonHandler( - WorkspaceClientCapabilitiesDidChangeConfiguration.canParse, - WorkspaceClientCapabilitiesDidChangeConfiguration.fromJson); - - WorkspaceClientCapabilitiesDidChangeConfiguration(this.dynamicRegistration); - static WorkspaceClientCapabilitiesDidChangeConfiguration fromJson( - Map json) { - final dynamicRegistration = json['dynamicRegistration']; - return WorkspaceClientCapabilitiesDidChangeConfiguration( - dynamicRegistration); - } - - /// Did change configuration notification supports dynamic registration. - final bool dynamicRegistration; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type WorkspaceClientCapabilitiesDidChangeConfiguration'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is WorkspaceClientCapabilitiesDidChangeConfiguration && - other.runtimeType == - WorkspaceClientCapabilitiesDidChangeConfiguration) { - return dynamicRegistration == other.dynamicRegistration && true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class WorkspaceClientCapabilitiesDidChangeWatchedFiles implements ToJsonable { - static const jsonHandler = LspJsonHandler( - WorkspaceClientCapabilitiesDidChangeWatchedFiles.canParse, - WorkspaceClientCapabilitiesDidChangeWatchedFiles.fromJson); - - WorkspaceClientCapabilitiesDidChangeWatchedFiles(this.dynamicRegistration); - static WorkspaceClientCapabilitiesDidChangeWatchedFiles fromJson( - Map json) { - final dynamicRegistration = json['dynamicRegistration']; - return WorkspaceClientCapabilitiesDidChangeWatchedFiles( - dynamicRegistration); - } - - /// Did change watched files notification supports dynamic registration. - /// Please note that the current protocol doesn't support static configuration - /// for file changes from the server side. - final bool dynamicRegistration; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type WorkspaceClientCapabilitiesDidChangeWatchedFiles'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is WorkspaceClientCapabilitiesDidChangeWatchedFiles && - other.runtimeType == WorkspaceClientCapabilitiesDidChangeWatchedFiles) { - return dynamicRegistration == other.dynamicRegistration && true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class WorkspaceClientCapabilitiesExecuteCommand implements ToJsonable { - static const jsonHandler = LspJsonHandler( - WorkspaceClientCapabilitiesExecuteCommand.canParse, - WorkspaceClientCapabilitiesExecuteCommand.fromJson); - - WorkspaceClientCapabilitiesExecuteCommand(this.dynamicRegistration); - static WorkspaceClientCapabilitiesExecuteCommand fromJson( - Map json) { - final dynamicRegistration = json['dynamicRegistration']; - return WorkspaceClientCapabilitiesExecuteCommand(dynamicRegistration); - } - - /// Execute command supports dynamic registration. - final bool dynamicRegistration; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type WorkspaceClientCapabilitiesExecuteCommand'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is WorkspaceClientCapabilitiesExecuteCommand && - other.runtimeType == WorkspaceClientCapabilitiesExecuteCommand) { - return dynamicRegistration == other.dynamicRegistration && true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class WorkspaceClientCapabilitiesSymbol implements ToJsonable { - static const jsonHandler = LspJsonHandler( - WorkspaceClientCapabilitiesSymbol.canParse, - WorkspaceClientCapabilitiesSymbol.fromJson); - - WorkspaceClientCapabilitiesSymbol(this.dynamicRegistration, this.symbolKind); - static WorkspaceClientCapabilitiesSymbol fromJson(Map json) { - final dynamicRegistration = json['dynamicRegistration']; - final symbolKind = json['symbolKind'] != null - ? WorkspaceClientCapabilitiesSymbolKind.fromJson(json['symbolKind']) - : null; - return WorkspaceClientCapabilitiesSymbol(dynamicRegistration, symbolKind); - } - - /// Symbol request supports dynamic registration. - final bool dynamicRegistration; - - /// Specific capabilities for the `SymbolKind` in the `workspace/symbol` - /// request. - final WorkspaceClientCapabilitiesSymbolKind symbolKind; - - Map toJson() { - var __result = {}; - if (dynamicRegistration != null) { - __result['dynamicRegistration'] = dynamicRegistration; - } - if (symbolKind != null) { - __result['symbolKind'] = symbolKind; - } - return __result; - } - - static bool canParse(Object obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('dynamicRegistration'); - try { - if (obj['dynamicRegistration'] != null && - !(obj['dynamicRegistration'] is bool)) { - reporter.reportError('must be of type bool'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('symbolKind'); - try { - if (obj['symbolKind'] != null && - !(WorkspaceClientCapabilitiesSymbolKind.canParse( - obj['symbolKind'], reporter))) { - reporter.reportError( - 'must be of type WorkspaceClientCapabilitiesSymbolKind'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError('must be of type WorkspaceClientCapabilitiesSymbol'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is WorkspaceClientCapabilitiesSymbol && - other.runtimeType == WorkspaceClientCapabilitiesSymbol) { - return dynamicRegistration == other.dynamicRegistration && - symbolKind == other.symbolKind && - true; - } - return false; - } - - @override - int get hashCode { - var hash = 0; - hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); - hash = JenkinsSmiHash.combine(hash, symbolKind.hashCode); - return JenkinsSmiHash.finish(hash); - } - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class WorkspaceClientCapabilitiesSymbolKind implements ToJsonable { - static const jsonHandler = LspJsonHandler( - WorkspaceClientCapabilitiesSymbolKind.canParse, - WorkspaceClientCapabilitiesSymbolKind.fromJson); - - WorkspaceClientCapabilitiesSymbolKind(this.valueSet); - static WorkspaceClientCapabilitiesSymbolKind fromJson( - Map json) { - final valueSet = json['valueSet'] - ?.map((item) => item != null ? SymbolKind.fromJson(item) : null) - ?.cast() - ?.toList(); - return WorkspaceClientCapabilitiesSymbolKind(valueSet); - } - - /// The symbol kind values the client supports. When this property exists the - /// client also guarantees that it will handle values outside its set - /// gracefully and falls back to a default value when unknown. + /// Mandatory title of the progress operation. Used to briefly inform about + /// the kind of operation being performed. /// - /// If this property is not present the client only supports the symbol kinds - /// from `File` to `Array` as defined in the initial version of the protocol. - final List valueSet; + /// Examples: "Indexing" or "Linking dependencies". + final String title; Map toJson() { var __result = {}; - if (valueSet != null) { - __result['valueSet'] = valueSet; + __result['kind'] = kind ?? (throw 'kind is required but was not set'); + __result['title'] = title ?? (throw 'title is required but was not set'); + if (cancellable != null) { + __result['cancellable'] = cancellable; + } + if (message != null) { + __result['message'] = message; + } + if (percentage != null) { + __result['percentage'] = percentage; } return __result; } static bool canParse(Object obj, LspJsonReporter reporter) { if (obj is Map) { - reporter.push('valueSet'); + reporter.push('kind'); try { - if (obj['valueSet'] != null && - !((obj['valueSet'] is List && - (obj['valueSet'] - .every((item) => SymbolKind.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + if (!obj.containsKey('kind')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['kind'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(obj['kind'] is String)) { + reporter.reportError('must be of type String'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('title'); + try { + if (!obj.containsKey('title')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['title'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(obj['title'] is String)) { + reporter.reportError('must be of type String'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('cancellable'); + try { + if (obj['cancellable'] != null && !(obj['cancellable'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('message'); + try { + if (obj['message'] != null && !(obj['message'] is String)) { + reporter.reportError('must be of type String'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('percentage'); + try { + if (obj['percentage'] != null && !(obj['percentage'] is num)) { + reporter.reportError('must be of type num'); return false; } } finally { @@ -17196,18 +23473,20 @@ class WorkspaceClientCapabilitiesSymbolKind implements ToJsonable { } return true; } else { - reporter - .reportError('must be of type WorkspaceClientCapabilitiesSymbolKind'); + reporter.reportError('must be of type WorkDoneProgressBegin'); return false; } } @override bool operator ==(Object other) { - if (other is WorkspaceClientCapabilitiesSymbolKind && - other.runtimeType == WorkspaceClientCapabilitiesSymbolKind) { - return listEqual(valueSet, other.valueSet, - (SymbolKind a, SymbolKind b) => a == b) && + if (other is WorkDoneProgressBegin && + other.runtimeType == WorkDoneProgressBegin) { + return kind == other.kind && + title == other.title && + cancellable == other.cancellable && + message == other.message && + percentage == other.percentage && true; } return false; @@ -17216,7 +23495,11 @@ class WorkspaceClientCapabilitiesSymbolKind implements ToJsonable { @override int get hashCode { var hash = 0; - hash = JenkinsSmiHash.combine(hash, lspHashCode(valueSet)); + hash = JenkinsSmiHash.combine(hash, kind.hashCode); + hash = JenkinsSmiHash.combine(hash, title.hashCode); + hash = JenkinsSmiHash.combine(hash, cancellable.hashCode); + hash = JenkinsSmiHash.combine(hash, message.hashCode); + hash = JenkinsSmiHash.combine(hash, percentage.hashCode); return JenkinsSmiHash.finish(hash); } @@ -17224,82 +23507,48 @@ class WorkspaceClientCapabilitiesSymbolKind implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -class WorkspaceClientCapabilitiesWorkspaceEdit implements ToJsonable { +class WorkDoneProgressCancelParams implements ToJsonable { static const jsonHandler = LspJsonHandler( - WorkspaceClientCapabilitiesWorkspaceEdit.canParse, - WorkspaceClientCapabilitiesWorkspaceEdit.fromJson); + WorkDoneProgressCancelParams.canParse, + WorkDoneProgressCancelParams.fromJson); - WorkspaceClientCapabilitiesWorkspaceEdit( - this.documentChanges, this.resourceOperations, this.failureHandling); - static WorkspaceClientCapabilitiesWorkspaceEdit fromJson( - Map json) { - final documentChanges = json['documentChanges']; - final resourceOperations = json['resourceOperations'] - ?.map((item) => - item != null ? ResourceOperationKind.fromJson(item) : null) - ?.cast() - ?.toList(); - final failureHandling = json['failureHandling'] != null - ? FailureHandlingKind.fromJson(json['failureHandling']) - : null; - return WorkspaceClientCapabilitiesWorkspaceEdit( - documentChanges, resourceOperations, failureHandling); + WorkDoneProgressCancelParams(this.token) { + if (token == null) { + throw 'token is required but was not provided'; + } + } + static WorkDoneProgressCancelParams fromJson(Map json) { + final token = json['token'] is num + ? Either2.t1(json['token']) + : (json['token'] is String + ? Either2.t2(json['token']) + : (throw '''${json['token']} was not one of (num, String)''')); + return WorkDoneProgressCancelParams(token); } - /// The client supports versioned document changes in `WorkspaceEdit`s - final bool documentChanges; - - /// The failure handling strategy of a client if applying the workspace edit - /// fails. - final FailureHandlingKind failureHandling; - - /// The resource operations the client supports. Clients should at least - /// support 'create', 'rename' and 'delete' files and folders. - final List resourceOperations; + /// The token to be used to report progress. + final Either2 token; Map toJson() { var __result = {}; - if (documentChanges != null) { - __result['documentChanges'] = documentChanges; - } - if (resourceOperations != null) { - __result['resourceOperations'] = resourceOperations; - } - if (failureHandling != null) { - __result['failureHandling'] = failureHandling; - } + __result['token'] = token ?? (throw 'token is required but was not set'); return __result; } static bool canParse(Object obj, LspJsonReporter reporter) { if (obj is Map) { - reporter.push('documentChanges'); + reporter.push('token'); try { - if (obj['documentChanges'] != null && - !(obj['documentChanges'] is bool)) { - reporter.reportError('must be of type bool'); + if (!obj.containsKey('token')) { + reporter.reportError('must not be undefined'); return false; } - } finally { - reporter.pop(); - } - reporter.push('resourceOperations'); - try { - if (obj['resourceOperations'] != null && - !((obj['resourceOperations'] is List && - (obj['resourceOperations'].every((item) => - ResourceOperationKind.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + if (obj['token'] == null) { + reporter.reportError('must not be null'); return false; } - } finally { - reporter.pop(); - } - reporter.push('failureHandling'); - try { - if (obj['failureHandling'] != null && - !(FailureHandlingKind.canParse(obj['failureHandling'], reporter))) { - reporter.reportError('must be of type FailureHandlingKind'); + if (!((obj['token'] is num || obj['token'] is String))) { + reporter.reportError('must be of type Either2'); return false; } } finally { @@ -17307,20 +23556,566 @@ class WorkspaceClientCapabilitiesWorkspaceEdit implements ToJsonable { } return true; } else { - reporter.reportError( - 'must be of type WorkspaceClientCapabilitiesWorkspaceEdit'); + reporter.reportError('must be of type WorkDoneProgressCancelParams'); return false; } } @override bool operator ==(Object other) { - if (other is WorkspaceClientCapabilitiesWorkspaceEdit && - other.runtimeType == WorkspaceClientCapabilitiesWorkspaceEdit) { - return documentChanges == other.documentChanges && - listEqual(resourceOperations, other.resourceOperations, - (ResourceOperationKind a, ResourceOperationKind b) => a == b) && - failureHandling == other.failureHandling && + if (other is WorkDoneProgressCancelParams && + other.runtimeType == WorkDoneProgressCancelParams) { + return token == other.token && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, token.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class WorkDoneProgressCreateParams implements ToJsonable { + static const jsonHandler = LspJsonHandler( + WorkDoneProgressCreateParams.canParse, + WorkDoneProgressCreateParams.fromJson); + + WorkDoneProgressCreateParams(this.token) { + if (token == null) { + throw 'token is required but was not provided'; + } + } + static WorkDoneProgressCreateParams fromJson(Map json) { + final token = json['token'] is num + ? Either2.t1(json['token']) + : (json['token'] is String + ? Either2.t2(json['token']) + : (throw '''${json['token']} was not one of (num, String)''')); + return WorkDoneProgressCreateParams(token); + } + + /// The token to be used to report progress. + final Either2 token; + + Map toJson() { + var __result = {}; + __result['token'] = token ?? (throw 'token is required but was not set'); + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('token'); + try { + if (!obj.containsKey('token')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['token'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!((obj['token'] is num || obj['token'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type WorkDoneProgressCreateParams'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is WorkDoneProgressCreateParams && + other.runtimeType == WorkDoneProgressCreateParams) { + return token == other.token && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, token.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class WorkDoneProgressEnd implements ToJsonable { + static const jsonHandler = LspJsonHandler( + WorkDoneProgressEnd.canParse, WorkDoneProgressEnd.fromJson); + + WorkDoneProgressEnd(this.kind, this.message) { + if (kind == null) { + throw 'kind is required but was not provided'; + } + } + static WorkDoneProgressEnd fromJson(Map json) { + final kind = json['kind']; + final message = json['message']; + return WorkDoneProgressEnd(kind, message); + } + + final String kind; + + /// Optional, a final message indicating to for example indicate the outcome + /// of the operation. + final String message; + + Map toJson() { + var __result = {}; + __result['kind'] = kind ?? (throw 'kind is required but was not set'); + if (message != null) { + __result['message'] = message; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('kind'); + try { + if (!obj.containsKey('kind')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['kind'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(obj['kind'] is String)) { + reporter.reportError('must be of type String'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('message'); + try { + if (obj['message'] != null && !(obj['message'] is String)) { + reporter.reportError('must be of type String'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type WorkDoneProgressEnd'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is WorkDoneProgressEnd && + other.runtimeType == WorkDoneProgressEnd) { + return kind == other.kind && message == other.message && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, kind.hashCode); + hash = JenkinsSmiHash.combine(hash, message.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class WorkDoneProgressOptions implements ToJsonable { + static const jsonHandler = LspJsonHandler( + WorkDoneProgressOptions.canParse, WorkDoneProgressOptions.fromJson); + + WorkDoneProgressOptions(this.workDoneProgress); + static WorkDoneProgressOptions fromJson(Map json) { + if (WorkspaceSymbolOptions.canParse(json, nullLspJsonReporter)) { + return WorkspaceSymbolOptions.fromJson(json); + } + if (ExecuteCommandOptions.canParse(json, nullLspJsonReporter)) { + return ExecuteCommandOptions.fromJson(json); + } + if (CompletionOptions.canParse(json, nullLspJsonReporter)) { + return CompletionOptions.fromJson(json); + } + if (HoverOptions.canParse(json, nullLspJsonReporter)) { + return HoverOptions.fromJson(json); + } + if (SignatureHelpOptions.canParse(json, nullLspJsonReporter)) { + return SignatureHelpOptions.fromJson(json); + } + if (DeclarationOptions.canParse(json, nullLspJsonReporter)) { + return DeclarationOptions.fromJson(json); + } + if (DefinitionOptions.canParse(json, nullLspJsonReporter)) { + return DefinitionOptions.fromJson(json); + } + if (TypeDefinitionOptions.canParse(json, nullLspJsonReporter)) { + return TypeDefinitionOptions.fromJson(json); + } + if (ImplementationOptions.canParse(json, nullLspJsonReporter)) { + return ImplementationOptions.fromJson(json); + } + if (ReferenceOptions.canParse(json, nullLspJsonReporter)) { + return ReferenceOptions.fromJson(json); + } + if (DocumentHighlightOptions.canParse(json, nullLspJsonReporter)) { + return DocumentHighlightOptions.fromJson(json); + } + if (DocumentSymbolOptions.canParse(json, nullLspJsonReporter)) { + return DocumentSymbolOptions.fromJson(json); + } + if (CodeActionOptions.canParse(json, nullLspJsonReporter)) { + return CodeActionOptions.fromJson(json); + } + if (CodeLensOptions.canParse(json, nullLspJsonReporter)) { + return CodeLensOptions.fromJson(json); + } + if (DocumentLinkOptions.canParse(json, nullLspJsonReporter)) { + return DocumentLinkOptions.fromJson(json); + } + if (DocumentColorOptions.canParse(json, nullLspJsonReporter)) { + return DocumentColorOptions.fromJson(json); + } + if (DocumentFormattingOptions.canParse(json, nullLspJsonReporter)) { + return DocumentFormattingOptions.fromJson(json); + } + if (DocumentRangeFormattingOptions.canParse(json, nullLspJsonReporter)) { + return DocumentRangeFormattingOptions.fromJson(json); + } + if (RenameOptions.canParse(json, nullLspJsonReporter)) { + return RenameOptions.fromJson(json); + } + if (FoldingRangeOptions.canParse(json, nullLspJsonReporter)) { + return FoldingRangeOptions.fromJson(json); + } + if (SelectionRangeOptions.canParse(json, nullLspJsonReporter)) { + return SelectionRangeOptions.fromJson(json); + } + final workDoneProgress = json['workDoneProgress']; + return WorkDoneProgressOptions(workDoneProgress); + } + + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type WorkDoneProgressOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is WorkDoneProgressOptions && + other.runtimeType == WorkDoneProgressOptions) { + return workDoneProgress == other.workDoneProgress && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class WorkDoneProgressParams implements ToJsonable { + static const jsonHandler = LspJsonHandler( + WorkDoneProgressParams.canParse, WorkDoneProgressParams.fromJson); + + WorkDoneProgressParams(this.workDoneToken); + static WorkDoneProgressParams fromJson(Map json) { + if (InitializeParams.canParse(json, nullLspJsonReporter)) { + return InitializeParams.fromJson(json); + } + if (WorkspaceSymbolParams.canParse(json, nullLspJsonReporter)) { + return WorkspaceSymbolParams.fromJson(json); + } + if (ExecuteCommandParams.canParse(json, nullLspJsonReporter)) { + return ExecuteCommandParams.fromJson(json); + } + if (CompletionParams.canParse(json, nullLspJsonReporter)) { + return CompletionParams.fromJson(json); + } + if (HoverParams.canParse(json, nullLspJsonReporter)) { + return HoverParams.fromJson(json); + } + if (SignatureHelpParams.canParse(json, nullLspJsonReporter)) { + return SignatureHelpParams.fromJson(json); + } + if (DeclarationParams.canParse(json, nullLspJsonReporter)) { + return DeclarationParams.fromJson(json); + } + if (DefinitionParams.canParse(json, nullLspJsonReporter)) { + return DefinitionParams.fromJson(json); + } + if (TypeDefinitionParams.canParse(json, nullLspJsonReporter)) { + return TypeDefinitionParams.fromJson(json); + } + if (ImplementationParams.canParse(json, nullLspJsonReporter)) { + return ImplementationParams.fromJson(json); + } + if (ReferenceParams.canParse(json, nullLspJsonReporter)) { + return ReferenceParams.fromJson(json); + } + if (DocumentHighlightParams.canParse(json, nullLspJsonReporter)) { + return DocumentHighlightParams.fromJson(json); + } + if (DocumentSymbolParams.canParse(json, nullLspJsonReporter)) { + return DocumentSymbolParams.fromJson(json); + } + if (CodeActionParams.canParse(json, nullLspJsonReporter)) { + return CodeActionParams.fromJson(json); + } + if (CodeLensParams.canParse(json, nullLspJsonReporter)) { + return CodeLensParams.fromJson(json); + } + if (DocumentLinkParams.canParse(json, nullLspJsonReporter)) { + return DocumentLinkParams.fromJson(json); + } + if (DocumentColorParams.canParse(json, nullLspJsonReporter)) { + return DocumentColorParams.fromJson(json); + } + if (ColorPresentationParams.canParse(json, nullLspJsonReporter)) { + return ColorPresentationParams.fromJson(json); + } + if (DocumentFormattingParams.canParse(json, nullLspJsonReporter)) { + return DocumentFormattingParams.fromJson(json); + } + if (DocumentRangeFormattingParams.canParse(json, nullLspJsonReporter)) { + return DocumentRangeFormattingParams.fromJson(json); + } + if (RenameParams.canParse(json, nullLspJsonReporter)) { + return RenameParams.fromJson(json); + } + if (FoldingRangeParams.canParse(json, nullLspJsonReporter)) { + return FoldingRangeParams.fromJson(json); + } + if (SelectionRangeParams.canParse(json, nullLspJsonReporter)) { + return SelectionRangeParams.fromJson(json); + } + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + return WorkDoneProgressParams(workDoneToken); + } + + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + + Map toJson() { + var __result = {}; + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('workDoneToken'); + try { + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type WorkDoneProgressParams'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is WorkDoneProgressParams && + other.runtimeType == WorkDoneProgressParams) { + return workDoneToken == other.workDoneToken && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class WorkDoneProgressReport implements ToJsonable { + static const jsonHandler = LspJsonHandler( + WorkDoneProgressReport.canParse, WorkDoneProgressReport.fromJson); + + WorkDoneProgressReport( + this.kind, this.cancellable, this.message, this.percentage) { + if (kind == null) { + throw 'kind is required but was not provided'; + } + } + static WorkDoneProgressReport fromJson(Map json) { + final kind = json['kind']; + final cancellable = json['cancellable']; + final message = json['message']; + final percentage = json['percentage']; + return WorkDoneProgressReport(kind, cancellable, message, percentage); + } + + /// Controls enablement state of a cancel button. This property is only valid + /// if a cancel button got requested in the `WorkDoneProgressStart` payload. + /// + /// Clients that don't support cancellation or don't support control the + /// button's enablement state are allowed to ignore the setting. + final bool cancellable; + final String kind; + + /// Optional, more detailed associated progress message. Contains + /// complementary information to the `title`. + /// + /// Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". If + /// unset, the previous progress message (if any) is still valid. + final String message; + + /// Optional progress percentage to display (value 100 is considered 100%). If + /// not provided infinite progress is assumed and clients are allowed to + /// ignore the `percentage` value in subsequent in report notifications. + /// + /// The value should be steadily rising. Clients are free to ignore values + /// that are not following this rule. + final num percentage; + + Map toJson() { + var __result = {}; + __result['kind'] = kind ?? (throw 'kind is required but was not set'); + if (cancellable != null) { + __result['cancellable'] = cancellable; + } + if (message != null) { + __result['message'] = message; + } + if (percentage != null) { + __result['percentage'] = percentage; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('kind'); + try { + if (!obj.containsKey('kind')) { + reporter.reportError('must not be undefined'); + return false; + } + if (obj['kind'] == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(obj['kind'] is String)) { + reporter.reportError('must be of type String'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('cancellable'); + try { + if (obj['cancellable'] != null && !(obj['cancellable'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('message'); + try { + if (obj['message'] != null && !(obj['message'] is String)) { + reporter.reportError('must be of type String'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('percentage'); + try { + if (obj['percentage'] != null && !(obj['percentage'] is num)) { + reporter.reportError('must be of type num'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type WorkDoneProgressReport'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is WorkDoneProgressReport && + other.runtimeType == WorkDoneProgressReport) { + return kind == other.kind && + cancellable == other.cancellable && + message == other.message && + percentage == other.percentage && true; } return false; @@ -17329,9 +24124,10 @@ class WorkspaceClientCapabilitiesWorkspaceEdit implements ToJsonable { @override int get hashCode { var hash = 0; - hash = JenkinsSmiHash.combine(hash, documentChanges.hashCode); - hash = JenkinsSmiHash.combine(hash, lspHashCode(resourceOperations)); - hash = JenkinsSmiHash.combine(hash, failureHandling.hashCode); + hash = JenkinsSmiHash.combine(hash, kind.hashCode); + hash = JenkinsSmiHash.combine(hash, cancellable.hashCode); + hash = JenkinsSmiHash.combine(hash, message.hashCode); + hash = JenkinsSmiHash.combine(hash, percentage.hashCode); return JenkinsSmiHash.finish(hash); } @@ -17474,6 +24270,121 @@ class WorkspaceEdit implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } +class WorkspaceEditClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + WorkspaceEditClientCapabilities.canParse, + WorkspaceEditClientCapabilities.fromJson); + + WorkspaceEditClientCapabilities( + this.documentChanges, this.resourceOperations, this.failureHandling); + static WorkspaceEditClientCapabilities fromJson(Map json) { + final documentChanges = json['documentChanges']; + final resourceOperations = json['resourceOperations'] + ?.map((item) => + item != null ? ResourceOperationKind.fromJson(item) : null) + ?.cast() + ?.toList(); + final failureHandling = json['failureHandling'] != null + ? FailureHandlingKind.fromJson(json['failureHandling']) + : null; + return WorkspaceEditClientCapabilities( + documentChanges, resourceOperations, failureHandling); + } + + /// The client supports versioned document changes in `WorkspaceEdit`s + final bool documentChanges; + + /// The failure handling strategy of a client if applying the workspace edit + /// fails. + /// @since 3.13.0 + final FailureHandlingKind failureHandling; + + /// The resource operations the client supports. Clients should at least + /// support 'create', 'rename' and 'delete' files and folders. + /// @since 3.13.0 + final List resourceOperations; + + Map toJson() { + var __result = {}; + if (documentChanges != null) { + __result['documentChanges'] = documentChanges; + } + if (resourceOperations != null) { + __result['resourceOperations'] = resourceOperations; + } + if (failureHandling != null) { + __result['failureHandling'] = failureHandling; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('documentChanges'); + try { + if (obj['documentChanges'] != null && + !(obj['documentChanges'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('resourceOperations'); + try { + if (obj['resourceOperations'] != null && + !((obj['resourceOperations'] is List && + (obj['resourceOperations'].every((item) => + ResourceOperationKind.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('failureHandling'); + try { + if (obj['failureHandling'] != null && + !(FailureHandlingKind.canParse(obj['failureHandling'], reporter))) { + reporter.reportError('must be of type FailureHandlingKind'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type WorkspaceEditClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is WorkspaceEditClientCapabilities && + other.runtimeType == WorkspaceEditClientCapabilities) { + return documentChanges == other.documentChanges && + listEqual(resourceOperations, other.resourceOperations, + (ResourceOperationKind a, ResourceOperationKind b) => a == b) && + failureHandling == other.failureHandling && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, documentChanges.hashCode); + hash = JenkinsSmiHash.combine(hash, lspHashCode(resourceOperations)); + hash = JenkinsSmiHash.combine(hash, failureHandling.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + class WorkspaceFolder implements ToJsonable { static const jsonHandler = LspJsonHandler(WorkspaceFolder.canParse, WorkspaceFolder.fromJson); @@ -17681,27 +24592,376 @@ class WorkspaceFoldersChangeEvent implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } +class WorkspaceFoldersServerCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + WorkspaceFoldersServerCapabilities.canParse, + WorkspaceFoldersServerCapabilities.fromJson); + + WorkspaceFoldersServerCapabilities(this.supported, this.changeNotifications); + static WorkspaceFoldersServerCapabilities fromJson( + Map json) { + final supported = json['supported']; + final changeNotifications = json['changeNotifications'] is String + ? Either2.t1(json['changeNotifications']) + : (json['changeNotifications'] is bool + ? Either2.t2(json['changeNotifications']) + : (json['changeNotifications'] == null + ? null + : (throw '''${json['changeNotifications']} was not one of (String, bool)'''))); + return WorkspaceFoldersServerCapabilities(supported, changeNotifications); + } + + /// 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. + final Either2 changeNotifications; + + /// The server has support for workspace folders + final bool supported; + + Map toJson() { + var __result = {}; + if (supported != null) { + __result['supported'] = supported; + } + if (changeNotifications != null) { + __result['changeNotifications'] = changeNotifications; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('supported'); + try { + if (obj['supported'] != null && !(obj['supported'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('changeNotifications'); + try { + if (obj['changeNotifications'] != null && + !((obj['changeNotifications'] is String || + obj['changeNotifications'] is bool))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter + .reportError('must be of type WorkspaceFoldersServerCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is WorkspaceFoldersServerCapabilities && + other.runtimeType == WorkspaceFoldersServerCapabilities) { + return supported == other.supported && + changeNotifications == other.changeNotifications && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, supported.hashCode); + hash = JenkinsSmiHash.combine(hash, changeNotifications.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class WorkspaceSymbolClientCapabilities implements ToJsonable { + static const jsonHandler = LspJsonHandler( + WorkspaceSymbolClientCapabilities.canParse, + WorkspaceSymbolClientCapabilities.fromJson); + + WorkspaceSymbolClientCapabilities(this.dynamicRegistration, this.symbolKind); + static WorkspaceSymbolClientCapabilities fromJson(Map json) { + final dynamicRegistration = json['dynamicRegistration']; + final symbolKind = json['symbolKind'] != null + ? WorkspaceSymbolClientCapabilitiesSymbolKind.fromJson( + json['symbolKind']) + : null; + return WorkspaceSymbolClientCapabilities(dynamicRegistration, symbolKind); + } + + /// Symbol request supports dynamic registration. + final bool dynamicRegistration; + + /// Specific capabilities for the `SymbolKind` in the `workspace/symbol` + /// request. + final WorkspaceSymbolClientCapabilitiesSymbolKind symbolKind; + + Map toJson() { + var __result = {}; + if (dynamicRegistration != null) { + __result['dynamicRegistration'] = dynamicRegistration; + } + if (symbolKind != null) { + __result['symbolKind'] = symbolKind; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('dynamicRegistration'); + try { + if (obj['dynamicRegistration'] != null && + !(obj['dynamicRegistration'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('symbolKind'); + try { + if (obj['symbolKind'] != null && + !(WorkspaceSymbolClientCapabilitiesSymbolKind.canParse( + obj['symbolKind'], reporter))) { + reporter.reportError( + 'must be of type WorkspaceSymbolClientCapabilitiesSymbolKind'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type WorkspaceSymbolClientCapabilities'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is WorkspaceSymbolClientCapabilities && + other.runtimeType == WorkspaceSymbolClientCapabilities) { + return dynamicRegistration == other.dynamicRegistration && + symbolKind == other.symbolKind && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, dynamicRegistration.hashCode); + hash = JenkinsSmiHash.combine(hash, symbolKind.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class WorkspaceSymbolClientCapabilitiesSymbolKind implements ToJsonable { + static const jsonHandler = LspJsonHandler( + WorkspaceSymbolClientCapabilitiesSymbolKind.canParse, + WorkspaceSymbolClientCapabilitiesSymbolKind.fromJson); + + WorkspaceSymbolClientCapabilitiesSymbolKind(this.valueSet); + static WorkspaceSymbolClientCapabilitiesSymbolKind fromJson( + Map json) { + final valueSet = json['valueSet'] + ?.map((item) => item != null ? SymbolKind.fromJson(item) : null) + ?.cast() + ?.toList(); + return WorkspaceSymbolClientCapabilitiesSymbolKind(valueSet); + } + + /// The symbol kind values the client supports. When this property exists the + /// client also guarantees that it will handle values outside its set + /// gracefully and falls back to a default value when unknown. + /// + /// If this property is not present the client only supports the symbol kinds + /// from `File` to `Array` as defined in the initial version of the protocol. + final List valueSet; + + Map toJson() { + var __result = {}; + if (valueSet != null) { + __result['valueSet'] = valueSet; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('valueSet'); + try { + if (obj['valueSet'] != null && + !((obj['valueSet'] is List && + (obj['valueSet'] + .every((item) => SymbolKind.canParse(item, reporter)))))) { + reporter.reportError('must be of type List'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError( + 'must be of type WorkspaceSymbolClientCapabilitiesSymbolKind'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is WorkspaceSymbolClientCapabilitiesSymbolKind && + other.runtimeType == WorkspaceSymbolClientCapabilitiesSymbolKind) { + return listEqual(valueSet, other.valueSet, + (SymbolKind a, SymbolKind b) => a == b) && + true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, lspHashCode(valueSet)); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class WorkspaceSymbolOptions implements WorkDoneProgressOptions, ToJsonable { + static const jsonHandler = LspJsonHandler( + WorkspaceSymbolOptions.canParse, WorkspaceSymbolOptions.fromJson); + + WorkspaceSymbolOptions(this.workDoneProgress); + static WorkspaceSymbolOptions fromJson(Map json) { + if (WorkspaceSymbolRegistrationOptions.canParse( + json, nullLspJsonReporter)) { + return WorkspaceSymbolRegistrationOptions.fromJson(json); + } + final workDoneProgress = json['workDoneProgress']; + return WorkspaceSymbolOptions(workDoneProgress); + } + + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type WorkspaceSymbolOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is WorkspaceSymbolOptions && + other.runtimeType == WorkspaceSymbolOptions) { + return workDoneProgress == other.workDoneProgress && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + /// The parameters of a Workspace Symbol Request. -class WorkspaceSymbolParams implements ToJsonable { +class WorkspaceSymbolParams + implements WorkDoneProgressParams, PartialResultParams, ToJsonable { static const jsonHandler = LspJsonHandler( WorkspaceSymbolParams.canParse, WorkspaceSymbolParams.fromJson); - WorkspaceSymbolParams(this.query) { + WorkspaceSymbolParams( + this.query, this.workDoneToken, this.partialResultToken) { if (query == null) { throw 'query is required but was not provided'; } } static WorkspaceSymbolParams fromJson(Map json) { final query = json['query']; - return WorkspaceSymbolParams(query); + final workDoneToken = json['workDoneToken'] is num + ? Either2.t1(json['workDoneToken']) + : (json['workDoneToken'] is String + ? Either2.t2(json['workDoneToken']) + : (json['workDoneToken'] == null + ? null + : (throw '''${json['workDoneToken']} was not one of (num, String)'''))); + final partialResultToken = json['partialResultToken'] is num + ? Either2.t1(json['partialResultToken']) + : (json['partialResultToken'] is String + ? Either2.t2(json['partialResultToken']) + : (json['partialResultToken'] == null + ? null + : (throw '''${json['partialResultToken']} was not one of (num, String)'''))); + return WorkspaceSymbolParams(query, workDoneToken, partialResultToken); } - /// A non-empty query string + /// An optional token that a server can use to report partial results (e.g. + /// streaming) to the client. + final Either2 partialResultToken; + + /// A query string to filter symbols by. Clients may send an empty string here + /// to request all symbols. final String query; + /// An optional token that a server can use to report work done progress. + final Either2 workDoneToken; + Map toJson() { var __result = {}; __result['query'] = query ?? (throw 'query is required but was not set'); + if (workDoneToken != null) { + __result['workDoneToken'] = workDoneToken; + } + if (partialResultToken != null) { + __result['partialResultToken'] = partialResultToken; + } return __result; } @@ -17724,6 +24984,28 @@ class WorkspaceSymbolParams implements ToJsonable { } finally { reporter.pop(); } + reporter.push('workDoneToken'); + try { + if (obj['workDoneToken'] != null && + !((obj['workDoneToken'] is num || + obj['workDoneToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('partialResultToken'); + try { + if (obj['partialResultToken'] != null && + !((obj['partialResultToken'] is num || + obj['partialResultToken'] is String))) { + reporter.reportError('must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } return true; } else { reporter.reportError('must be of type WorkspaceSymbolParams'); @@ -17735,7 +25017,10 @@ class WorkspaceSymbolParams implements ToJsonable { bool operator ==(Object other) { if (other is WorkspaceSymbolParams && other.runtimeType == WorkspaceSymbolParams) { - return query == other.query && true; + return query == other.query && + workDoneToken == other.workDoneToken && + partialResultToken == other.partialResultToken && + true; } return false; } @@ -17744,6 +25029,71 @@ class WorkspaceSymbolParams implements ToJsonable { int get hashCode { var hash = 0; hash = JenkinsSmiHash.combine(hash, query.hashCode); + hash = JenkinsSmiHash.combine(hash, workDoneToken.hashCode); + hash = JenkinsSmiHash.combine(hash, partialResultToken.hashCode); + return JenkinsSmiHash.finish(hash); + } + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class WorkspaceSymbolRegistrationOptions + implements WorkspaceSymbolOptions, ToJsonable { + static const jsonHandler = LspJsonHandler( + WorkspaceSymbolRegistrationOptions.canParse, + WorkspaceSymbolRegistrationOptions.fromJson); + + WorkspaceSymbolRegistrationOptions(this.workDoneProgress); + static WorkspaceSymbolRegistrationOptions fromJson( + Map json) { + final workDoneProgress = json['workDoneProgress']; + return WorkspaceSymbolRegistrationOptions(workDoneProgress); + } + + final bool workDoneProgress; + + Map toJson() { + var __result = {}; + if (workDoneProgress != null) { + __result['workDoneProgress'] = workDoneProgress; + } + return __result; + } + + static bool canParse(Object obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('workDoneProgress'); + try { + if (obj['workDoneProgress'] != null && + !(obj['workDoneProgress'] is bool)) { + reporter.reportError('must be of type bool'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter + .reportError('must be of type WorkspaceSymbolRegistrationOptions'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is WorkspaceSymbolRegistrationOptions && + other.runtimeType == WorkspaceSymbolRegistrationOptions) { + return workDoneProgress == other.workDoneProgress && true; + } + return false; + } + + @override + int get hashCode { + var hash = 0; + hash = JenkinsSmiHash.combine(hash, workDoneProgress.hashCode); return JenkinsSmiHash.finish(hash); } diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_code_actions.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_code_actions.dart index da57ee1ce6d..729a0cd07f5 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_code_actions.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_code_actions.dart @@ -89,7 +89,7 @@ class CodeActionHandler extends MessageHandler.t2( - CodeAction(command.title, kind, null, null, command), + CodeAction(command.title, kind, null, false, null, command), ) : Either2.t1(command); } @@ -103,6 +103,7 @@ class CodeActionHandler extends MessageHandler r.diagnostics).toList(), + false, first.edit, first.command); }).toList(); diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart index cc4b4155485..e96b54a160c 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart @@ -154,7 +154,7 @@ class CompletionHandler '$name/$declaringUri'; Future>> _getPluginResults( - TextDocumentClientCapabilitiesCompletion completionCapabilities, + CompletionClientCapabilities completionCapabilities, HashSet clientSupportedCompletionKinds, LineInfo lineInfo, String path, @@ -177,7 +177,7 @@ class CompletionHandler } Future>> _getServerItems( - TextDocumentClientCapabilitiesCompletion completionCapabilities, + CompletionClientCapabilities completionCapabilities, HashSet clientSupportedCompletionKinds, bool includeSuggestionSets, ResolvedUnitResult unit, @@ -340,7 +340,7 @@ class CompletionHandler } Iterable _pluginResultsToItems( - TextDocumentClientCapabilitiesCompletion completionCapabilities, + CompletionClientCapabilities completionCapabilities, HashSet clientSupportedCompletionKinds, LineInfo lineInfo, List pluginResults, diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_completion_resolve.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_completion_resolve.dart index e6a8cfea40d..014e091f23c 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_completion_resolve.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_completion_resolve.dart @@ -148,11 +148,15 @@ class CompletionResolveHandler return success(CompletionItem( item.label, item.kind, + null, // TODO(dantup): CompletionItemTags (eg. deprecated) data.displayUri != null && thisFilesChanges.isNotEmpty ? "Auto import from '${data.displayUri}'\n\n${item.detail ?? ''}" .trim() : item.detail, documentation, + // The deprecated field is deprecated, but we should still supply it + // for clients that have not adopted CompletionItemTags. + // ignore: deprecated_member_use_from_same_package item.deprecated, item.preselect, item.sortText, diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_initialize.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_initialize.dart index 7df227a09b9..bf03777d14b 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_initialize.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_initialize.dart @@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:io'; + import 'package:analysis_server/lsp_protocol/protocol_generated.dart'; import 'package:analysis_server/lsp_protocol/protocol_special.dart'; import 'package:analysis_server/src/lsp/handlers/handler_states.dart'; @@ -55,6 +57,18 @@ class InitializeMessageHandler server.capabilities = server.capabilitiesComputer .computeServerCapabilities(params.capabilities); - return success(InitializeResult(server.capabilities)); + + var sdkVersion = Platform.version; + if (sdkVersion.contains(' ')) { + sdkVersion = sdkVersion.substring(0, sdkVersion.indexOf(' ')); + } + + return success(InitializeResult( + server.capabilities, + InitializeResultServerInfo( + 'Dart SDK LSP Analysis Server', + sdkVersion, + ), + )); } } diff --git a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart index 64bb95469d9..0400180c219 100644 --- a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart +++ b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart @@ -377,7 +377,8 @@ class LspAnalysisServer extends AbstractAnalysisServer { } void publishDiagnostics(String path, List errors) { - final params = PublishDiagnosticsParams(Uri.file(path).toString(), errors); + final params = + PublishDiagnosticsParams(Uri.file(path).toString(), null, errors); final message = NotificationMessage( Method.textDocument_publishDiagnostics, params, diff --git a/pkg/analysis_server/lib/src/lsp/lsp_socket_server.dart b/pkg/analysis_server/lib/src/lsp/lsp_socket_server.dart index 3c49e8afd46..8d11987da55 100644 --- a/pkg/analysis_server/lib/src/lsp/lsp_socket_server.dart +++ b/pkg/analysis_server/lib/src/lsp/lsp_socket_server.dart @@ -45,10 +45,11 @@ class LspSocketServer implements AbstractSocketServer { /// given serverChannel. void createAnalysisServer(LspServerCommunicationChannel serverChannel) { if (analysisServer != null) { - ResponseError error = ResponseError( - ServerErrorCodes.ServerAlreadyStarted, - 'Server already started', - null); + final error = ResponseError( + ServerErrorCodes.ServerAlreadyStarted, + 'Server already started', + null, + ); serverChannel.sendNotification(NotificationMessage( Method.window_showMessage, ShowMessageParams(MessageType.Error, error.message), diff --git a/pkg/analysis_server/lib/src/lsp/mapping.dart b/pkg/analysis_server/lib/src/lsp/mapping.dart index 198f463da4b..54ce532aed5 100644 --- a/pkg/analysis_server/lib/src/lsp/mapping.dart +++ b/pkg/analysis_server/lib/src/lsp/mapping.dart @@ -175,7 +175,7 @@ lsp.SymbolKind declarationKindToSymbolKind( } lsp.CompletionItem declarationToCompletionItem( - lsp.TextDocumentClientCapabilitiesCompletion completionCapabilities, + lsp.CompletionClientCapabilities completionCapabilities, HashSet supportedCompletionItemKinds, String file, int offset, @@ -243,6 +243,7 @@ lsp.CompletionItem declarationToCompletionItem( return lsp.CompletionItem( label, completionKind, + null, // TODO(dantup): CompletionItemTags getDeclarationCompletionDetail(declaration, completionKind, useDeprecated), null, // documentation - will be added during resolve. useDeprecated && declaration.isDeprecated ? true : null, @@ -573,6 +574,7 @@ lsp.Diagnostic pluginToDiagnostic( error.code, languageSourceName, message, + null, // TODO(dantup): DiagnosticTags relatedInformation, ); } @@ -692,7 +694,7 @@ CodeActionKind toCodeActionKind(String id, lsp.CodeActionKind fallback) { } lsp.CompletionItem toCompletionItem( - lsp.TextDocumentClientCapabilitiesCompletion completionCapabilities, + lsp.CompletionClientCapabilities completionCapabilities, HashSet supportedCompletionItemKinds, server.LineInfo lineInfo, server.CompletionSuggestion suggestion, @@ -749,6 +751,7 @@ lsp.CompletionItem toCompletionItem( return lsp.CompletionItem( label, completionKind, + null, // TODO(dantup): CompletionItemTags getCompletionDetail(suggestion, completionKind, useDeprecated), asStringOrMarkupContent(formats, cleanDartdoc(suggestion.docComplete)), useDeprecated && suggestion.isDeprecated ? true : null, @@ -801,6 +804,7 @@ lsp.Diagnostic toDiagnostic( errorCode.name.toLowerCase(), languageSourceName, message, + null, // TODO(dantup): DiagnosticTags relatedInformation, ); } @@ -1060,7 +1064,7 @@ lsp.TextEdit toTextEdit(server.LineInfo lineInfo, server.SourceEdit edit) { } lsp.WorkspaceEdit toWorkspaceEdit( - lsp.WorkspaceClientCapabilities capabilities, + lsp.ClientCapabilitiesWorkspace capabilities, List edits, ) { final clientSupportsTextDocumentEdits = diff --git a/pkg/analysis_server/lib/src/lsp/notification_manager.dart b/pkg/analysis_server/lib/src/lsp/notification_manager.dart index 242cba57191..68ec754d60f 100644 --- a/pkg/analysis_server/lib/src/lsp/notification_manager.dart +++ b/pkg/analysis_server/lib/src/lsp/notification_manager.dart @@ -32,8 +32,8 @@ class LspNotificationManager extends AbstractNotificationManager { .map((error) => pluginToDiagnostic(server.getLineInfo, error)) .toList(); - final params = - PublishDiagnosticsParams(Uri.file(filePath).toString(), diagnostics); + final params = PublishDiagnosticsParams( + Uri.file(filePath).toString(), null, diagnostics); final message = NotificationMessage( Method.textDocument_publishDiagnostics, params, diff --git a/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart b/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart index fd345d11357..02a78ae3924 100644 --- a/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart +++ b/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart @@ -128,45 +128,65 @@ class ServerCapabilitiesComputer { false, null, )), - dynamicRegistrations.hover ? null : true, // hoverProvider dynamicRegistrations.completion ? null : CompletionOptions( - true, // resolveProvider dartCompletionTriggerCharacters, - ), + null, // allCommitCharacters + true, // resolveProvider + null, // workDoneProgress + ), // completionProvider + dynamicRegistrations.hover + ? null + : Either2.t1(true), // hoverProvider dynamicRegistrations.signatureHelp ? null : SignatureHelpOptions( dartSignatureHelpTriggerCharacters, + null, // retriggerCharacters + null, // workDoneProgress ), - dynamicRegistrations.definition ? null : true, // definitionProvider + null, // declarationProvider + dynamicRegistrations.definition + ? null + : Either2.t1(true), // definitionProvider null, dynamicRegistrations.implementation ? null - : true, // implementationProvider - dynamicRegistrations.references ? null : true, // referencesProvider + : Either3.t1( + true, + ), // implementationProvider + dynamicRegistrations.references + ? null + : Either2.t1(true), // referencesProvider dynamicRegistrations.documentHighlights ? null - : true, // documentHighlightProvider + : Either2.t1( + true), // documentHighlightProvider dynamicRegistrations.documentSymbol ? null - : true, // documentSymbolProvider - true, // workspaceSymbolProvider + : Either2.t1( + true), // documentSymbolProvider // "The `CodeActionOptions` return type is only valid if the client // signals code action literal support via the property // `textDocument.codeAction.codeActionLiteralSupport`." dynamicRegistrations.codeActions ? null : codeActionLiteralSupport != null - ? Either2.t2( - CodeActionOptions(DartCodeActionKind.serverSupportedKinds)) + ? Either2.t2(CodeActionOptions( + DartCodeActionKind.serverSupportedKinds, + null, // workDoneProgress + )) : Either2.t1(true), - null, + null, // codeLensProvider + null, // documentLinkProvider + null, // colorProvider dynamicRegistrations.formatting ? null - : enableFormatter, // documentFormattingProvider - false, // documentRangeFormattingProvider + : Either2.t1( + enableFormatter), // documentFormattingProvider + null, // documentRangeFormattingProvider dynamicRegistrations.typeFormatting ? null : enableFormatter @@ -177,15 +197,24 @@ class ServerCapabilitiesComputer { dynamicRegistrations.rename ? null : renameOptionsSupport - ? Either2.t2(RenameOptions(true)) + ? Either2.t2(RenameOptions(true, null)) : Either2.t1(true), - null, - null, - dynamicRegistrations.folding ? null : true, // foldingRangeProvider - null, // declarationProvider - ExecuteCommandOptions(Commands.serverSupportedCommands), - ServerCapabilitiesWorkspace( - ServerCapabilitiesWorkspaceFolders(true, true)), + dynamicRegistrations.folding + ? null + : Either3.t1( + true, + ), + ExecuteCommandOptions( + Commands.serverSupportedCommands, + null, // workDoneProgress + ), + null, // selectionRangeProvider + true, // workspaceSymbolProvider + ServerCapabilitiesWorkspace(WorkspaceFoldersServerCapabilities( + true, + Either2.t2(true), + )), null); } @@ -257,10 +286,11 @@ class ServerCapabilitiesComputer { dynamicRegistrations.completion, Method.textDocument_completion, CompletionRegistrationOptions( + allTypes, dartCompletionTriggerCharacters, null, true, - allTypes, + null, ), ); register( @@ -272,7 +302,11 @@ class ServerCapabilitiesComputer { dynamicRegistrations.signatureHelp, Method.textDocument_signatureHelp, SignatureHelpRegistrationOptions( - dartSignatureHelpTriggerCharacters, allTypes), + allTypes, + dartSignatureHelpTriggerCharacters, + null, + null, + ), ); register( dynamicRegistrations.references, @@ -298,9 +332,9 @@ class ServerCapabilitiesComputer { enableFormatter && dynamicRegistrations.typeFormatting, Method.textDocument_onTypeFormatting, DocumentOnTypeFormattingRegistrationOptions( + [dartFiles], // This one is currently Dart-specific dartTypeFormattingCharacters.first, dartTypeFormattingCharacters.skip(1).toList(), - [dartFiles], // This one is currently Dart-specific ), ); register( @@ -317,12 +351,15 @@ class ServerCapabilitiesComputer { dynamicRegistrations.codeActions, Method.textDocument_codeAction, CodeActionRegistrationOptions( - allTypes, DartCodeActionKind.serverSupportedKinds), + allTypes, + DartCodeActionKind.serverSupportedKinds, + null, + ), ); register( dynamicRegistrations.rename, Method.textDocument_rename, - RenameRegistrationOptions(true, allTypes), + RenameRegistrationOptions(allTypes, true, null), ); register( dynamicRegistrations.folding, diff --git a/pkg/analysis_server/lib/src/lsp/source_edits.dart b/pkg/analysis_server/lib/src/lsp/source_edits.dart index e3bfb8a7ff0..9b0699d2e88 100644 --- a/pkg/analysis_server/lib/src/lsp/source_edits.dart +++ b/pkg/analysis_server/lib/src/lsp/source_edits.dart @@ -17,34 +17,50 @@ final DartFormatter formatter = DartFormatter(); /// changes into account, this will also apply the edits to [oldContent]. ErrorOr>> applyAndConvertEditsToServer( String oldContent, - List changes, { + List< + Either2> + changes, { failureIsCritical = false, }) { var newContent = oldContent; final serverEdits = []; for (var change in changes) { - if (change.range == null && change.rangeLength == null) { - serverEdits - ..clear() - ..add(server.SourceEdit(0, newContent.length, change.text)); - newContent = change.text; - } else { - final lines = LineInfo.fromContent(newContent); - final offsetStart = toOffset(lines, change.range.start, - failureIsCritial: failureIsCritical); - final offsetEnd = toOffset(lines, change.range.end, - failureIsCritial: failureIsCritical); - if (offsetStart.isError) { - return ErrorOr.error(offsetStart.error); - } - if (offsetEnd.isError) { - return ErrorOr.error(offsetEnd.error); - } - newContent = newContent.replaceRange( - offsetStart.result, offsetEnd.result, change.text); - serverEdits.add(server.SourceEdit(offsetStart.result, - offsetEnd.result - offsetStart.result, change.text)); + // Change is a union that may/may not include a range. If no range + // is provided (t2 of the union) the whole document should be replaced. + final result = change.map( + // TextDocumentContentChangeEvent1 + // {range, text} + (change) { + final lines = LineInfo.fromContent(newContent); + final offsetStart = toOffset(lines, change.range.start, + failureIsCritial: failureIsCritical); + final offsetEnd = toOffset(lines, change.range.end, + failureIsCritial: failureIsCritical); + if (offsetStart.isError) { + return ErrorOr.error(offsetStart.error); + } + if (offsetEnd.isError) { + return ErrorOr.error(offsetEnd.error); + } + newContent = newContent.replaceRange( + offsetStart.result, offsetEnd.result, change.text); + serverEdits.add(server.SourceEdit(offsetStart.result, + offsetEnd.result - offsetStart.result, change.text)); + }, + // TextDocumentContentChangeEvent2 + // {text} + (change) { + serverEdits + ..clear() + ..add(server.SourceEdit(0, newContent.length, change.text)); + newContent = change.text; + }, + ); + // If any change fails, immediately return the error. + if (result?.isError ?? false) { + return ErrorOr.error(result.error); } } return ErrorOr.success(Pair(newContent, serverEdits)); diff --git a/pkg/analysis_server/test/lsp/cancel_request_test.dart b/pkg/analysis_server/test/lsp/cancel_request_test.dart index 6e065b9e53b..3950db970ec 100644 --- a/pkg/analysis_server/test/lsp/cancel_request_test.dart +++ b/pkg/analysis_server/test/lsp/cancel_request_test.dart @@ -36,6 +36,8 @@ main() { null, TextDocumentIdentifier(mainFileUri.toString()), positionFromMarker(content), + null, + null, ), ); // And a request to cancel it. diff --git a/pkg/analysis_server/test/lsp/completion_test.dart b/pkg/analysis_server/test/lsp/completion_test.dart index 52cad682bf3..20ab533cce8 100644 --- a/pkg/analysis_server/test/lsp/completion_test.dart +++ b/pkg/analysis_server/test/lsp/completion_test.dart @@ -292,6 +292,7 @@ class CompletionTest extends AbstractLspAnalysisServerTest { await openFile(mainFileUri, withoutMarkers(content)); final res = await getCompletion(mainFileUri, positionFromMarker(content)); final item = res.singleWhere((c) => c.label == 'abcdefghij'); + // ignore: deprecated_member_use_from_same_package expect(item.deprecated, isNull); // If the does not say it supports the deprecated flag, we should show // '(deprecated)' in the details. @@ -317,6 +318,7 @@ class CompletionTest extends AbstractLspAnalysisServerTest { await openFile(mainFileUri, withoutMarkers(content)); final res = await getCompletion(mainFileUri, positionFromMarker(content)); final item = res.singleWhere((c) => c.label == 'abcdefghij'); + // ignore: deprecated_member_use_from_same_package expect(item.deprecated, isTrue); // If the client says it supports the deprecated flag, we should not show // deprecated in the details. diff --git a/pkg/analysis_server/test/lsp/document_changes_test.dart b/pkg/analysis_server/test/lsp/document_changes_test.dart index b2f6368f3ed..dc00270171a 100644 --- a/pkg/analysis_server/test/lsp/document_changes_test.dart +++ b/pkg/analysis_server/test/lsp/document_changes_test.dart @@ -1,4 +1,5 @@ import 'package:analysis_server/lsp_protocol/protocol_generated.dart'; +import 'package:analysis_server/lsp_protocol/protocol_special.dart'; import 'package:analysis_server/src/protocol/protocol_internal.dart'; import 'package:analyzer_plugin/protocol/protocol_common.dart' hide Position; import 'package:test/test.dart'; @@ -29,16 +30,18 @@ class Bar { Future test_documentChange_notifiesPlugins() async { await _initializeAndOpen(); await changeFile(2, mainFileUri, [ - TextDocumentContentChangeEvent( + Either2.t1(TextDocumentContentChangeEvent1( Range(Position(0, 6), Position(0, 9)), 0, 'Bar', - ), - TextDocumentContentChangeEvent( + )), + Either2.t1(TextDocumentContentChangeEvent1( Range(Position(1, 21), Position(1, 24)), 0, 'updated', - ), + )), ]); final notifiedChanges = pluginManager.analysisUpdateContentParams @@ -53,16 +56,18 @@ class Bar { Future test_documentChange_updatesOverlay() async { await _initializeAndOpen(); await changeFile(2, mainFileUri, [ - TextDocumentContentChangeEvent( + Either2.t1(TextDocumentContentChangeEvent1( Range(Position(0, 6), Position(0, 9)), 0, 'Bar', - ), - TextDocumentContentChangeEvent( + )), + Either2.t1(TextDocumentContentChangeEvent1( Range(Position(1, 21), Position(1, 24)), 0, 'updated', - ), + )), ]); expect(server.resourceProvider.hasOverlay(mainFilePath), isTrue); diff --git a/pkg/analysis_server/test/lsp/file_modification_test.dart b/pkg/analysis_server/test/lsp/file_modification_test.dart index 6063bfdd647..5c51dd49b91 100644 --- a/pkg/analysis_server/test/lsp/file_modification_test.dart +++ b/pkg/analysis_server/test/lsp/file_modification_test.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:analysis_server/lsp_protocol/protocol_generated.dart'; +import 'package:analysis_server/lsp_protocol/protocol_special.dart'; import 'package:test/test.dart'; import 'package:test_reflective_loader/test_reflective_loader.dart'; @@ -26,11 +27,12 @@ class FileModificationTest extends AbstractLspAnalysisServerTest { // to alert the user to something failing. final error = await expectErrorNotification(() async { await changeFile(222, mainFileUri, [ - TextDocumentContentChangeEvent( + Either2.t1(TextDocumentContentChangeEvent1( Range(Position(999, 999), Position(999, 999)), null, ' ', - ) + )) ]); }); @@ -58,11 +60,12 @@ class FileModificationTest extends AbstractLspAnalysisServerTest { await openFile(mainFileUri, initialContent); await changeFile(222, mainFileUri, [ // Replace line1:5-1:8 with spaces. - TextDocumentContentChangeEvent( + Either2.t1(TextDocumentContentChangeEvent1( Range(Position(1, 5), Position(1, 8)), null, ' ', - ) + )) ]); expect(_getOverlay(mainFilePath), equals(expectedUpdatedContent)); @@ -74,11 +77,12 @@ class FileModificationTest extends AbstractLspAnalysisServerTest { // It's not valid for a client to send a request to modify a file that it // has not opened, but Visual Studio has done it in the past so we should // ensure it generates an obvious error that the user can understand. - final simpleEdit = TextDocumentContentChangeEvent( + final simpleEdit = Either2.t1(TextDocumentContentChangeEvent1( Range(Position(1, 1), Position(1, 1)), null, 'test', - ); + )); await initialize(); final notificationParams = await expectErrorNotification( () => changeFile(222, mainFileUri, [simpleEdit]), diff --git a/pkg/analysis_server/test/lsp/initialization_test.dart b/pkg/analysis_server/test/lsp/initialization_test.dart index 304ce323c9d..251a89ec79b 100644 --- a/pkg/analysis_server/test/lsp/initialization_test.dart +++ b/pkg/analysis_server/test/lsp/initialization_test.dart @@ -45,6 +45,8 @@ class InitializationTest extends AbstractLspAnalysisServerTest { // static registrations for them. // https://github.com/dart-lang/sdk/issues/38490 InitializeResult initResult = initResponse.result; + expect(initResult.serverInfo.name, 'Dart SDK LSP Analysis Server'); + expect(initResult.serverInfo.version, isNotNull); expect(initResult.capabilities, isNotNull); expect(initResult.capabilities.textDocumentSync, isNull); diff --git a/pkg/analysis_server/test/lsp/rename_test.dart b/pkg/analysis_server/test/lsp/rename_test.dart index 5c1127b0839..eeef3000cfb 100644 --- a/pkg/analysis_server/test/lsp/rename_test.dart +++ b/pkg/analysis_server/test/lsp/rename_test.dart @@ -296,9 +296,10 @@ class RenameTest extends AbstractLspAnalysisServerTest { final request = makeRequest( Method.textDocument_rename, RenameParams( + 'Object2', TextDocumentIdentifier(mainFileUri.toString()), positionFromMarker(content), - 'Object2', + null, ), ); final response = await channel.sendRequestToServer(request); diff --git a/pkg/analysis_server/test/lsp/server_abstract.dart b/pkg/analysis_server/test/lsp/server_abstract.dart index a00a44e7c71..2116fcdd0d6 100644 --- a/pkg/analysis_server/test/lsp/server_abstract.dart +++ b/pkg/analysis_server/test/lsp/server_abstract.dart @@ -166,9 +166,10 @@ mixin ClientCapabilitiesHelperMixin { null, null, null, + null, null); - final emptyWorkspaceClientCapabilities = WorkspaceClientCapabilities( + final emptyWorkspaceClientCapabilities = ClientCapabilitiesWorkspace( null, null, null, null, null, null, null, null); TextDocumentClientCapabilities extendTextDocumentCapabilities( @@ -189,8 +190,8 @@ mixin ClientCapabilitiesHelperMixin { return TextDocumentClientCapabilities.fromJson(json); } - WorkspaceClientCapabilities extendWorkspaceCapabilities( - WorkspaceClientCapabilities source, + ClientCapabilitiesWorkspace extendWorkspaceCapabilities( + ClientCapabilitiesWorkspace source, Map workspaceCapabilities, ) { // TODO(dantup): As above - it seems like this round trip should be @@ -201,7 +202,7 @@ mixin ClientCapabilitiesHelperMixin { json[key] = workspaceCapabilities[key]; }); } - return WorkspaceClientCapabilities.fromJson(json); + return ClientCapabilitiesWorkspace.fromJson(json); } TextDocumentClientCapabilities withAllSupportedDynamicRegistrations( @@ -228,8 +229,8 @@ mixin ClientCapabilitiesHelperMixin { }); } - WorkspaceClientCapabilities withApplyEditSupport( - WorkspaceClientCapabilities source, + ClientCapabilitiesWorkspace withApplyEditSupport( + ClientCapabilitiesWorkspace source, ) { return extendWorkspaceCapabilities(source, {'applyEdit': true}); } @@ -280,22 +281,22 @@ mixin ClientCapabilitiesHelperMixin { }); } - WorkspaceClientCapabilities withConfigurationSupport( - WorkspaceClientCapabilities source, + ClientCapabilitiesWorkspace withConfigurationSupport( + ClientCapabilitiesWorkspace source, ) { return extendWorkspaceCapabilities(source, {'configuration': true}); } - WorkspaceClientCapabilities withDidChangeConfigurationDynamicRegistration( - WorkspaceClientCapabilities source, + ClientCapabilitiesWorkspace withDidChangeConfigurationDynamicRegistration( + ClientCapabilitiesWorkspace source, ) { return extendWorkspaceCapabilities(source, { 'didChangeConfiguration': {'dynamicRegistration': true} }); } - WorkspaceClientCapabilities withDocumentChangesSupport( - WorkspaceClientCapabilities source, + ClientCapabilitiesWorkspace withDocumentChangesSupport( + ClientCapabilitiesWorkspace source, ) { return extendWorkspaceCapabilities(source, { 'workspaceEdit': {'documentChanges': true} @@ -514,7 +515,10 @@ mixin LspAnalysisServerTestMixin implements ClientCapabilitiesHelperMixin { Future changeFile( int newVersion, Uri uri, - List changes, + List< + Either2> + changes, ) async { var notification = makeNotification( Method.textDocument_didChange, @@ -553,6 +557,7 @@ mixin LspAnalysisServerTestMixin implements ClientCapabilitiesHelperMixin { ExecuteCommandParams( command.command, command.arguments, + null, ), ); return expectSuccessfulResponseTo(request); @@ -647,7 +652,9 @@ mixin LspAnalysisServerTestMixin implements ClientCapabilitiesHelperMixin { Method.textDocument_formatting, DocumentFormattingParams( TextDocumentIdentifier(fileUri), - FormattingOptions(2, true), // These currently don't do anything + FormattingOptions( + 2, true, false, false, false), // These currently don't do anything + null, ), ); return expectSuccessfulResponseTo(request); @@ -658,10 +665,11 @@ mixin LspAnalysisServerTestMixin implements ClientCapabilitiesHelperMixin { final request = makeRequest( Method.textDocument_onTypeFormatting, DocumentOnTypeFormattingParams( + character, + FormattingOptions( + 2, true, false, false, false), // These currently don't do anything TextDocumentIdentifier(fileUri), pos, - character, - FormattingOptions(2, true), // These currently don't do anything ), ); return expectSuccessfulResponseTo(request); @@ -675,12 +683,15 @@ mixin LspAnalysisServerTestMixin implements ClientCapabilitiesHelperMixin { final request = makeRequest( Method.textDocument_codeAction, CodeActionParams( - TextDocumentIdentifier(fileUri), - range ?? beginningOfDocument, - // TODO(dantup): We may need to revise the tests/implementation when - // it's clear how we're supposed to handle diagnostics: - // https://github.com/Microsoft/language-server-protocol/issues/583 - CodeActionContext([], kinds)), + TextDocumentIdentifier(fileUri), + range ?? beginningOfDocument, + // TODO(dantup): We may need to revise the tests/implementation when + // it's clear how we're supposed to handle diagnostics: + // https://github.com/Microsoft/language-server-protocol/issues/583 + CodeActionContext([], kinds), + null, + null, + ), ); return expectSuccessfulResponseTo(request); } @@ -693,6 +704,8 @@ mixin LspAnalysisServerTestMixin implements ClientCapabilitiesHelperMixin { context, TextDocumentIdentifier(uri.toString()), pos, + null, + null, ), ); return expectSuccessfulResponseTo>(request); @@ -734,6 +747,8 @@ mixin LspAnalysisServerTestMixin implements ClientCapabilitiesHelperMixin { Method.textDocument_documentSymbol, DocumentSymbolParams( TextDocumentIdentifier(fileUri), + null, + null, ), ); return expectSuccessfulResponseTo(request); @@ -742,7 +757,11 @@ mixin LspAnalysisServerTestMixin implements ClientCapabilitiesHelperMixin { Future> getFoldingRegions(Uri uri) { final request = makeRequest( Method.textDocument_foldingRange, - FoldingRangeParams(TextDocumentIdentifier(uri.toString())), + FoldingRangeParams( + TextDocumentIdentifier(uri.toString()), + null, + null, + ), ); return expectSuccessfulResponseTo>(request); } @@ -781,6 +800,8 @@ mixin LspAnalysisServerTestMixin implements ClientCapabilitiesHelperMixin { ReferenceContext(includeDeclarations), TextDocumentIdentifier(uri.toString()), pos, + null, + null, ), ); return expectSuccessfulResponseTo>(request); @@ -814,7 +835,11 @@ mixin LspAnalysisServerTestMixin implements ClientCapabilitiesHelperMixin { Future> getWorkspaceSymbols(String query) { final request = makeRequest( Method.workspace_symbol, - WorkspaceSymbolParams(query), + WorkspaceSymbolParams( + query, + null, + null, + ), ); return expectSuccessfulResponseTo(request); } @@ -872,7 +897,8 @@ mixin LspAnalysisServerTestMixin implements ClientCapabilitiesHelperMixin { Uri rootUri, List workspaceFolders, TextDocumentClientCapabilities textDocumentCapabilities, - WorkspaceClientCapabilities workspaceCapabilities, + ClientCapabilitiesWorkspace workspaceCapabilities, + ClientCapabilitiesWindow windowCapabilities, Map initializationOptions, bool throwOnFailure = true, }) async { @@ -884,17 +910,21 @@ mixin LspAnalysisServerTestMixin implements ClientCapabilitiesHelperMixin { final request = makeRequest( Method.initialize, InitializeParams( + null, + null, + rootPath, + rootUri?.toString(), + initializationOptions, + ClientCapabilities( + workspaceCapabilities, + textDocumentCapabilities, + windowCapabilities, null, - rootPath, - rootUri?.toString(), - initializationOptions, - ClientCapabilities( - workspaceCapabilities, - textDocumentCapabilities, - null, - ), - null, - workspaceFolders?.map(toWorkspaceFolder)?.toList())); + ), + null, + workspaceFolders?.map(toWorkspaceFolder)?.toList(), + null, + )); final response = await sendRequestToServer(request); expect(response.id, equals(request.id)); @@ -922,7 +952,7 @@ mixin LspAnalysisServerTestMixin implements ClientCapabilitiesHelperMixin { : TextDocumentIdentifier(uri.toString()); final request = makeRequest( Method.textDocument_rename, - RenameParams(docIdentifier, pos, newName), + RenameParams(newName, docIdentifier, pos, null), ); return request; } @@ -1090,7 +1120,11 @@ mixin LspAnalysisServerTestMixin implements ClientCapabilitiesHelperMixin { return changeFile( newVersion, uri, - [TextDocumentContentChangeEvent(null, null, content)], + [ + Either2.t2( + TextDocumentContentChangeEvent2(content)) + ], ); } diff --git a/pkg/analysis_server/test/lsp/server_test.dart b/pkg/analysis_server/test/lsp/server_test.dart index adca252ff0a..1c0421e070d 100644 --- a/pkg/analysis_server/test/lsp/server_test.dart +++ b/pkg/analysis_server/test/lsp/server_test.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:analysis_server/lsp_protocol/protocol_generated.dart'; +import 'package:analysis_server/lsp_protocol/protocol_special.dart'; import 'package:test/test.dart'; import 'package:test_reflective_loader/test_reflective_loader.dart'; @@ -23,8 +24,10 @@ class ServerTest extends AbstractLspAnalysisServerTest { // client and server are out of sync and we expect the server to shut down. final error = await expectErrorNotification(() async { await changeFile(222, mainFileUri, [ - TextDocumentContentChangeEvent( - Range(Position(99, 99), Position(99, 99)), null, ' '), + Either2.t1( + TextDocumentContentChangeEvent1( + Range(Position(99, 99), Position(99, 99)), null, ' ')), ]); }); diff --git a/pkg/analysis_server/test/tool/lsp_spec/generated_classes_test.dart b/pkg/analysis_server/test/tool/lsp_spec/generated_classes_test.dart index 2ef1bdc6223..4a86e854a21 100644 --- a/pkg/analysis_server/test/tool/lsp_spec/generated_classes_test.dart +++ b/pkg/analysis_server/test/tool/lsp_spec/generated_classes_test.dart @@ -17,10 +17,12 @@ void main() { }); test('with list fields can be checked for equality', () { - final a = TextDocumentClientCapabilitiesCodeActionKind( - [CodeActionKind.QuickFix]); - final b = TextDocumentClientCapabilitiesCodeActionKind( - [CodeActionKind.QuickFix]); + final a = CodeActionClientCapabilitiesCodeActionKind( + [CodeActionKind.QuickFix], + ); + final b = CodeActionClientCapabilitiesCodeActionKind( + [CodeActionKind.QuickFix], + ); expect(a, equals(b)); expect(a.hashCode, equals(b.hashCode)); diff --git a/pkg/analysis_server/test/tool/lsp_spec/json_test.dart b/pkg/analysis_server/test/tool/lsp_spec/json_test.dart index 878f36d5785..369cb77f4ef 100644 --- a/pkg/analysis_server/test/tool/lsp_spec/json_test.dart +++ b/pkg/analysis_server/test/tool/lsp_spec/json_test.dart @@ -47,6 +47,7 @@ void main() { 'test_err', '/tmp/source.dart', 'err!!', + null, [DiagnosticRelatedInformation(location, 'message')], ); final output = json.encode(codeAction.toJson()); @@ -244,7 +245,7 @@ void main() { test('ResponseMessage does not include a result for an error', () { final id = Either2.t1(1); - final error = ResponseError(ErrorCodes.ParseError, 'Error', null); + final error = ResponseError(ErrorCodes.ParseError, 'Error', null); final resp = ResponseMessage(id, null, error, jsonRpcVersion); final jsonMap = resp.toJson(); expect(jsonMap, contains('error')); @@ -254,7 +255,7 @@ void main() { test('ResponseMessage throws if both result and error are non-null', () { final id = Either2.t1(1); final result = 'my result'; - final error = ResponseError(ErrorCodes.ParseError, 'Error', null); + final error = ResponseError(ErrorCodes.ParseError, 'Error', null); final resp = ResponseMessage(id, result, error, jsonRpcVersion); expect(resp.toJson, throwsA(TypeMatcher())); }); @@ -315,11 +316,20 @@ void main() { }); test('objects with lists can round-trip through to json and back', () { - final obj = InitializeParams(1, '!root', null, null, - ClientCapabilities(null, null, null), '!trace', [ - WorkspaceFolder('!uri1', '!name1'), - WorkspaceFolder('!uri2', '!name2'), - ]); + final obj = InitializeParams( + 1, + InitializeParamsClientInfo('server name', '1.2.3'), + '!root', + null, + null, + ClientCapabilities(null, null, null, null), + '!trace', + [ + WorkspaceFolder('!uri1', '!name1'), + WorkspaceFolder('!uri2', '!name2'), + ], + null, + ); final json = jsonEncode(obj); final restoredObj = InitializeParams.fromJson(jsonDecode(json)); diff --git a/pkg/analysis_server/tool/lsp_spec/generate_all.dart b/pkg/analysis_server/tool/lsp_spec/generate_all.dart index 2ddf84ad646..7c691880a62 100644 --- a/pkg/analysis_server/tool/lsp_spec/generate_all.dart +++ b/pkg/analysis_server/tool/lsp_spec/generate_all.dart @@ -69,7 +69,7 @@ final Uri specLicenseUri = Uri.parse( /// The URI of the version of the spec to generate from. This should be periodically updated as /// there's no longer a stable URI for the latest published version. final Uri specUri = Uri.parse( - 'https://raw.githubusercontent.com/microsoft/language-server-protocol/gh-pages/_specifications/specification-3-14.md'); + 'https://raw.githubusercontent.com/microsoft/language-server-protocol/gh-pages/_specifications/specification-3-15.md'); /// Pattern to extract inline types from the `result: {xx, yy }` notes in the spec. /// Doesn't parse past full stops as some of these have english sentences tagged on diff --git a/pkg/analysis_server/tool/lsp_spec/lsp_specification.md b/pkg/analysis_server/tool/lsp_spec/lsp_specification.md index 2d3a9c80a78..4c8b08d1ef6 100644 --- a/pkg/analysis_server/tool/lsp_spec/lsp_specification.md +++ b/pkg/analysis_server/tool/lsp_spec/lsp_specification.md @@ -1,5 +1,5 @@ This is an unmodified copy of the Language Server Protocol Specification, -downloaded from https://raw.githubusercontent.com/microsoft/language-server-protocol/gh-pages/_specifications/specification-3-14.md. It is the version of the specification that was +downloaded from https://raw.githubusercontent.com/microsoft/language-server-protocol/gh-pages/_specifications/specification-3-15.md. It is the version of the specification that was used to generate a portion of the Dart code used to support the protocol. To regenerate the generated code, run the script in @@ -10,8 +10,8 @@ code, run the same script with an argument of "--download". --- Copyright (c) Microsoft Corporation. - -All rights reserved. + +All rights reserved. Distributed under the following terms: @@ -22,34 +22,33 @@ Distributed under the following terms: --- title: Specification -shortTitle: 3.14 - Previous +shortTitle: 3.15 - Current layout: specifications -sectionid: specification-3-14 -toc: specification-3-14-toc -index: 1 +sectionid: specification-3-15 +toc: specification-3-15-toc +index: 2 --- -# Language Server Protocol Specification - 3.14 +# Language Server Protocol Specification - 3.15 -This document describes version 3.14.x of the language server protocol. An implementation for node of the 3.14.x version of the protocol can be found [here](https://github.com/Microsoft/vscode-languageserver-node). +This document describes the 3.15.x version of the language server protocol. An implementation for node of the 3.15.x version of the protocol can be found [here](https://github.com/Microsoft/vscode-languageserver-node). -The 2.x version of this document can be found [here](https://github.com/Microsoft/language-server-protocol/blob/master/versions/protocol-2-x.md). -The 1.x version of this document can be found [here](https://github.com/Microsoft/language-server-protocol/blob/master/versions/protocol-1-x.md). +**Note:** edits to this specification can be made via a pull request against this markdown [document](https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-15.md). -**Note:** edits to this specification can be made via a pull request against this markdown [document](https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md). +## What's new in 3.15 -## Base Protocol +All new 3.15 features are tagged with a corresponding since version 3.15 text or in JSDoc using `@since 3.15.0` annotation. Major new feature are: + +- [general progress support](#progress), [work done progress](#workDoneProgress) and [partial result progress](#partialResults) +- support for [selection ranges](#textDocument_selectionRange) + +## Base Protocol The base protocol consists of a header and a content part (comparable to HTTP). The header and content part are separated by a '\r\n'. -### Header Part +### Header Part -The header part consists of header fields. Each header field is comprised of a name and a value, -separated by ': ' (a colon and a space). -Each header field is terminated by '\r\n'. -Considering the last header field and the overall header itself are each terminated with '\r\n', -and that at least one header is mandatory, this means that two '\r\n' sequences always -immediately precede the content part of a message. +The header part consists of header fields. Each header field is comprised of a name and a value, separated by ': ' (a colon and a space). The structure of header fields conform to the [HTTP semantic](https://tools.ietf.org/html/rfc7230#section-3.2). Each header field is terminated by '\r\n'. Considering the last header field and the overall header itself are each terminated with '\r\n', and that at least one header is mandatory, this means that two '\r\n' sequences always immediately precede the content part of a message. Currently the following header fields are supported: @@ -61,9 +60,9 @@ Currently the following header fields are supported: The header part is encoded using the 'ascii' encoding. This includes the '\r\n' separating the header and content part. -### Content Part +### Content Part -Contains the actual content of the message. The content part of a message uses [JSON-RPC](http://www.jsonrpc.org/) to describe requests, responses and notifications. The content part is encoded using the charset provided in the Content-Type field. It defaults to `utf-8`, which is the only encoding supported right now. If a server or client receives a header with a different encoding than `utf-8`, then it should respond with an error. +Contains the actual content of the message. The content part of a message uses [JSON-RPC](http://www.jsonrpc.org/) to describe requests, responses and notifications. The content part is encoded using the charset provided in the Content-Type field. It defaults to `utf-8`, which is the only encoding supported right now. If a server or client receives a header with a different encoding than `utf-8` it should respond with an error. (Prior versions of the protocol used the string constant `utf8` which is not a correct encoding constant according to [specification](http://www.iana.org/assignments/character-sets/character-sets.xhtml).) For backwards compatibility it is highly recommended that a client and a server treats the string `utf8` as `utf-8`. @@ -94,7 +93,7 @@ interface Message { jsonrpc: string; } ``` -#### Request Message +#### Request Message A request message to describe a request between the client and the server. Every processed request must send a response back to the sender of the request. @@ -114,11 +113,11 @@ interface RequestMessage extends Message { /** * The method's params. */ - params?: Array | object; + params?: array | object; } ``` -#### Response Message +#### Response Message A Response Message sent as a result of a request. If a request doesn't provide a result value the receiver of a request still needs to return a response message to conform to the JSON RPC specification. The result property of the ResponseMessage should be set to `null` in this case to signal a successful request. @@ -138,10 +137,10 @@ interface ResponseMessage extends Message { /** * The error object in case a request fails. */ - error?: ResponseError; + error?: ResponseError; } -interface ResponseError { +interface ResponseError { /** * A number indicating the error type that occurred. */ @@ -153,10 +152,10 @@ interface ResponseError { message: string; /** - * A Primitive or Structured value that contains additional + * A primitive or structured value that contains additional * information about the error. Can be omitted. */ - data?: D; + data?: string | number | boolean | array | object | null; } export namespace ErrorCodes { @@ -176,7 +175,7 @@ export namespace ErrorCodes { export const ContentModified: number = -32801; } ``` -#### Notification Message +#### Notification Message A notification message. A processed notification message must not send a response back. They work like events. @@ -190,11 +189,11 @@ interface NotificationMessage extends Message { /** * The notification's params. */ - params?: Array | object; + params?: array | object; } ``` -#### $ Notifications and Requests +#### $ Notifications and Requests Notification and requests whose methods start with '$/' are messages which are protocol implementation dependent and might not be implementable in all clients or servers. For example if the server implementation uses a single threaded synchronous programming language then there is little a server can do to react to a '$/cancelRequest' notification. If a server or client receives notifications starting with '$/' it is free to ignore the notification. If a server or client receives a requests starting with '$/' it must error the request with error code `MethodNotFound` (e.g. `-32601`). @@ -217,6 +216,35 @@ interface CancelParams { A request that got canceled still needs to return from the server and send a response back. It can not be left open / hanging. This is in line with the JSON RPC protocol that requires that every request sends a response back. In addition it allows for returning partial results on cancel. If the request returns an error response on cancellation it is advised to set the error code to `ErrorCodes.RequestCancelled`. +#### Progress Support (:arrow_right: :arrow_left:) + +> *Since version 3.15.0* + +The base protocol offers also support to report progress in a generic fashion. This mechanism can be used to report any kind of progress including work done progress (usually used to report progress in the user interface using a progress bar) and partial result progress to support streaming of results. + +A progress notification has the following properties: + +_Notification_: +* method: '$/progress' +* params: `ProgressParams` defined as follows: + +```typescript +type ProgressToken = number | string; +interface ProgressParams { + /** + * The progress token provided by the client or server. + */ + token: ProgressToken; + + /** + * The progress data. + */ + value: T; +} +``` + +Progress is reported against a token. The token is different than the request ID which allows to report progress out of band and also for notification. + ## Language Server Protocol The language server protocol defines a set of JSON-RPC request, response and notification messages which are exchanged using the above base protocol. This section starts describing the basic JSON structures used in the protocol. The document uses TypeScript interfaces to describe these. Based on the basic JSON structures, the actual requests with their responses and the notifications are described. @@ -227,7 +255,7 @@ The protocol currently assumes that one server serves one tool. There is current ### Basic JSON Structures -#### URI +#### URI URI's are transferred as strings. The URI's format is defined in [http://tools.ietf.org/html/rfc3986](http://tools.ietf.org/html/rfc3986) @@ -249,17 +277,17 @@ Many of the interfaces contain fields that correspond to the URI of a document. type DocumentUri = string; ``` -#### Text Documents +#### Text Documents The current protocol is tailored for textual documents whose content can be represented as a string. There is currently no support for binary documents. A position inside a document (see Position definition below) is expressed as a zero-based line and character offset. The offsets are based on a UTF-16 string representation. So a string of the form `a𐐀b` the character offset of the character `a` is 0, the character offset of `𐐀` is 1 and the character offset of b is 3 since `𐐀` is represented using two code units in UTF-16. To ensure that both client and server split the string into the same line representation the protocol specifies the following end-of-line sequences: '\n', '\r\n' and '\r'. -Positions are line end character agnostic. So you can not specify a position that denotes `\r|\n` or `\n|` where `|` represents the character offset. +Positions are line end character agnostic. So you can not specify a position that denotes `\r|\n` or `\n|` where `|` represents the character offset. ```typescript export const EOL: string[] = ['\n', '\r\n', '\r']; ``` -#### Position +#### Position Position in a text document expressed as zero-based line and zero-based character offset. A position is between two characters like an 'insert' cursor in a editor. Special values like for example `-1` to denote the end of a line are not supported. @@ -281,13 +309,13 @@ interface Position { character: number; } ``` -#### Range +#### Range A range in a text document expressed as (zero-based) start and end positions. A range is comparable to a selection in an editor. Therefore the end position is exclusive. If you want to specify a range that contains a line including the line ending character(s) then use an end position denoting the start of the next line. For example: ```typescript { start: { line: 5, character: 23 }, - end : { line 6, character : 0 } + end : { line: 6, character: 0 } } ``` @@ -305,7 +333,7 @@ interface Range { } ``` -#### Location +#### Location Represents a location inside a resource, such as a line inside a text file. ```typescript @@ -315,7 +343,7 @@ interface Location { } ``` -#### LocationLink +#### LocationLink Represents a link between a source and a target location. @@ -350,12 +378,12 @@ interface LocationLink { } ``` -#### Diagnostic +#### Diagnostic Represents a diagnostic, such as a compiler error or warning. Diagnostic objects are only valid in the scope of a resource. ```typescript -interface Diagnostic { +export interface Diagnostic { /** * The range at which the message applies. */ @@ -365,7 +393,7 @@ interface Diagnostic { * The diagnostic's severity. Can be omitted. If omitted it is up to the * client to interpret diagnostics as error, warning, info or hint. */ - severity?: number; + severity?: DiagnosticSeverity; /** * The diagnostic's code, which might appear in the user interface. @@ -383,6 +411,13 @@ interface Diagnostic { */ message: string; + /** + * Additional metadata about the diagnostic. + * + * @since 3.15.0 + */ + tags?: DiagnosticTag[]; + /** * An array of related diagnostic information, e.g. when symbol-names within * a scope collide all definitions can be marked via this property. @@ -391,33 +426,60 @@ interface Diagnostic { } ``` -The protocol currently supports the following diagnostic severities: +The protocol currently supports the following diagnostic severities and tags: ```typescript -namespace DiagnosticSeverity { +export namespace DiagnosticSeverity { /** * Reports an error. */ - export const Error = 1; + export const Error: 1 = 1; /** * Reports a warning. */ - export const Warning = 2; + export const Warning: 2 = 2; /** * Reports an information. */ - export const Information = 3; + export const Information: 3 = 3; /** * Reports a hint. */ - export const Hint = 4; + export const Hint: 4 = 4; } + +export type DiagnosticSeverity = 1 | 2 | 3 | 4; + +/** + * The diagnostic tags. + * + * @since 3.15.0 + */ +export namespace DiagnosticTag { + /** + * Unused or unnecessary code. + * + * Clients are allowed to render diagnostics with this tag faded out instead of having + * an error squiggle. + */ + export const Unnecessary: 1 = 1; + /** + * Deprecated or obsolete code. + * + * Clients are allowed to rendered diagnostics with this tag strike through. + */ + export const Deprecated: 2 = 2; +} + +export type DiagnosticTag = 1 | 2; ``` +`DiagnosticRelatedInformation` is defined as follows: + ```typescript /** * Represents a related message and source code location for a diagnostic. This should be - * used to point to code locations that cause or related to a diagnostics, e.g when duplicating + * used to point to code locations that cause or are related to a diagnostics, e.g when duplicating * a symbol in a scope. */ export interface DiagnosticRelatedInformation { @@ -433,7 +495,7 @@ export interface DiagnosticRelatedInformation { } ``` -#### Command +#### Command Represents a reference to a command. Provides a title which will be used to represent a command in the UI. Commands are identified by a string identifier. The recommended way to handle commands is to implement their execution on the server side if the client and server provides the corresponding capabilities. Alternatively the tool extension code could handle the command. The protocol currently doesn't specify a set of well-known commands. @@ -455,7 +517,7 @@ interface Command { } ``` -#### TextEdit +#### TextEdit A textual edit applicable to a text document. @@ -475,15 +537,15 @@ interface TextEdit { } ``` -#### TextEdit[] +#### TextEdit[] Complex text manipulations are described with an array of `TextEdit`'s, representing a single change to the document. -All text edits ranges refer to positions in the original document. Text edits ranges must never overlap, that means no part of the original document must be manipulated by more than one edit. However, it is possible that multiple edits have the same start position: multiple inserts, or any number of inserts followed by a single remove or replace edit. If multiple inserts have the same position, the order in the array defines the order in which the inserted strings appear in the resulting text. +All text edits ranges refer to positions in the document the are computed on. They therefore move a document from state S1 to S2 without describing any intermediate state. Text edits ranges must never overlap, that means no part of the original document must be manipulated by more than one edit. However, it is possible that multiple edits have the same start position: multiple inserts, or any number of inserts followed by a single remove or replace edit. If multiple inserts have the same position, the order in the array defines the order in which the inserted strings appear in the resulting text. -#### TextDocumentEdit +#### TextDocumentEdit -Describes textual changes on a single text document. The text document is referred to as a `VersionedTextDocumentIdentifier` to allow clients to check the text document version before an edit is applied. A `TextDocumentEdit` describes all changes on a version Si and after they are applied move the document to version Si+1. So the creator of a `TextDocumentEdit` doesn't need to sort the array or do any kind of ordering. However the edits must be non overlapping. +Describes textual changes on a single text document. The text document is referred to as a `VersionedTextDocumentIdentifier` to allow clients to check the text document version before an edit is applied. A `TextDocumentEdit` describes all changes on a version Si and after they are applied move the document to version Si+1. So the creator of a `TextDocumentEdit` doesn't need to sort the array of edits or do any kind of ordering. However the edits must be non overlapping. ```typescript export interface TextDocumentEdit { @@ -499,7 +561,7 @@ export interface TextDocumentEdit { } ``` -### File Resource changes +### File Resource changes > New in version 3.13: @@ -607,7 +669,7 @@ export interface DeleteFile { } ``` -#### WorkspaceEdit +#### WorkspaceEdit A workspace edit represents changes to many resources managed in the workspace. The edit should either provide `changes` or `documentChanges`. If the client can handle versioned document edits and if `documentChanges` are present, the latter are preferred over `changes`. @@ -634,7 +696,96 @@ export interface WorkspaceEdit { } ``` -#### TextDocumentIdentifier +##### WorkspaceEditClientCapabilities + +> New in version 3.13: `ResourceOperationKind` and `FailureHandlingKind` and the client capability `workspace.workspaceEdit.resourceOperations` as well as `workspace.workspaceEdit.failureHandling`. + + +The capabilities of a workspace edit has evolved over the time. Clients can describe their support using the following client capability: + +* property path (optional): `workspace.workspaceEdit` +* property type: `WorkspaceEditClientCapabilities` defined as follows: + +```typescript +export interface WorkspaceEditClientCapabilities { + /** + * The client supports versioned document changes in `WorkspaceEdit`s + */ + documentChanges?: boolean; + + /** + * The resource operations the client supports. Clients should at least + * support 'create', 'rename' and 'delete' files and folders. + * + * @since 3.13.0 + */ + resourceOperations?: ResourceOperationKind[]; + + /** + * The failure handling strategy of a client if applying the workspace edit + * fails. + * + * @since 3.13.0 + */ + failureHandling?: FailureHandlingKind; +} + +/** + * The kind of resource operations supported by the client. + */ +export type ResourceOperationKind = 'create' | 'rename' | 'delete'; + +export namespace ResourceOperationKind { + + /** + * Supports creating new files and folders. + */ + export const Create: ResourceOperationKind = 'create'; + + /** + * Supports renaming existing files and folders. + */ + export const Rename: ResourceOperationKind = 'rename'; + + /** + * Supports deleting existing files and folders. + */ + export const Delete: ResourceOperationKind = 'delete'; +} + +export type FailureHandlingKind = 'abort' | 'transactional' | 'undo' | 'textOnlyTransactional'; + +export namespace FailureHandlingKind { + + /** + * Applying the workspace change is simply aborted if one of the changes provided + * fails. All operations executed before the failing operation stay executed. + */ + export const Abort: FailureHandlingKind = 'abort'; + + /** + * All operations are executed transactional. That means they either all + * succeed or no changes at all are applied to the workspace. + */ + export const Transactional: FailureHandlingKind = 'transactional'; + + + /** + * If the workspace edit contains only textual file changes they are executed transactional. + * If resource changes (create, rename or delete file) are part of the change the failure + * handling strategy is abort. + */ + export const TextOnlyTransactional: FailureHandlingKind = 'textOnlyTransactional'; + + /** + * The client tries to undo the operations already executed. But there is no + * guarantee that this is succeeding. + */ + export const Undo: FailureHandlingKind = 'undo'; +} +``` + +#### TextDocumentIdentifier Text documents are identified using a URI. On the protocol level, URIs are passed as strings. The corresponding JSON structure looks like this: ```typescript @@ -646,7 +797,7 @@ interface TextDocumentIdentifier { } ``` -#### TextDocumentItem +#### TextDocumentItem An item to transfer a text document from the client to the server. @@ -691,6 +842,8 @@ CSS | `css` Diff | `diff` Dart | `dart` Dockerfile | `dockerfile` +Elixir | `elixir` +Erlang | `erlang` F# | `fsharp` Git | `git-commit` and `git-rebase` Go | `go` @@ -734,7 +887,7 @@ XSL | `xsl` YAML | `yaml` {: .table .table-bordered .table-responsive} -#### VersionedTextDocumentIdentifier +#### VersionedTextDocumentIdentifier An identifier to denote a specific version of a text document. @@ -745,7 +898,7 @@ interface VersionedTextDocumentIdentifier extends TextDocumentIdentifier { * is sent from the server to the client and the file is not open in the editor * (the server has not received an open notification before) the server can send * `null` to indicate that the version is known and the content on disk is the - * truth (as speced with document content ownership). + * master (as speced with document content ownership). * * The version number of a document will increase after each change, including * undo/redo. The number doesn't need to be consecutive. @@ -754,7 +907,7 @@ interface VersionedTextDocumentIdentifier extends TextDocumentIdentifier { } ``` -#### TextDocumentPositionParams +#### TextDocumentPositionParams Was `TextDocumentPosition` in 1.0 with inlined parameters. @@ -774,7 +927,7 @@ interface TextDocumentPositionParams { } ``` -#### DocumentFilter +#### DocumentFilter A document filter denotes a document through properties like `language`, `scheme` or `pattern`. An example is a filter that applies to TypeScript files on disk. Another example is a filter the applies to JSON files with name `package.json`: ```typescript @@ -815,7 +968,41 @@ A document selector is the combination of one or more document filters. export type DocumentSelector = DocumentFilter[]; ``` -#### MarkupContent +#### StaticRegistrationOptions + +Static registration options can be used to register a feature in the initialize result with a given server control ID to be able to un-register the feature later on. + +```typescript +/** + * Static registration options to be returned in the initialize request. + */ +export interface StaticRegistrationOptions { + /** + * The id used to register the request. The id can be used to deregister + * the request again. See also Registration#id. + */ + id?: string; +} +``` + +#### TextDocumentRegistrationOptions + +Options to dynamically register for requests for a set of text documents. + +```typescript +/** + * General text document registration options. + */ +export interface 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. + */ + documentSelector: DocumentSelector | null; +} +``` + +#### MarkupContent A `MarkupContent` literal represents a string value which content can be represented in different formats. Currently `plaintext` and `markdown` are supported formats. A `MarkupContent` is usually used in documentation properties of result literals like `CompletionItem` or `SignatureInformation`. @@ -877,13 +1064,250 @@ export interface MarkupContent { } ``` +#### Work Done Progress + +> *Since version 3.15.0* + +Work done progress is reported using the generic [`$/progress`](#progress) notification. The value payload of a work done progress notification can be of three different forms. + +##### Work Done Progress Begin + +To start progress reporting a `$/progress` notification with the following payload must be sent: + +```typescript +export interface WorkDoneProgressBegin { + + kind: 'begin'; + + /** + * Mandatory title of the progress operation. Used to briefly inform about + * the kind of operation being performed. + * + * Examples: "Indexing" or "Linking dependencies". + */ + title: string; + + /** + * Controls if a cancel button should show to allow the user to cancel the + * long running operation. Clients that don't support cancellation are allowed + * to ignore the setting. + */ + cancellable?: boolean; + + /** + * Optional, more detailed associated progress message. Contains + * complementary information to the `title`. + * + * Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". + * If unset, the previous progress message (if any) is still valid. + */ + message?: string; + + /** + * Optional progress percentage to display (value 100 is considered 100%). + * If not provided infinite progress is assumed and clients are allowed + * to ignore the `percentage` value in subsequent in report notifications. + * + * The value should be steadily rising. Clients are free to ignore values + * that are not following this rule. + */ + percentage?: number; +} +``` + +##### Work Done Progress Report + +Reporting progress is done using the following payload: + +```typescript +export interface WorkDoneProgressReport { + + kind: 'report'; + + /** + * Controls enablement state of a cancel button. This property is only valid if a cancel + * button got requested in the `WorkDoneProgressStart` payload. + * + * Clients that don't support cancellation or don't support control the button's + * enablement state are allowed to ignore the setting. + */ + cancellable?: boolean; + + /** + * Optional, more detailed associated progress message. Contains + * complementary information to the `title`. + * + * Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". + * If unset, the previous progress message (if any) is still valid. + */ + message?: string; + + /** + * Optional progress percentage to display (value 100 is considered 100%). + * If not provided infinite progress is assumed and clients are allowed + * to ignore the `percentage` value in subsequent in report notifications. + * + * The value should be steadily rising. Clients are free to ignore values + * that are not following this rule. + */ + percentage?: number; +} +``` + +##### Work Done Progress End + +Signaling the end of a progress reporting is done using the following payload: + +```typescript +export interface WorkDoneProgressEnd { + + kind: 'end'; + + /** + * Optional, a final message indicating to for example indicate the outcome + * of the operation. + */ + message?: string; +} +``` + +##### Initiating Work Done Progress + +Work Done progress can be initiated in two different ways: + +1. by the sender of a request (mostly clients) using the predefined `workDoneToken` property in the requests parameter literal. +1. by a server using the request `window/workDoneProgress/create`. + +Consider a client sending a `textDocument/reference` request to a server and the client accepts work done progress reporting on that request. To signal this to the server the client would add a `workDoneToken` property to the reference request parameters. Something like this: + +```json +{ + "textDocument": { + "uri": "file:///folder/file.ts" + }, + "position": { + "line": 9, + "character": 5 + }, + "context": { + "includeDeclaration": true + }, + // The token used to report work done progress. + "workDoneToken": "1d546990-40a3-4b77-b134-46622995f6ae" +} +``` + +A server uses the `workDoneToken` to report progress for the specific `textDocument/reference`. For the above request the `$/progress` notification params look like this: + +```json +{ + "token": "1d546990-40a3-4b77-b134-46622995f6ae", + "value": { + "kind": "begin", + "title": "Finding references for A#foo", + "cancellable": false, + "message": "Processing file X.ts", + "percentage": 0 + } +} +``` + +Server initiated work done progress works the same. The only difference is that the server requests a progress user interface using the `window/workDoneProgress/create` request providing a token that is afterwards used to report progress. + +##### Signaling Work Done Progress Reporting + +To keep the protocol backwards compatible servers are only allowed to use work done progress reporting if the client signals corresponding support using the client capability `window.workDoneProgress`. + +To avoid that clients set up a progress monitor user interface before sending a request but the server doesn't actually report any progress a server needs to signal work done progress reporting in the corresponding server capability. For the above find references example a server would signal such a support by setting the `referencesProvider` property in the server capabilities as follows: + +```json +{ + "referencesProvider": { + "workDoneProgress": true + } +} +``` + +#### WorkDoneProgressParams + +A parameter literal used to pass a work done progress token. + +```typescript +export interface WorkDoneProgressParams { + /** + * An optional token that a server can use to report work done progress. + */ + workDoneToken?: ProgressToken; +} +``` + +#### WorkDoneProgressOptions + +Options to signal work done progress support in server capabilities. + +```typescript +export interface WorkDoneProgressOptions { + workDoneProgress?: boolean; +} +``` + +#### Partial Result Progress + +> *Since version 3.15.0* + +Partial results are also reported using the generic [`$/progress`](#progress) notification. The value payload of a partial result progress notification is in most cases the same as the final result. For example the `workspace/symbol` request has `SymbolInformation[]` as the result type. Partial result is therefore also of type `SymbolInformation[]`. Whether a client accepts partial result notifications for a request is signaled by adding a `partialResultToken` to the request parameter. For example, a `textDocument/reference` request that supports both work done and partial result progress might look like this: + +```json +{ + "textDocument": { + "uri": "file:///folder/file.ts" + }, + "position": { + "line": 9, + "character": 5 + }, + "context": { + "includeDeclaration": true + }, + // The token used to report work done progress. + "workDoneToken": "1d546990-40a3-4b77-b134-46622995f6ae", + // The token used to report partial result progress. + "partialResultToken": "5f6f349e-4f81-4a3b-afff-ee04bff96804" +} +``` + +The `partialResultToken` is then used to report partial results for the find references request. + +If a server reports partial result via a corresponding `$/progress`, the whole result must be reported using n `$/progress` notifications. The final response has to be empty in terms of result values. This avoids confusion about how the final result should be interpreted, e.g. as another partial result or as a replacing result. + +If the response errors the provided partial results should be treated as follows: + +- the `code` equals to `RequestCancelled`: the client is free to use the provided results but should make clear that the request got canceled and may be incomplete. +- in all other cases the provided partial results shouldn't be used. + +#### PartialResultParams + +A parameter literal used to pass a partial result token. + +```typescript +export interface PartialResultParams { + /** + * An optional token that a server can use to report partial results (e.g. streaming) to + * the client. + */ + partialResultToken?: ProgressToken; +} +``` + ### Actual Protocol This section documents the actual language server protocol. It uses the following format: * a header describing the request -* a _Request_: section describing the format of the request sent. The method is a string identifying the request the params are documented using a TypeScript interface -* a _Response_: section describing the format of the response. The result item describes the returned data in case of a success. The error.data describes the returned data in case of an error. Please remember that in case of a failure the response already contains an error.code and an error.message field. These fields are only spec'd if the protocol forces the use of certain error codes or messages. In cases where the server can decide on these values freely they aren't listed here. +* an optional _Client capability_ section describing the client capability of the request. This includes the client capabilities property path and JSON structure. +* an optional _Server Capability_ section describing the server capability of the request. This includes the server capabilities property path and JSON structure. +* a _Request_ section describing the format of the request sent. The method is a string identifying the request the params are documented using a TypeScript interface. It is also documented whether the request supports work done progress and partial result progress. +* a _Response_ section describing the format of the response. The result item describes the returned data in case of a success. The optional partial result item describes the returned data of a partial result notification. The error.data describes the returned data in case of an error. Please remember that in case of a failure the response already contains an error.code and an error.message field. These fields are only spec'd if the protocol forces the use of certain error codes or messages. In cases where the server can decide on these values freely they aren't listed here. * a _Registration Options_ section describing the registration option if the request or notification supports dynamic capability registration. #### Request, Notification and Response ordering @@ -903,7 +1327,7 @@ The initialize request is sent as the first request from the client to the serve * For a request the response should be an error with `code: -32002`. The message can be picked by the server. * Notifications should be dropped, except for the exit notification. This will allow the exit of a server without an initialize request. -Until the server has responded to the `initialize` request with an `InitializeResult`, the client must not send any additional requests or notifications to the server. In addition the server is not allowed to send any requests or notifications to the client until it has responded with an `InitializeResult`, with the exception that during the `initialize` request the server is allowed to send the notifications `window/showMessage`, `window/logMessage` and `telemetry/event` as well as the `window/showMessageRequest` request to the client. +Until the server has responded to the `initialize` request with an `InitializeResult`, the client must not send any additional requests or notifications to the server. In addition the server is not allowed to send any requests or notifications to the client until it has responded with an `InitializeResult`, with the exception that during the `initialize` request the server is allowed to send the notifications `window/showMessage`, `window/logMessage` and `telemetry/event` as well as the `window/showMessageRequest` request to the client. In case the client sets up a progress token in the initialize params (e.g. property `workDoneToken`) the server is also allowed to use that token (and only that token) using the `$/progress` notification sent from the server to the client. The `initialize` request may only be sent once. @@ -912,7 +1336,7 @@ _Request_: * params: `InitializeParams` defined as follows: ```typescript -interface InitializeParams { +interface InitializeParams extends WorkDoneProgressParams { /** * The process Id of the parent process that started * the server. Is null if the process has not been started by another process. @@ -920,6 +1344,23 @@ interface InitializeParams { */ processId: number | null; + /** + * Information about the client + * + * @since 3.15.0 + */ + clientInfo?: { + /** + * The name of the client as defined by the client. + */ + name: string; + + /** + * The client's version as defined by the client. + */ + version?: string; + }; + /** * The rootPath of the workspace. Is null * if no folder is open. @@ -956,179 +1397,13 @@ interface InitializeParams { * It can be `null` if the client supports workspace folders but none are * configured. * - * Since 3.6.0 + * @since 3.6.0 */ workspaceFolders?: WorkspaceFolder[] | null; } ``` -Where `ClientCapabilities`, `TextDocumentClientCapabilities` and `WorkspaceClientCapabilities` are defined as follows: +Where `ClientCapabilities` and `TextDocumentClientCapabilities` are defined as follows: -##### `WorkspaceClientCapabilities` define capabilities the editor / tool provides on the workspace: - -> New in version 3.13: `ResourceOperationKind` and `FailureHandlingKind` and the client capability `workspace.workspaceEdit.resourceOperations` as well as `workspace.workspaceEdit.failureHandling`. - -```typescript - -/** - * The kind of resource operations supported by the client. - */ -export type ResourceOperationKind = 'create' | 'rename' | 'delete'; - -export namespace ResourceOperationKind { - - /** - * Supports creating new files and folders. - */ - export const Create: ResourceOperationKind = 'create'; - - /** - * Supports renaming existing files and folders. - */ - export const Rename: ResourceOperationKind = 'rename'; - - /** - * Supports deleting existing files and folders. - */ - export const Delete: ResourceOperationKind = 'delete'; -} - -export type FailureHandlingKind = 'abort' | 'transactional' | 'undo' | 'textOnlyTransactional'; - -export namespace FailureHandlingKind { - - /** - * Applying the workspace change is simply aborted if one of the changes provided - * fails. All operations executed before the failing operation stay executed. - */ - export const Abort: FailureHandlingKind = 'abort'; - - /** - * All operations are executed transactionally. That means they either all - * succeed or no changes at all are applied to the workspace. - */ - export const Transactional: FailureHandlingKind = 'transactional'; - - - /** - * If the workspace edit contains only textual file changes they are executed transactionally. - * If resource changes (create, rename or delete file) are part of the change the failure - * handling strategy is abort. - */ - export const TextOnlyTransactional: FailureHandlingKind = 'textOnlyTransactional'; - - /** - * The client tries to undo the operations already executed. But there is no - * guarantee that this succeeds. - */ - export const Undo: FailureHandlingKind = 'undo'; -} - -/** - * Workspace specific client capabilities. - */ -export interface WorkspaceClientCapabilities { - /** - * The client supports applying batch edits to the workspace by supporting - * the request 'workspace/applyEdit' - */ - applyEdit?: boolean; - - /** - * Capabilities specific to `WorkspaceEdit`s - */ - workspaceEdit?: { - /** - * The client supports versioned document changes in `WorkspaceEdit`s - */ - documentChanges?: boolean; - - /** - * The resource operations the client supports. Clients should at least - * support 'create', 'rename' and 'delete' files and folders. - */ - resourceOperations?: ResourceOperationKind[]; - - /** - * The failure handling strategy of a client if applying the workspace edit - * fails. - */ - failureHandling?: FailureHandlingKind; - }; - - /** - * Capabilities specific to the `workspace/didChangeConfiguration` notification. - */ - didChangeConfiguration?: { - /** - * Did change configuration notification supports dynamic registration. - */ - dynamicRegistration?: boolean; - }; - - /** - * Capabilities specific to the `workspace/didChangeWatchedFiles` notification. - */ - didChangeWatchedFiles?: { - /** - * Did change watched files notification supports dynamic registration. Please note - * that the current protocol doesn't support static configuration for file changes - * from the server side. - */ - dynamicRegistration?: boolean; - }; - - /** - * Capabilities specific to the `workspace/symbol` request. - */ - symbol?: { - /** - * Symbol request supports dynamic registration. - */ - dynamicRegistration?: boolean; - - /** - * Specific capabilities for the `SymbolKind` in the `workspace/symbol` request. - */ - symbolKind?: { - /** - * The symbol kind values the client supports. When this - * property exists the client also guarantees that it will - * handle values outside its set gracefully and falls back - * to a default value when unknown. - * - * If this property is not present the client only supports - * the symbol kinds from `File` to `Array` as defined in - * the initial version of the protocol. - */ - valueSet?: SymbolKind[]; - } - }; - - /** - * Capabilities specific to the `workspace/executeCommand` request. - */ - executeCommand?: { - /** - * Execute command supports dynamic registration. - */ - dynamicRegistration?: boolean; - }; - - /** - * The client has support for workspace folders. - * - * Since 3.6.0 - */ - workspaceFolders?: boolean; - - /** - * The client supports `workspace/configuration` requests. - * - * Since 3.6.0 - */ - configuration?: boolean; -} -``` ##### `TextDocumentClientCapabilities` define capabilities the editor / tool provides on text documents. @@ -1138,426 +1413,129 @@ export interface WorkspaceClientCapabilities { */ export interface TextDocumentClientCapabilities { - synchronization?: { - /** - * Whether text document synchronization supports dynamic registration. - */ - dynamicRegistration?: boolean; - - /** - * The client supports sending will save notifications. - */ - willSave?: boolean; - - /** - * The client supports sending a will save request and - * waits for a response providing text edits which will - * be applied to the document before it is saved. - */ - willSaveWaitUntil?: boolean; - - /** - * The client supports did save notifications. - */ - didSave?: boolean; - } + synchronization?: TextDocumentSyncClientCapabilities; /** - * Capabilities specific to the `textDocument/completion` + * Capabilities specific to the `textDocument/completion` request. */ - completion?: { - /** - * Whether completion supports dynamic registration. - */ - dynamicRegistration?: boolean; - - /** - * The client supports the following `CompletionItem` specific - * capabilities. - */ - completionItem?: { - /** - * The client supports snippets as insert text. - * - * A snippet can define tab stops and placeholders with `$1`, `$2` - * and `${3:foo}`. `$0` defines the final tab stop, it defaults to - * the end of the snippet. Placeholders with equal identifiers are linked, - * that is typing in one will update others too. - */ - snippetSupport?: boolean; - - /** - * The client supports commit characters on a completion item. - */ - commitCharactersSupport?: boolean - - /** - * The client supports the following content formats for the documentation - * property. The order describes the preferred format of the client. - */ - documentationFormat?: MarkupKind[]; - - /** - * The client supports the deprecated property on a completion item. - */ - deprecatedSupport?: boolean; - - /** - * The client supports the preselect property on a completion item. - */ - preselectSupport?: boolean; - } - - completionItemKind?: { - /** - * The completion item kind values the client supports. When this - * property exists the client also guarantees that it will - * handle values outside its set gracefully and falls back - * to a default value when unknown. - * - * If this property is not present the client only supports - * the completion items kinds from `Text` to `Reference` as defined in - * the initial version of the protocol. - */ - valueSet?: CompletionItemKind[]; - }, - - /** - * The client supports to send additional context information for a - * `textDocument/completion` request. - */ - contextSupport?: boolean; - }; + completion?: CompletionClientCapabilities; /** - * Capabilities specific to the `textDocument/hover` + * Capabilities specific to the `textDocument/hover` request. */ - hover?: { - /** - * Whether hover supports dynamic registration. - */ - dynamicRegistration?: boolean; - - /** - * The client supports the follow content formats for the content - * property. The order describes the preferred format of the client. - */ - contentFormat?: MarkupKind[]; - }; + hover?: HoverClientCapabilities; /** - * Capabilities specific to the `textDocument/signatureHelp` + * Capabilities specific to the `textDocument/signatureHelp` request. */ - signatureHelp?: { - /** - * Whether signature help supports dynamic registration. - */ - dynamicRegistration?: boolean; - - /** - * The client supports the following `SignatureInformation` - * specific properties. - */ - signatureInformation?: { - /** - * The client supports the follow content formats for the documentation - * property. The order describes the preferred format of the client. - */ - documentationFormat?: MarkupKind[]; - - /** - * Client capabilities specific to parameter information. - */ - parameterInformation?: { - /** - * The client supports processing label offsets instead of a - * simple label string. - * - * Since 3.14.0 - */ - labelOffsetSupport?: boolean; - } - }; - }; + signatureHelp?: SignatureHelpClientCapabilities; /** - * Capabilities specific to the `textDocument/references` - */ - references?: { - /** - * Whether references supports dynamic registration. - */ - dynamicRegistration?: boolean; - }; - - /** - * Capabilities specific to the `textDocument/documentHighlight` - */ - documentHighlight?: { - /** - * Whether document highlight supports dynamic registration. - */ - dynamicRegistration?: boolean; - }; - - /** - * Capabilities specific to the `textDocument/documentSymbol` - */ - documentSymbol?: { - /** - * Whether document symbol supports dynamic registration. - */ - dynamicRegistration?: boolean; - - /** - * Specific capabilities for the `SymbolKind`. - */ - symbolKind?: { - /** - * The symbol kind values the client supports. When this - * property exists the client also guarantees that it will - * handle values outside its set gracefully and falls back - * to a default value when unknown. - * - * If this property is not present the client only supports - * the symbol kinds from `File` to `Array` as defined in - * the initial version of the protocol. - */ - valueSet?: SymbolKind[]; - } - - /** - * The client supports hierarchical document symbols. - */ - hierarchicalDocumentSymbolSupport?: boolean; - }; - - /** - * Capabilities specific to the `textDocument/formatting` - */ - formatting?: { - /** - * Whether formatting supports dynamic registration. - */ - dynamicRegistration?: boolean; - }; - - /** - * Capabilities specific to the `textDocument/rangeFormatting` - */ - rangeFormatting?: { - /** - * Whether range formatting supports dynamic registration. - */ - dynamicRegistration?: boolean; - }; - - /** - * Capabilities specific to the `textDocument/onTypeFormatting` - */ - onTypeFormatting?: { - /** - * Whether on type formatting supports dynamic registration. - */ - dynamicRegistration?: boolean; - }; - - /** - * Capabilities specific to the `textDocument/declaration` - */ - declaration?: { - /** - * Whether declaration supports dynamic registration. If this is set to `true` - * the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` - * return value for the corresponding server capability as well. - */ - dynamicRegistration?: boolean; - - /** - * The client supports additional metadata in the form of declaration links. - * - * Since 3.14.0 - */ - linkSupport?: boolean; - }; - - /** - * Capabilities specific to the `textDocument/definition`. + * Capabilities specific to the `textDocument/declaration` request. * - * Since 3.14.0 + * @since 3.14.0 */ - definition?: { - /** - * Whether definition supports dynamic registration. - */ - dynamicRegistration?: boolean; - - /** - * The client supports additional metadata in the form of definition links. - */ - linkSupport?: boolean; - }; + declaration?: DeclarationClientCapabilities; /** - * Capabilities specific to the `textDocument/typeDefinition` + * Capabilities specific to the `textDocument/definition` request. + */ + definition?: DefinitionClientCapabilities; + + /** + * Capabilities specific to the `textDocument/typeDefinition` request. * - * Since 3.6.0 + * @since 3.6.0 */ - typeDefinition?: { - /** - * Whether typeDefinition supports dynamic registration. If this is set to `true` - * the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` - * return value for the corresponding server capability as well. - */ - dynamicRegistration?: boolean; - - /** - * The client supports additional metadata in the form of definition links. - * - * Since 3.14.0 - */ - linkSupport?: boolean; - }; + typeDefinition?: TypeDefinitionClientCapabilities; /** - * Capabilities specific to the `textDocument/implementation`. + * Capabilities specific to the `textDocument/implementation` request. * - * Since 3.6.0 + * @since 3.6.0 */ - implementation?: { - /** - * Whether implementation supports dynamic registration. If this is set to `true` - * the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` - * return value for the corresponding server capability as well. - */ - dynamicRegistration?: boolean; - - /** - * The client supports additional metadata in the form of definition links. - * - * Since 3.14.0 - */ - linkSupport?: boolean; - }; + implementation?: ImplementationClientCapabilities; /** - * Capabilities specific to the `textDocument/codeAction` + * Capabilities specific to the `textDocument/references` request. */ - codeAction?: { - /** - * Whether code action supports dynamic registration. - */ - dynamicRegistration?: boolean; - /** - * The client support code action literals as a valid - * response of the `textDocument/codeAction` request. - * - * Since 3.8.0 - */ - codeActionLiteralSupport?: { - /** - * The code action kind is support with the following value - * set. - */ - codeActionKind: { - - /** - * The code action kind values the client supports. When this - * property exists the client also guarantees that it will - * handle values outside its set gracefully and falls back - * to a default value when unknown. - */ - valueSet: CodeActionKind[]; - }; - }; - }; + references?: ReferenceClientCapabilities; /** - * Capabilities specific to the `textDocument/codeLens` + * Capabilities specific to the `textDocument/documentHighlight` request. */ - codeLens?: { - /** - * Whether code lens supports dynamic registration. - */ - dynamicRegistration?: boolean; - }; + documentHighlight?: DocumentHighlightClientCapabilities; /** - * Capabilities specific to the `textDocument/documentLink` + * Capabilities specific to the `textDocument/documentSymbol` request. */ - documentLink?: { - /** - * Whether document link supports dynamic registration. - */ - dynamicRegistration?: boolean; - }; + documentSymbol?: DocumentSymbolClientCapabilities; + + /** + * Capabilities specific to the `textDocument/codeAction` request. + */ + codeAction?: CodeActionClientCapabilities; + + /** + * Capabilities specific to the `textDocument/codeLens` request. + */ + codeLens?: CodeLensClientCapabilities; + + /** + * Capabilities specific to the `textDocument/documentLink` request. + */ + documentLink?: DocumentLinkClientCapabilities; /** * Capabilities specific to the `textDocument/documentColor` and the * `textDocument/colorPresentation` request. * - * Since 3.6.0 + * @since 3.6.0 */ - colorProvider?: { - /** - * Whether colorProvider supports dynamic registration. If this is set to `true` - * the client supports the new `(ColorProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions)` - * return value for the corresponding server capability as well. - */ - dynamicRegistration?: boolean; - } + colorProvider?: DocumentColorClientCapabilities; /** - * Capabilities specific to the `textDocument/rename` + * Capabilities specific to the `textDocument/formatting` request. */ - rename?: { - /** - * Whether rename supports dynamic registration. - */ - dynamicRegistration?: boolean; - /** - * The client supports testing for validity of rename operations - * before execution. - */ - prepareSupport?: boolean; - }; + formatting?: DocumentFormattingClientCapabilities /** - * Capabilities specific to `textDocument/publishDiagnostics`. + * Capabilities specific to the `textDocument/rangeFormatting` request. */ - publishDiagnostics?: { - /** - * Whether the clients accepts diagnostics with related information. - */ - relatedInformation?: boolean; - }; + rangeFormatting?: DocumentRangeFormattingClientCapabilities; + + /** request. + * Capabilities specific to the `textDocument/onTypeFormatting` request. + */ + onTypeFormatting?: DocumentOnTypeFormattingClientCapabilities; + /** - * Capabilities specific to `textDocument/foldingRange` requests. + * Capabilities specific to the `textDocument/rename` request. + */ + rename?: RenameClientCapabilities; + + /** + * Capabilities specific to the `textDocument/publishDiagnostics` notification. + */ + publishDiagnostics?: PublishDiagnosticsClientCapabilities; + + /** + * Capabilities specific to the `textDocument/foldingRange` request. * - * Since 3.10.0 + * @since 3.10.0 */ - foldingRange?: { - /** - * Whether implementation supports dynamic registration for folding range providers. If this is set to `true` - * the client supports the new `(FoldingRangeProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions)` - * return value for the corresponding server capability as well. - */ - dynamicRegistration?: boolean; - /** - * The maximum number of folding ranges that the client prefers to receive per document. The value serves as a - * hint, servers are free to follow the limit. - */ - rangeLimit?: number; - /** - * If set, the client signals that it only supports folding complete lines. If set, client will - * ignore specified `startCharacter` and `endCharacter` properties in a FoldingRange. - */ - lineFoldingOnly?: boolean; - }; + foldingRange?: FoldingRangeClientCapabilities; + + /** + * Capabilities specific to the `textDocument/selectionRange` request. + * + * @since 3.15.0 + */ + selectionRange?: SelectionRangeClientCapabilities; } ``` -`ClientCapabilities` now define capabilities for dynamic registration, workspace and text document features the client supports. The `experimental` can be used to pass experimental capabilities under development. For future compatibility a `ClientCapabilities` object literal can have more properties set than currently defined. Servers receiving a `ClientCapabilities` object literal with unknown properties should ignore these properties. A missing property should be interpreted as an absence of the capability. If a missing property normally defines sub properties, all missing sub properties should be interpreted as an absence of the corresponding capability. +`ClientCapabilities` define capabilities for dynamic registration, workspace and text document features the client supports. The `experimental` can be used to pass experimental capabilities under development. For future compatibility a `ClientCapabilities` object literal can have more properties set than currently defined. Servers receiving a `ClientCapabilities` object literal with unknown properties should ignore these properties. A missing property should be interpreted as an absence of the capability. If a missing property normally defines sub properties, all missing sub properties should be interpreted as an absence of the corresponding capability. Client capabilities got introduced with version 3.0 of the protocol. They therefore only describe capabilities that got introduced in 3.x or later. Capabilities that existed in the 2.x version of the protocol are still mandatory for clients. Clients cannot opt out of providing them. So even if a client omits the `ClientCapabilities.textDocument.synchronization` it is still required that the client provides text document synchronization (e.g. open, changed and close notifications). @@ -1566,13 +1544,72 @@ interface ClientCapabilities { /** * Workspace specific client capabilities. */ - workspace?: WorkspaceClientCapabilities; + workspace?: { + /** + * The client supports applying batch edits + * to the workspace by supporting the request + * 'workspace/applyEdit' + */ + applyEdit?: boolean; + + /** + * Capabilities specific to `WorkspaceEdit`s + */ + workspaceEdit?: WorkspaceEditClientCapabilities; + + /** + * Capabilities specific to the `workspace/didChangeConfiguration` notification. + */ + didChangeConfiguration?: DidChangeConfigurationClientCapabilities; + + /** + * Capabilities specific to the `workspace/didChangeWatchedFiles` notification. + */ + didChangeWatchedFiles?: DidChangeWatchedFilesClientCapabilities; + + /** + * Capabilities specific to the `workspace/symbol` request. + */ + symbol?: WorkspaceSymbolClientCapabilities; + + /** + * Capabilities specific to the `workspace/executeCommand` request. + */ + executeCommand?: ExecuteCommandClientCapabilities; + + /** + * The client has support for workspace folders. + * + * Since 3.6.0 + */ + workspaceFolders?: boolean; + + /** + * The client supports `workspace/configuration` requests. + * + * Since 3.6.0 + */ + configuration?: boolean; + }; /** * Text document specific client capabilities. */ textDocument?: TextDocumentClientCapabilities; + /** + * Window specific client capabilities. + */ + window?: { + /** + * Whether client supports handling progress notifications. If set servers are allowed to + * report in `workDoneProgress` property in the request specific server capabilities. + * + * Since 3.15.0 + */ + workDoneProgress?: boolean; + } + /** * Experimental client capabilities. */ @@ -1589,6 +1626,23 @@ interface InitializeResult { * The capabilities the language server provides. */ capabilities: ServerCapabilities; + + /** + * Information about the server. + * + * @since 3.15.0 + */ + serverInfo?: { + /** + * The name of the server as defined by the server. + */ + name: string; + + /** + * The server's version as defined by the server. + */ + version?: string; + }; } ``` * error.code: @@ -1624,288 +1678,139 @@ interface InitializeError { The server can signal the following capabilities: ```typescript -/** - * Defines how the host (editor) should sync document changes to the language server. - */ -export namespace TextDocumentSyncKind { - /** - * Documents should not be synced at all. - */ - export const None = 0; - - /** - * Documents are synced by always sending the full content - * of the document. - */ - export const Full = 1; - - /** - * Documents are synced by sending the full content on open. - * After that only incremental updates to the document are - * send. - */ - export const Incremental = 2; -} - -/** - * Completion options. - */ -export interface CompletionOptions { - /** - * The server provides support to resolve additional - * information for a completion item. - */ - resolveProvider?: boolean; - - /** - * The characters that trigger completion automatically. - */ - triggerCharacters?: string[]; -} -/** - * Signature help options. - */ -export interface SignatureHelpOptions { - /** - * The characters that trigger signature help - * automatically. - */ - triggerCharacters?: string[]; -} - -/** - * Code Action options. - */ -export interface CodeActionOptions { - /** - * 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. - */ - codeActionKinds?: CodeActionKind[]; -} - -/** - * Code Lens options. - */ -export interface CodeLensOptions { - /** - * Code lens has a resolve provider as well. - */ - resolveProvider?: boolean; -} - -/** - * Format document on type options. - */ -export interface DocumentOnTypeFormattingOptions { - /** - * A character on which formatting should be triggered, like `}`. - */ - firstTriggerCharacter: string; - - /** - * More trigger characters. - */ - moreTriggerCharacter?: string[]; -} - -/** - * Rename options - */ -export interface RenameOptions { - /** - * Renames should be checked and tested before being executed. - */ - prepareProvider?: boolean; -} - -/** - * Document link options. - */ -export interface DocumentLinkOptions { - /** - * Document links have a resolve provider as well. - */ - resolveProvider?: boolean; -} - -/** - * Execute command options. - */ -export interface ExecuteCommandOptions { - /** - * The commands to be executed on the server - */ - commands: string[] -} - -/** - * Save options. - */ -export interface SaveOptions { - /** - * The client is supposed to include the content on save. - */ - includeText?: boolean; -} - -/** - * Color provider options. - */ -export interface ColorProviderOptions { -} - -/** - * Folding range provider options. - */ -export interface FoldingRangeProviderOptions { -} - -export interface TextDocumentSyncOptions { - /** - * Open and close notifications are sent to the server. If omitted open close notification should not - * be sent. - */ - openClose?: boolean; - /** - * Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full - * and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None. - */ - change?: number; - /** - * If present will save notifications are sent to the server. If omitted the notification should not be - * sent. - */ - willSave?: boolean; - /** - * If present will save wait until requests are sent to the server. If omitted the request should not be - * sent. - */ - willSaveWaitUntil?: boolean; - /** - * If present save notifications are sent to the server. If omitted the notification should not be - * sent. - */ - save?: SaveOptions; -} - -/** - * Static registration options to be returned in the initialize request. - */ -interface StaticRegistrationOptions { - /** - * The id used to register the request. The id can be used to deregister - * the request again. See also Registration#id. - */ - id?: string; -} - interface ServerCapabilities { /** * 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`. */ textDocumentSync?: TextDocumentSyncOptions | number; - /** - * The server provides hover support. - */ - hoverProvider?: boolean; + /** * The server provides completion support. */ completionProvider?: CompletionOptions; + + /** + * The server provides hover support. + */ + hoverProvider?: boolean | HoverOptions; + /** * The server provides signature help support. */ signatureHelpProvider?: SignatureHelpOptions; + + /** + * The server provides go to declaration support. + * + * @since 3.14.0 + */ + declarationProvider?: boolean | DeclarationOptions | DeclarationRegistrationOptions; + /** * The server provides goto definition support. */ - definitionProvider?: boolean; + definitionProvider?: boolean | DefinitionOptions; + /** - * The server provides Goto Type Definition support. + * The server provides goto type definition support. * - * Since 3.6.0 + * @since 3.6.0 */ - typeDefinitionProvider?: boolean | (TextDocumentRegistrationOptions & StaticRegistrationOptions); + typeDefinitionProvider?: boolean | TypeDefinitionOptions | TypeDefinitionRegistrationOptions; + /** - * The server provides Goto Implementation support. + * The server provides goto implementation support. * - * Since 3.6.0 + * @since 3.6.0 */ - implementationProvider?: boolean | (TextDocumentRegistrationOptions & StaticRegistrationOptions); + implementationProvider?: boolean | ImplementationOptions | ImplementationRegistrationOptions; + /** * The server provides find references support. */ - referencesProvider?: boolean; + referencesProvider?: boolean | ReferenceOptions; + /** * The server provides document highlight support. */ - documentHighlightProvider?: boolean; + documentHighlightProvider?: boolean | DocumentHighlightOptions; + /** * The server provides document symbol support. */ - documentSymbolProvider?: boolean; - /** - * The server provides workspace symbol support. - */ - workspaceSymbolProvider?: boolean; + documentSymbolProvider?: boolean | DocumentSymbolOptions; + /** * 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`. */ codeActionProvider?: boolean | CodeActionOptions; + /** * The server provides code lens. */ codeLensProvider?: CodeLensOptions; + + /** + * The server provides document link support. + */ + documentLinkProvider?: DocumentLinkOptions; + + /** + * The server provides color provider support. + * + * @since 3.6.0 + */ + colorProvider?: boolean | DocumentColorOptions | DocumentColorRegistrationOptions; + /** * The server provides document formatting. */ - documentFormattingProvider?: boolean; + documentFormattingProvider?: boolean | DocumentFormattingOptions; + /** * The server provides document range formatting. */ - documentRangeFormattingProvider?: boolean; + documentRangeFormattingProvider?: boolean | DocumentRangeFormattingOptions; + /** * The server provides document formatting on typing. */ documentOnTypeFormattingProvider?: DocumentOnTypeFormattingOptions; + /** * The server provides rename support. RenameOptions may only be * specified if the client states that it supports * `prepareSupport` in its initial `initialize` request. */ renameProvider?: boolean | RenameOptions; - /** - * The server provides document link support. - */ - documentLinkProvider?: DocumentLinkOptions; - /** - * The server provides color provider support. - * - * Since 3.6.0 - */ - colorProvider?: boolean | ColorProviderOptions | (ColorProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions); + /** * The server provides folding provider support. * - * Since 3.10.0 + * @since 3.10.0 */ - foldingRangeProvider?: boolean | FoldingRangeProviderOptions | (FoldingRangeProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions); - /** - * The server provides go to declaration support. - * - * Since 3.14.0 - */ - declarationProvider?: boolean | (TextDocumentRegistrationOptions & StaticRegistrationOptions); + foldingRangeProvider?: boolean | FoldingRangeOptions | FoldingRangeRegistrationOptions; + /** * The server provides execute command support. */ executeCommandProvider?: ExecuteCommandOptions; + + /** + * The server provides selection range support. + * + * @since 3.15.0 + */ + selectionRangeProvider?: boolean | SelectionRangeOptions | SelectionRangeRegistrationOptions; + + /** + * The server provides workspace symbol support. + */ + workspaceSymbolProvider?: boolean; + /** * Workspace specific server capabilities */ @@ -1913,25 +1818,11 @@ interface ServerCapabilities { /** * The server supports workspace folder. * - * Since 3.6.0 + * @since 3.6.0 */ - workspaceFolders?: { - /** - * The server has support for workspace folders - */ - supported?: boolean; - /** - * Whether the server wants to receive workspace folder - * change notifications. - * - * If a strings is provided the string is treated as a 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. - */ - changeNotifications?: string | boolean; - } + workspaceFolders?: WorkspaceFoldersServerCapabilities; } + /** * Experimental server capabilities. */ @@ -1954,7 +1845,7 @@ interface InitializedParams { #### Shutdown Request (:leftwards_arrow_with_hook:) -The shutdown request is sent from the client to the server. It asks the server to shut down, but to not exit (otherwise the response might not be delivered correctly to the client). There is a separate exit notification that asks the server to exit. Clients must not send any notifications other than `exit` or requests to a server to which they have sent a shutdown requests. If a server receives requests after a shutdown request those requests should be errored with `InvalidRequest`. +The shutdown request is sent from the client to the server. It asks the server to shut down, but to not exit (otherwise the response might not be delivered correctly to the client). There is a separate exit notification that asks the server to exit. Clients must not send any notifications other than `exit` or requests to a server to which they have sent a shutdown request. If a server receives requests after a shutdown request those requests should error with `InvalidRequest`. _Request_: * method: 'shutdown' @@ -2082,7 +1973,46 @@ interface LogMessageParams { } ``` -Where type is defined as above. +#### Creating Work Done Progress (:arrow_right_hook:) + +The `window/workDoneProgress/create` request is sent from the server to the client to ask the client to create a work done progress. + +_Request_: + +* method: 'window/workDoneProgress/create' +* params: `WorkDoneProgressCreateParams` defined as follows: + +```typescript +export interface WorkDoneProgressCreateParams { + /** + * The token to be used to report progress. + */ + token: ProgressToken; +} +``` + +_Response_: + +* result: void +* error: code and message set in case an exception happens during the 'window/workDoneProgress/create' request. In case an error occurs a server must not send any progress notification using the token provided in the `WorkDoneProgressCreateParams`. + +#### Canceling a Work Done Progress (:arrow_right:) + +The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a progress initiated on the server side using the `window/workDoneProgress/create`. + +_Notification_: + +* method: 'window/workDoneProgress/cancel' +* params: `WorkDoneProgressCancelParams` defined as follows: + +```typescript +export interface WorkDoneProgressCancelParams { + /** + * The token to be used to report progress. + */ + token: ProgressToken; +} +``` #### Telemetry Notification (:arrow_left:) @@ -2096,6 +2026,8 @@ _Notification_: The `client/registerCapability` request is sent from the server to the client to register for a new capability on the client side. Not all clients need to support dynamic capability registration. A client opts in via the `dynamicRegistration` property on the specific client capabilities. A client can even provide dynamic registration for capability A but not for capability B (see `TextDocumentClientCapabilities` as an example). +Server must not register the same capability both statically through the initialize result and dynamically for the same document selector. If a server wants to support both static and dynamic registration it needs to check the client capability in the initialize request and only register the capability statically if the client doesn't support dynamic registration for that capability. + _Request_: * method: 'client/registerCapability' * params: `RegistrationParams` @@ -2129,17 +2061,7 @@ export interface RegistrationParams { } ``` -Since most of the registration options require to specify a document selector there is a base interface that can be used. - -```typescript -export interface 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. - */ - documentSelector: DocumentSelector | null; -} -``` +Since most of the registration options require to specify a document selector there is a base interface that can be used. See `TextDocumentRegistrationOptions`. An example JSON RPC message to register dynamically for the `textDocument/willSaveWaitUntil` feature on the client side is as follows (only details shown): @@ -2196,6 +2118,9 @@ export interface Unregistration { } export interface UnregistrationParams { + // This should correctly be named `unregistrations`. However changing this + // is a breaking change and needs to wait until we deliver a 4.x version + // of the specification. unregisterations: Unregistration[]; } ``` @@ -2227,13 +2152,39 @@ Many tools support more than one root folder per workspace. Examples for this ar The `workspace/workspaceFolders` request is sent from the server to the client to fetch the current open list of workspace folders. Returns `null` in the response if only a single file is open in the tool. Returns an empty array if a workspace is open but no folders are configured. -_Request_: +_Client Capability_: +* property path (optional): `workspace.workspaceFolders` +* property type: `boolean` +_Server Capability_: +* property path (optional): `workspace.workspaceFolders` +* property type: `WorkspaceFoldersServerCapabilities` defined as follows: + +```typescript +export interface WorkspaceFoldersServerCapabilities { + /** + * The server has support for workspace folders + */ + supported?: boolean; + + /** + * 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. + */ + changeNotifications?: string | boolean; +} +``` + +_Request_: * method: 'workspace/workspaceFolders' * params: none _Response_: - * result: `WorkspaceFolder[] | null` defined as follows: ```typescript @@ -2256,7 +2207,7 @@ export interface WorkspaceFolder { > *Since version 3.6.0* -The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server to inform the server about workspace folder configuration changes. The notification is sent by default if both _ServerCapabilities/workspace/workspaceFolders_ and _ClientCapabilities/workspace/workspaceFolders_ are true; or if the server has registered itself to receive this notification. To register for the `workspace/didChangeWorkspaceFolders` send a `client/registerCapability` request from the server to the client. The registration parameter must have a `registrations` item of the following form, where `id` is a unique id used to unregister the capability (the example uses a UUID): +The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server to inform the server about workspace folder configuration changes. The notification is sent by default if both _client capability_ `workspace.workspaceFolders` and the _server capability_ `workspace.workspaceFolders.supported` are true; or if the server has registered itself to receive this notification. To register for the `workspace/didChangeWorkspaceFolders` send a `client/registerCapability` request from the server to the client. The registration parameter must have a `registrations` item of the following form, where `id` is a unique id used to unregister the capability (the example uses a UUID): ```ts { id: "28c6150c-bd7b-11e7-abc4-cec278b6b50a", @@ -2265,7 +2216,6 @@ The `workspace/didChangeWorkspaceFolders` notification is sent from the client t ``` _Notification_: - * method: 'workspace/didChangeWorkspaceFolders' * params: `DidChangeWorkspaceFoldersParams` defined as follows: @@ -2297,6 +2247,19 @@ export interface WorkspaceFoldersChangeEvent { A notification sent from the client to the server to signal the change of configuration settings. +_Client Capability_: +* property path (optional): `workspace.didChangeConfiguration` +* property type: `DidChangeConfigurationClientCapabilities` defined as follows: + +```typescript +export interface DidChangeConfigurationClientCapabilities { + /** + * Did change configuration notification supports dynamic registration. + */ + dynamicRegistration?: boolean; +} +``` + _Notification_: * method: 'workspace/didChangeConfiguration', * params: `DidChangeConfigurationParams` defined as follows: @@ -2318,8 +2281,11 @@ The `workspace/configuration` request is sent from the server to the client to f A `ConfigurationItem` consists of the configuration section to ask for and an additional scope URI. The configuration section ask for is defined by the server and doesn't necessarily need to correspond to the configuration store used be the client. So a server might ask for a configuration `cpp.formatterOptions` but the client stores the configuration in a XML store layout differently. It is up to the client to do the necessary conversion. If a scope URI is provided the client should return the setting scoped to the provided resource. If the client for example uses [EditorConfig](http://editorconfig.org/) to manage its settings the configuration should be returned for the passed resource URI. If the client can't provide a configuration setting for a given scope then `null` need to be present in the returned array. -_Request_: +_Client Capability_: +* property path (optional): `workspace.configuration` +* property type: `boolean` +_Request_: * method: 'workspace/configuration' * params: `ConfigurationParams` defined as follows @@ -2356,58 +2322,22 @@ Servers are allowed to run their own file watching mechanism and not rely on cli - a client usually starts more than one server. If every server runs its own file watching it can become a CPU or memory problem. - in general there are more server than client implementations. So this problem is better solved on the client side. - -_Notification_: -* method: 'workspace/didChangeWatchedFiles' -* params: `DidChangeWatchedFilesParams` defined as follows: +_Client Capability_: +* property path (optional): `workspace.didChangeWatchedFiles` +* property type: `DidChangeWatchedFilesClientCapabilities` defined as follows: ```typescript -interface DidChangeWatchedFilesParams { +export interface DidChangeWatchedFilesClientCapabilities { /** - * The actual file events. + * Did change watched files notification supports dynamic registration. Please note + * that the current protocol doesn't support static configuration for file changes + * from the server side. */ - changes: FileEvent[]; + dynamicRegistration?: boolean; } ``` -Where FileEvents are described as follows: - -```typescript -/** - * An event describing a file change. - */ -interface FileEvent { - /** - * The file's URI. - */ - uri: DocumentUri; - /** - * The change type. - */ - type: number; -} - -/** - * The file event type. - */ -export namespace FileChangeType { - /** - * The file got created. - */ - export const Created = 1; - /** - * The file got changed. - */ - export const Changed = 2; - /** - * The file got deleted. - */ - export const Deleted = 3; -} -``` - -_Registration Options_: `DidChangeWatchedFilesRegistrationOptions` defined as follows - +_Registration Options_: `DidChangeWatchedFilesRegistrationOptions` defined as follows: ```typescript /** * Describe options to be used when registering for file system change events. @@ -2459,10 +2389,104 @@ export namespace WatchKind { } ``` +_Notification_: +* method: 'workspace/didChangeWatchedFiles' +* params: `DidChangeWatchedFilesParams` defined as follows: + +```typescript +interface DidChangeWatchedFilesParams { + /** + * The actual file events. + */ + changes: FileEvent[]; +} +``` + +Where FileEvents are described as follows: + +```typescript +/** + * An event describing a file change. + */ +interface FileEvent { + /** + * The file's URI. + */ + uri: DocumentUri; + /** + * The change type. + */ + type: number; +} + +/** + * The file event type. + */ +export namespace FileChangeType { + /** + * The file got created. + */ + export const Created = 1; + /** + * The file got changed. + */ + export const Changed = 2; + /** + * The file got deleted. + */ + export const Deleted = 3; +} +``` + #### Workspace Symbols Request (:leftwards_arrow_with_hook:) The workspace symbol request is sent from the client to the server to list project-wide symbols matching the query string. +_Client Capability_: +* property path (optional): `workspace.symbol` +* property type: `WorkspaceSymbolClientCapabilities` defined as follows: + +```typescript +interface WorkspaceSymbolClientCapabilities { + /** + * Symbol request supports dynamic registration. + */ + dynamicRegistration?: boolean; + + /** + * Specific capabilities for the `SymbolKind` in the `workspace/symbol` request. + */ + symbolKind?: { + /** + * The symbol kind values the client supports. When this + * property exists the client also guarantees that it will + * handle values outside its set gracefully and falls back + * to a default value when unknown. + * + * If this property is not present the client only supports + * the symbol kinds from `File` to `Array` as defined in + * the initial version of the protocol. + */ + valueSet?: SymbolKind[]; + } +} +``` + +_Server Capability_: +* property path (optional): `workspaceSymbolProvider` +* property type: `boolean | WorkspaceSymbolOptions` where `WorkspaceSymbolOptions` is defined as follows: + +```typescript +export interface WorkspaceSymbolOptions extends WorkDoneProgressOptions { +} +``` + +_Registration Options_: `WorkspaceSymbolRegistrationOptions` defined as follows: +```typescript +export interface WorkspaceSymbolRegistrationOptions extends WorkspaceSymbolOptions { +} +``` + _Request_: * method: 'workspace/symbol' * params: `WorkspaceSymbolParams` defined as follows: @@ -2471,9 +2495,10 @@ _Request_: /** * The parameters of a Workspace Symbol Request. */ -interface WorkspaceSymbolParams { +interface WorkspaceSymbolParams extends WorkDoneProgressParams, PartialResultParams { /** - * A non-empty query string + * A query string to filter symbols by. Clients may send an empty + * string here to request all symbols. */ query: string; } @@ -2481,23 +2506,56 @@ interface WorkspaceSymbolParams { _Response_: * result: `SymbolInformation[]` \| `null` as defined above. +* partial result: `SymbolInformation[]` as defined above. * error: code and message set in case an exception happens during the workspace symbol request. -_Registration Options_: void - - #### Execute a command (:leftwards_arrow_with_hook:) The `workspace/executeCommand` request is sent from the client to the server to trigger command execution on the server. In most cases the server creates a `WorkspaceEdit` structure and applies the changes to the workspace using the request `workspace/applyEdit` which is sent from the server to the client. +_Client Capability_: +* property path (optional): `workspace.executeCommand` +* property type: `ExecuteCommandClientCapabilities` defined as follows: + +```typescript +export interface ExecuteCommandClientCapabilities { + /** + * Execute command supports dynamic registration. + */ + dynamicRegistration?: boolean; +} +``` + +_Server Capability_: +* property path (optional): `executeCommandProvider` +* property type: `ExecuteCommandOptions` defined as follows: + +```typescript +export interface ExecuteCommandOptions extends WorkDoneProgressOptions { + /** + * The commands to be executed on the server + */ + commands: string[] +} +``` + +_Registration Options_: `ExecuteCommandRegistrationOptions` defined as follows: +```typescript +/** + * Execute command registration options. + */ +export interface ExecuteCommandRegistrationOptions extends ExecuteCommandOptions { +} +``` + _Request:_ * method: 'workspace/executeCommand' * params: `ExecuteCommandParams` defined as follows: ```typescript -export interface ExecuteCommandParams { +export interface ExecuteCommandParams extends WorkDoneProgressParams { /** * The identifier of the actual command handler. @@ -2516,25 +2574,16 @@ _Response_: * result: `any` \| `null` * error: code and message set in case an exception happens during the request. -_Registration Options_: `ExecuteCommandRegistrationOptions` defined as follows: - -```typescript -/** - * Execute command registration options. - */ -export interface ExecuteCommandRegistrationOptions { - /** - * The commands to be executed on the server - */ - commands: string[] -} -``` - - #### Applies a WorkspaceEdit (:arrow_right_hook:) The `workspace/applyEdit` request is sent from the server to the client to modify resource on the client side. +_Client Capability_: +* property path (optional): `workspace.applyEdit` +* property type: `boolean` + +See also the [WorkspaceEditClientCapabilities](#workspaceEditClientCapabilities) for the supported capabilities of a workspace edit. + _Request_: * method: 'workspace/applyEdit' * params: `ApplyWorkspaceEditParams` defined as follows: @@ -2576,13 +2625,73 @@ export interface ApplyWorkspaceEditResponse { ``` * error: code and message set in case an exception happens during the request. +#### Text Document Synchronization + +Client support for `textDocument/open`, `textDocument/change` and `textDocument/close` notifications is mandatory in the protocol and clients can not opt out supporting them. This includes both full and incremental syncronization in the `textDocument/change` notification. In addition a server must either implement all three of them or none. Their capabilities are therefore controlled via a combined client and server capability. + +_Client Capability_: +* property path (optional): `textDocument.synchronization.dynamicRegistration` +* property type: `boolean` + +Controls whether text document synchronization supports dynamic registration. + +_Server Capability_: +* property path (optional): `textDocumentSync` +* property type: `TextDocumentSyncKind | TextDocumentSyncOptions`. The below definition of the `TextDocumentSyncOptions` only covers the properties specific to the open, change and close notifications. A complete definition covering all properties can be found [here](#textDocument_didClose): + +```typescript +/** + * Defines how the host (editor) should sync document changes to the language server. + */ +export namespace TextDocumentSyncKind { + /** + * Documents should not be synced at all. + */ + export const None = 0; + + /** + * Documents are synced by always sending the full content + * of the document. + */ + export const Full = 1; + + /** + * Documents are synced by sending the full content on open. + * After that only incremental updates to the document are + * send. + */ + export const Incremental = 2; +} + +export interface TextDocumentSyncOptions { + /** + * Open and close notifications are sent to the server. If omitted open close notification should not + * be sent. + */ + openClose?: boolean; + + /** + * Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full + * and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None. + */ + change?: TextDocumentSyncKind; +} +``` #### DidOpenTextDocument Notification (:arrow_right:) -The document open notification is sent from the client to the server to signal newly opened text documents. The document's truth is now managed by the client and the server must not try to read the document's truth using the document's Uri. Open in this sense means it is managed by the client. It doesn't necessarily mean that its content is presented in an editor. An open notification must not be sent more than once without a corresponding close notification send before. This means open and close notification must be balanced and the max open count for a particular textDocument is one. Note that a server's ability to fulfill requests is independent of whether a text document is open or closed. +The document open notification is sent from the client to the server to signal newly opened text documents. The document's content is now managed by the client and the server must not try to read the document's content using the document's Uri. Open in this sense means it is managed by the client. It doesn't necessarily mean that its content is presented in an editor. An open notification must not be sent more than once without a corresponding close notification send before. This means open and close notification must be balanced and the max open count for a particular textDocument is one. Note that a server's ability to fulfill requests is independent of whether a text document is open or closed. The `DidOpenTextDocumentParams` contain the language id the document is associated with. If the language Id of a document changes, the client needs to send a `textDocument/didClose` to the server followed by a `textDocument/didOpen` with the new language id if the server handles the new language id as well. +_Client Capability_: +See general synchronization [client capabilities](#textDocument_synchronization_cc). + +_Server Capability_: +See general synchronization [server capabilities](#textDocument_synchronization_sc). + +_Registration Options_: [`TextDocumentRegistrationOptions`](#textDocumentRegistrationOptions) + _Notification_: * method: 'textDocument/didOpen' * params: `DidOpenTextDocumentParams` defined as follows: @@ -2596,12 +2705,29 @@ interface DidOpenTextDocumentParams { } ``` -_Registration Options_: `TextDocumentRegistrationOptions` - - #### DidChangeTextDocument Notification (:arrow_right:) -The document change notification is sent from the client to the server to signal changes to a text document. In 2.0 the shape of the params has changed to include proper version numbers and language ids. +The document change notification is sent from the client to the server to signal changes to a text document. Before a client can change a text document it must claim ownership of its content using the `textDocument/didOpen` notification. In 2.0 the shape of the params has changed to include proper version numbers and language ids. + +_Client Capability_: +See general synchronization [client capabilities](#textDocument_synchronization_cc). + +_Server Capability_: +See general synchronization [server capabilities](#textDocument_synchronization_sc). + +_Registration Options_: `TextDocumentChangeRegistrationOptions` defined as follows: +```typescript +/** + * Describe options to be used when registering for text document change events. + */ +export interface TextDocumentChangeRegistrationOptions extends TextDocumentRegistrationOptions { + /** + * How documents are synced to the server. See TextDocumentSyncKind.Full + * and TextDocumentSyncKind.Incremental. + */ + syncKind: TextDocumentSyncKind; +} +``` _Notification_: * method: 'textDocument/didChange' @@ -2618,8 +2744,16 @@ interface DidChangeTextDocumentParams { /** * The actual content changes. The content changes describe single state changes - * to the document. So if there are two content changes c1 and c2 for a document - * in state S then c1 move the document to S' and c2 to S''. + * to the document. So if there are two content changes c1 (at array index 0) and + * c2 (at array index 1) for a document in state S then c1 moves the document from + * S to S' and c2 from S' to S''. So c1 is computed on the state S and c2 is computed + * on the state S'. + * + * To mirror the content of a document using change events use the following approach: + * - start with the same initial content + * - apply the 'textDocument/didChange' notifications in the order you recevie them. + * - apply the `TextDocumentContentChangeEvent`s in a single notification in the order + * you receive them. */ contentChanges: TextDocumentContentChangeEvent[]; } @@ -2628,44 +2762,49 @@ interface DidChangeTextDocumentParams { * An event describing a change to a text document. If range and rangeLength are omitted * the new text is considered to be the full content of the document. */ -interface TextDocumentContentChangeEvent { +export type TextDocumentContentChangeEvent = { /** * The range of the document that changed. */ - range?: Range; + range: Range; /** - * The length of the range that got replaced. + * The optional length of the range that got replaced. + * + * @deprecated use range instead. */ rangeLength?: number; /** - * The new text of the range/document. + * The new text for the provided range. + */ + text: string; +} | { + /** + * The new text of the whole document. */ text: string; } ``` -_Registration Options_: `TextDocumentChangeRegistrationOptions` defined as follows: - -```typescript -/** - * Describe options to be used when registering for text document change events. - */ -export interface TextDocumentChangeRegistrationOptions extends TextDocumentRegistrationOptions { - /** - * How documents are synced to the server. See TextDocumentSyncKind.Full - * and TextDocumentSyncKind.Incremental. - */ - syncKind: number; -} -``` - - #### WillSaveTextDocument Notification (:arrow_right:) The document will save notification is sent from the client to the server before the document is actually saved. +_Client Capability_: +* property name (optional): `textDocument.synchronization.willSave` +* property type: `boolean` + +The capability indicates that the client supports `textDocument/willSave` notifications. + +_Server Capability_: +* property name (optional): `textDocumentSync.willSave` +* property type: `boolean` + +The capability indicates that the server is interested in `textDocument/willSave` notifications. + +_Registration Options_: `TextDocumentRegistrationOptions` + _Notification_: * method: 'textDocument/willSave' * params: `WillSaveTextDocumentParams` defined as follows: @@ -2709,13 +2848,24 @@ export namespace TextDocumentSaveReason { } ``` -_Registration Options_: `TextDocumentRegistrationOptions` - - #### WillSaveWaitUntilTextDocument Request (:leftwards_arrow_with_hook:) The document will save request is sent from the client to the server before the document is actually saved. The request can return an array of TextEdits which will be applied to the text document before it is saved. Please note that clients might drop results if computing the text edits took too long or if a server constantly fails on this request. This is done to keep the save fast and reliable. +_Client Capability_: +* property name (optional): `textDocument.synchronization.willSaveWaitUntil` +* property type: `boolean` + +The capability indicates that the client supports `textDocument/willSaveWaitUntil` requests. + +_Server Capability_: +* property name (optional): `textDocumentSync.willSaveWaitUntil` +* property type: `boolean` + +The capability indicates that the server is interested in `textDocument/willSaveWaitUntil` requests. + +_Registration Options_: `TextDocumentRegistrationOptions` + _Request_: * method: 'textDocument/willSaveWaitUntil' * params: `WillSaveTextDocumentParams` @@ -2724,12 +2874,42 @@ _Response_: * result:`TextEdit[]` \| `null` * error: code and message set in case an exception happens during the `willSaveWaitUntil` request. -_Registration Options_: `TextDocumentRegistrationOptions` - #### DidSaveTextDocument Notification (:arrow_right:) The document save notification is sent from the client to the server when the document was saved in the client. +_Client Capability_: +* property name (optional): `textDocument.synchronization.didSave` +* property type: `boolean` + +The capability indicates that the client supports `textDocument/didSave` notifications. + +_Server Capability_: +* property name (optional): `textDocumentSync.save` +* property type: `boolean | SaveOptions` where `SaveOptions` is defined as follows: + +```typescript +export interface SaveOptions { + /** + * The client is supposed to include the content on save. + */ + includeText?: boolean; +} +``` + +The capability indicates that the server is interested in `textDocument/didSave` notifications. + +_Registration Options_: `TextDocumentSaveRegistrationOptions` defined as follows: +```typescript +export interface TextDocumentSaveRegistrationOptions extends TextDocumentRegistrationOptions { + /** + * The client is supposed to include the content on save. + */ + includeText?: boolean; +} +``` + +_Notification_: * method: 'textDocument/didSave' * params: `DidSaveTextDocumentParams` defined as follows: @@ -2748,20 +2928,17 @@ interface DidSaveTextDocumentParams { } ``` -_Registration Options_: `TextDocumentSaveRegistrationOptions` defined as follows: - -```typescript -export interface TextDocumentSaveRegistrationOptions extends TextDocumentRegistrationOptions { - /** - * The client is supposed to include the content on save. - */ - includeText?: boolean; -} -``` - #### DidCloseTextDocument Notification (:arrow_right:) -The document close notification is sent from the client to the server when the document got closed in the client. The document's truth now exists where the document's Uri points to (e.g. if the document's Uri is a file Uri the truth now exists on disk). As with the open notification the close notification is about managing the document's content. Receiving a close notification doesn't mean that the document was open in an editor before. A close notification requires a previous open notification to be sent. Note that a server's ability to fulfill requests is independent of whether a text document is open or closed. +The document close notification is sent from the client to the server when the document got closed in the client. The document's master now exists where the document's Uri points to (e.g. if the document's Uri is a file Uri the master now exists on disk). As with the open notification the close notification is about managing the document's content. Receiving a close notification doesn't mean that the document was open in an editor before. A close notification requires a previous open notification to be sent. Note that a server's ability to fulfill requests is independent of whether a text document is open or closed. + +_Client Capability_: +See general synchronization [client capabilities](#textDocument_synchronization_cc). + +_Server Capability_: +See general synchronization [server capabilities](#textDocument_synchronization_sc). + +_Registration Options_: `TextDocumentRegistrationOptions` _Notification_: * method: 'textDocument/didClose' @@ -2776,8 +2953,84 @@ interface DidCloseTextDocumentParams { } ``` -_Registration Options_: `TextDocumentRegistrationOptions` +The final structure of the `TextDocumentSyncClientCapabilities` and the `TextDocumentSyncOptions` server options look like this +```typescript +export interface TextDocumentSyncClientCapabilities { + /** + * Whether text document synchronization supports dynamic registration. + */ + dynamicRegistration?: boolean; + + /** + * The client supports sending will save notifications. + */ + willSave?: boolean; + + /** + * The client supports sending a will save request and + * waits for a response providing text edits which will + * be applied to the document before it is saved. + */ + willSaveWaitUntil?: boolean; + + /** + * The client supports did save notifications. + */ + didSave?: boolean; +} + +/** + * Defines how the host (editor) should sync document changes to the language server. + */ +export namespace TextDocumentSyncKind { + /** + * Documents should not be synced at all. + */ + export const None = 0; + + /** + * Documents are synced by always sending the full content + * of the document. + */ + export const Full = 1; + + /** + * Documents are synced by sending the full content on open. + * After that only incremental updates to the document are + * send. + */ + export const Incremental = 2; +} + +export interface TextDocumentSyncOptions { + /** + * Open and close notifications are sent to the server. If omitted open close notification should not + * be sent. + */ + openClose?: boolean; + /** + * Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full + * and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None. + */ + change?: number; + /** + * If present will save notifications are sent to the server. If omitted the notification should not be + * sent. + */ + willSave?: boolean; + /** + * If present will save wait until requests are sent to the server. If omitted the request should not be + * sent. + */ + willSaveWaitUntil?: boolean; + /** + * If present save notifications are sent to the server. If omitted the notification should not be + * sent. + */ + save?: boolean | SaveOptions; +} +``` #### PublishDiagnostics Notification (:arrow_left:) @@ -2790,6 +3043,42 @@ Diagnostics are "owned" by the server so it is the server's responsibility to cl When a file changes it is the server's responsibility to re-compute diagnostics and push them to the client. If the computed set is empty it has to push the empty array to clear former diagnostics. Newly pushed diagnostics always replace previously pushed diagnostics. There is no merging that happens on the client side. +See also the [Diagnostic](#diagnostic) section. + +_Client Capability_: +* property name (optional): `textDocument.publishDiagnostics` +* property type `PublishDiagnosticsClientCapabilities` defined as follows: + +```typescript +export interface PublishDiagnosticsClientCapabilities { + /** + * Whether the clients accepts diagnostics with related information. + */ + relatedInformation?: boolean; + + /** + * Client supports the tag property to provide meta data about a diagnostic. + * Clients supporting tags have to handle unknown tags gracefully. + * + * @since 3.15.0 + */ + tagSupport?: { + /** + * The tags supported by the client. + */ + valueSet: DiagnosticTag[]; + }; + + /** + * Whether the client interprets the version property of the + * `textDocument/publishDiagnostics` notification's parameter. + * + * @since 3.15.0 + */ + versionSupport?: boolean; +} +``` + _Notification_: * method: 'textDocument/publishDiagnostics' * params: `PublishDiagnosticsParams` defined as follows: @@ -2801,6 +3090,13 @@ interface PublishDiagnosticsParams { */ uri: DocumentUri; + /** + * Optional the version number of the document the diagnostics are published for. + * + * @since 3.15.0 + */ + version?: number; + /** * An array of diagnostic information items. */ @@ -2810,15 +3106,146 @@ interface PublishDiagnosticsParams { #### Completion Request (:leftwards_arrow_with_hook:) -The Completion request is sent from the client to the server to compute completion items at a given cursor position. Completion items are presented in the [IntelliSense](https://code.visualstudio.com/docs/editor/editingevolved#_intellisense) user interface. If computing full completion items is expensive, servers can additionally provide a handler for the completion item resolve request ('completionItem/resolve'). This request is sent when a completion item is selected in the user interface. A typical use case is for example: the 'textDocument/completion' request doesn't fill in the `documentation` property for returned completion items since it is expensive to compute. When the item is selected in the user interface then a 'completionItem/resolve' request is sent with the selected completion item as a parameter. The returned completion item should have the documentation property filled in. The request can delay the computation of the `detail` and `documentation` properties. However, properties that are needed for the initial sorting and filtering, like `sortText`, `filterText`, `insertText`, and `textEdit` must be provided in the `textDocument/completion` response and must not be changed during resolve. +The Completion request is sent from the client to the server to compute completion items at a given cursor position. Completion items are presented in the [IntelliSense](https://code.visualstudio.com/docs/editor/editingevolved#_intellisense) user interface. If computing full completion items is expensive, servers can additionally provide a handler for the completion item resolve request ('completionItem/resolve'). This request is sent when a completion item is selected in the user interface. A typical use case is for example: the 'textDocument/completion' request doesn't fill in the `documentation` property for returned completion items since it is expensive to compute. When the item is selected in the user interface then a 'completionItem/resolve' request is sent with the selected completion item as a parameter. The returned completion item should have the documentation property filled in. The request can only delay the computation of the `detail` and `documentation` properties. Other properties like `sortText`, `filterText`, `insertText`, `textEdit` and `additionalTextEdits` must be provided in the `textDocument/completion` response and must not be changed during resolve. + +_Client Capability_: +* property name (optional): `textDocument.completion` +* property type: `CompletionClientCapabilities` defined as follows: + +```typescript +export interface CompletionClientCapabilities { + /** + * Whether completion supports dynamic registration. + */ + dynamicRegistration?: boolean; + + /** + * The client supports the following `CompletionItem` specific + * capabilities. + */ + completionItem?: { + /** + * Client supports snippets as insert text. + * + * A snippet can define tab stops and placeholders with `$1`, `$2` + * and `${3:foo}`. `$0` defines the final tab stop, it defaults to + * the end of the snippet. Placeholders with equal identifiers are linked, + * that is typing in one will update others too. + */ + snippetSupport?: boolean; + + /** + * Client supports commit characters on a completion item. + */ + commitCharactersSupport?: boolean + + /** + * Client supports the follow content formats for the documentation + * property. The order describes the preferred format of the client. + */ + documentationFormat?: MarkupKind[]; + + /** + * Client supports the deprecated property on a completion item. + */ + deprecatedSupport?: boolean; + + /** + * Client supports the preselect property on a completion item. + */ + preselectSupport?: boolean; + + /** + * Client supports the tag property on a completion item. Clients supporting + * tags have to handle unknown tags gracefully. Clients especially need to + * preserve unknown tags when sending a completion item back to the server in + * a resolve call. + * + * @since 3.15.0 + */ + tagSupport?: { + /** + * The tags supported by the client. + */ + valueSet: CompletionItemTag[] + } + }; + + completionItemKind?: { + /** + * The completion item kind values the client supports. When this + * property exists the client also guarantees that it will + * handle values outside its set gracefully and falls back + * to a default value when unknown. + * + * If this property is not present the client only supports + * the completion items kinds from `Text` to `Reference` as defined in + * the initial version of the protocol. + */ + valueSet?: CompletionItemKind[]; + }; + + /** + * The client supports to send additional context information for a + * `textDocument/completion` request. + */ + contextSupport?: boolean; +} +``` + +_Server Capability_: +* property name (optional): `completionProvider` +* property type: `CompletionOptions` defined as follows: + +```typescript +/** + * Completion options. + */ +export interface CompletionOptions extends WorkDoneProgressOptions { + /** + * Most tools trigger completion request automatically without explicitly requesting + * it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user + * starts to type an identifier. For example if the user types `c` in a JavaScript file + * code complete will automatically pop up present `console` besides others as a + * completion item. Characters that make up identifiers don't need to be listed here. + * + * If code complete should automatically be trigger on characters not being valid inside + * an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. + */ + triggerCharacters?: string[]; + + /** + * The list of all possible characters that commit a completion. This field can be used + * if clients don't support individual commit characters per completion item. See + * `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport`. + * + * If a server provides both `allCommitCharacters` and commit characters on an individual + * completion item the ones on the completion item win. + * + * @since 3.2.0 + */ + allCommitCharacters?: string[]; + + /** + * The server provides support to resolve additional + * information for a completion item. + */ + resolveProvider?: boolean; +} +``` + +_Registration Options_: `CompletionRegistrationOptions` options defined as follows: +```typescript +export interface CompletionRegistrationOptions extends TextDocumentRegistrationOptions, CompletionOptions { +} +``` _Request_: * method: 'textDocument/completion' * params: `CompletionParams` defined as follows: ```typescript -export interface CompletionParams extends TextDocumentPositionParams { - +export interface CompletionParams extends TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams { /** * The completion context. This is only available if the client specifies * to send this using `ClientCapabilities.textDocument.completion.contextSupport === true` @@ -2875,7 +3302,7 @@ _Response_: * Represents a collection of [completion items](#CompletionItem) to be presented * in the editor. */ -interface CompletionList { +export interface CompletionList { /** * This list it not complete. Further typing should result in recomputing * this list. @@ -2892,7 +3319,7 @@ interface CompletionList { * Defines whether the insert text in a completion item should be interpreted as * plain text or a snippet. */ -namespace InsertTextFormat { +export namespace InsertTextFormat { /** * The primary text to be inserted is treated as a plain string. */ @@ -2909,9 +3336,24 @@ namespace InsertTextFormat { export const Snippet = 2; } -type InsertTextFormat = 1 | 2; +export type InsertTextFormat = 1 | 2; -interface CompletionItem { +/** + * Completion item tags are extra annotations that tweak the rendering of a completion + * item. + * + * @since 3.15.0 + */ +export namespace CompletionItemTag { + /** + * Render a completion as obsolete, usually using a strike-out. + */ + export const Deprecated = 1; +} + +export type CompletionItemTag = 1; + +export interface CompletionItem { /** * The label of this completion item. By default * also the text that is inserted when selecting @@ -2926,6 +3368,13 @@ interface CompletionItem { */ kind?: number; + /** + * Tags for this completion item. + * + * @since 3.15.0 + */ + tags?: CompletionItemTag[]; + /** * A human-readable string with additional information * about this item, like type or symbol information. @@ -2939,6 +3388,8 @@ interface CompletionItem { /** * Indicates if this item is deprecated. + * + * @deprecated Use `tags` instead if supported. */ deprecated?: boolean; @@ -2978,7 +3429,7 @@ interface CompletionItem { /** * The format of the insert text. The format applies to both the `insertText` property - * and the `newText` property of a provided `textEdit`. If ommitted defaults to + * and the `newText` property of a provided `textEdit`. If omitted defaults to * `InsertTextFormat.PlainText`. */ insertTextFormat?: InsertTextFormat; @@ -3027,7 +3478,7 @@ interface CompletionItem { /** * The kind of a completion entry. */ -namespace CompletionItemKind { +export namespace CompletionItemKind { export const Text = 1; export const Method = 2; export const Function = 3; @@ -3055,47 +3506,12 @@ namespace CompletionItemKind { export const TypeParameter = 25; } ``` +* partial result: `CompletionItem[]` or `CompletionList` followed by `CompletionItem[]`. If the first provided result item is of type `CompletionList` subsequent partial results of `CompletionItem[]` add to the `items` property of the `CompletionList`. * error: code and message set in case an exception happens during the completion request. -_Registration Options_: `CompletionRegistrationOptions` options defined as follows: - -```typescript -export interface CompletionRegistrationOptions extends TextDocumentRegistrationOptions { - /** - * Most tools trigger completion request automatically without explicitly requesting - * it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user - * starts to type an identifier. For example if the user types `c` in a JavaScript file - * code complete will automatically pop up present `console` besides others as a - * completion item. Characters that make up identifiers don't need to be listed here. - * - * If code complete should automatically be trigger on characters not being valid inside - * an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. - */ - triggerCharacters?: string[]; - - /** - * The list of all possible characters that commit a completion. This field can be used - * if clients don't support individual commmit characters per completion item. See - * `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport`. - * - * If a server provides both `allCommitCharacters` and commit characters on an individual - * completion item the ones on the completion item win. - * - * Since 3.2.0 - */ - allCommitCharacters?: string[]; - - /** - * The server provides support to resolve additional - * information for a completion item. - */ - resolveProvider?: boolean; -} -``` - Completion items support snippets (see `InsertTextFormat.Snippet`). The snippet format is as follows: -##### Snippet Syntax +##### Snippet Syntax The `body` of a snippet can use special constructs to control cursors and the text being inserted. The following are supported features and their syntaxes: @@ -3191,9 +3607,48 @@ _Response_: The hover request is sent from the client to the server to request hover information at a given text document position. +_Client Capability_: +* property name (optional): `textDocument.hover` +* property type: `HoverClientCapabilities` defined as follows: + +```typescript +export interface HoverClientCapabilities { + /** + * Whether hover supports dynamic registration. + */ + dynamicRegistration?: boolean; + + /** + * Client supports the follow content formats for the content + * property. The order describes the preferred format of the client. + */ + contentFormat?: MarkupKind[]; +} +``` + +_Server Capability_: +* property name (optional): `hoverProvider` +* property type: `boolean | HoverOptions` where `HoverOptions` is defined as follows: + +```typescript +export interface HoverOptions extends WorkDoneProgressOptions { +} +``` + +_Registration Options_: `HoverRegistrationOptions` defined as follows: +```typescript +export interface HoverRegistrationOptions extends TextDocumentRegistrationOptions, HoverOptions { +} +``` + _Request_: * method: 'textDocument/hover' -* params: [`TextDocumentPositionParams`](#textdocumentpositionparams) +* params: `HoverParams` defined as follows: + +```typescript +export interface HoverParams extends TextDocumentPositionParams, WorkDoneProgressParams { +} +``` _Response_: * result: `Hover` \| `null` defined as follows: @@ -3202,7 +3657,7 @@ _Response_: /** * The result of a hover request. */ -interface Hover { +export interface Hover { /** * The hover's content */ @@ -3238,15 +3693,159 @@ type MarkedString = string | { language: string; value: string }; * error: code and message set in case an exception happens during the hover request. -_Registration Options_: `TextDocumentRegistrationOptions` - #### Signature Help Request (:leftwards_arrow_with_hook:) The signature help request is sent from the client to the server to request signature information at a given cursor position. +_Client Capability_: +* property name (optional): `textDocument.signatureHelp` +* property type: `SignatureHelpClientCapabilities` defined as follows: + +```typescript +export interface SignatureHelpClientCapabilities { + /** + * Whether signature help supports dynamic registration. + */ + dynamicRegistration?: boolean; + + /** + * The client supports the following `SignatureInformation` + * specific properties. + */ + signatureInformation?: { + /** + * Client supports the follow content formats for the documentation + * property. The order describes the preferred format of the client. + */ + documentationFormat?: MarkupKind[]; + + /** + * Client capabilities specific to parameter information. + */ + parameterInformation?: { + /** + * The client supports processing label offsets instead of a + * simple label string. + * + * @since 3.14.0 + */ + labelOffsetSupport?: boolean; + }; + }; + + /** + * The client supports to send additional context information for a + * `textDocument/signatureHelp` request. A client that opts into + * contextSupport will also support the `retriggerCharacters` on + * `SignatureHelpOptions`. + * + * @since 3.15.0 + */ + contextSupport?: boolean; +} +``` + +_Server Capability_: +* property name (optional): `signatureHelpProvider` +* property type: `SignatureHelpOptions` defined as follows: + +```typescript +export interface SignatureHelpOptions extends WorkDoneProgressOptions { + /** + * The characters that trigger signature help + * automatically. + */ + triggerCharacters?: string[]; + + /** + * List of characters that re-trigger signature help. + * + * These trigger characters are only active when signature help is already showing. All trigger characters + * are also counted as re-trigger characters. + * + * @since 3.15.0 + */ + retriggerCharacters?: string[]; +} +``` + +_Registration Options_: `SignatureHelpRegistrationOptions` defined as follows: +```typescript +export interface SignatureHelpRegistrationOptions extends TextDocumentRegistrationOptions, SignatureHelpOptions { +} +``` + _Request_: * method: 'textDocument/signatureHelp' -* params: [`TextDocumentPositionParams`](#textdocumentpositionparams) +* params: `SignatureHelpParams` defined as follows: + +```typescript +export interface SignatureHelpParams extends TextDocumentPositionParams, WorkDoneProgressParams { + /** + * The signature help context. This is only available if the client specifies + * to send this using the client capability `textDocument.signatureHelp.contextSupport === true` + * + * @since 3.15.0 + */ + context?: SignatureHelpContext; +} + +/** + * How a signature help was triggered. + * + * @since 3.15.0 + */ +export namespace SignatureHelpTriggerKind { + /** + * Signature help was invoked manually by the user or by a command. + */ + export const Invoked: 1 = 1; + /** + * Signature help was triggered by a trigger character. + */ + export const TriggerCharacter: 2 = 2; + /** + * Signature help was triggered by the cursor moving or by the document content changing. + */ + export const ContentChange: 3 = 3; +} +export type SignatureHelpTriggerKind = 1 | 2 | 3; + +/** + * Additional information about the context in which a signature help request was triggered. + * + * @since 3.15.0 + */ +export interface SignatureHelpContext { + /** + * Action that caused signature help to be triggered. + */ + triggerKind: SignatureHelpTriggerKind; + + /** + * Character that caused signature help to be triggered. + * + * This is undefined when `triggerKind !== SignatureHelpTriggerKind.TriggerCharacter` + */ + triggerCharacter?: string; + + /** + * `true` if signature help was already showing when it was triggered. + * + * Retriggers occur when the signature help is already active and can be caused by actions such as + * typing a trigger character, a cursor move, or document content changes. + */ + isRetrigger: boolean; + + /** + * The currently active `SignatureHelp`. + * + * The `activeSignatureHelp` has its `SignatureHelp.activeSignature` field updated based on + * the user navigating through available signatures. + */ + activeSignatureHelp?: SignatureHelp; +} +``` _Response_: * result: `SignatureHelp` \| `null` defined as follows: @@ -3257,18 +3856,21 @@ _Response_: * callable. There can be multiple signature but only one * active and only one active parameter. */ -interface SignatureHelp { +export interface SignatureHelp { /** - * One or more signatures. + * One or more signatures. If no signaures are availabe the signature help + * request should return `null`. */ signatures: SignatureInformation[]; /** * The active signature. If omitted or the value lies outside the - * range of `signatures` the value defaults to zero or is ignored if - * `signatures.length === 0`. Whenever possible implementors should - * make an active decision about the active signature and shouldn't - * rely on a default value. + * range of `signatures` the value defaults to zero or is ignore if + * the `SignatureHelp` as no signatures. + * + * Whenever possible implementors should make an active decision about + * the active signature and shouldn't rely on a default value. + * * In future version of the protocol this property might become * mandatory to better express this. */ @@ -3291,7 +3893,7 @@ interface SignatureHelp { * can have a label, like a function-name, a doc-comment, and * a set of parameters. */ -interface SignatureInformation { +export interface SignatureInformation { /** * The label of this signature. Will be shown in * the UI. @@ -3314,7 +3916,7 @@ interface SignatureInformation { * Represents a parameter of a callable-signature. A parameter can * have a label and a doc-comment. */ -interface ParameterInformation { +export interface ParameterInformation { /** * The label of this parameter information. @@ -3338,103 +3940,278 @@ interface ParameterInformation { * error: code and message set in case an exception happens during the signature help request. -_Registration Options_: `SignatureHelpRegistrationOptions` defined as follows: - -```typescript -export interface SignatureHelpRegistrationOptions extends TextDocumentRegistrationOptions { - /** - * The characters that trigger signature help - * automatically. - */ - triggerCharacters?: string[]; -} -``` #### Goto Declaration Request (:leftwards_arrow_with_hook:) > *Since version 3.14.0* The go to declaration request is sent from the client to the server to resolve the declaration location of a symbol at a given text document position. -The result type [`LocationLink`](#locationlink)[] got introduce with version 3.14.0 and depends in the corresponding client capability `clientCapabilities.textDocument.declaration.linkSupport`. +The result type [`LocationLink`](#locationLink)[] got introduced with version 3.14.0 and depends on the corresponding client capability `textDocument.declaration.linkSupport`. + +_Client Capability_: +* property name (optional): `textDocument.declaration` +* property type: `DeclarationClientCapabilities` defined as follows: + +```typescript +export interface DeclarationClientCapabilities { + /** + * Whether declaration supports dynamic registration. If this is set to `true` + * the client supports the new `DeclarationRegistrationOptions` return value + * for the corresponding server capability as well. + */ + dynamicRegistration?: boolean; + + /** + * The client supports additional metadata in the form of declaration links. + */ + linkSupport?: boolean; +} +``` + +_Server Capability_: +* property name (optional): `declarationProvider` +* property type: `boolean | DeclarationOptions | DeclarationRegistrationOptions` where `DeclarationOptions` is defined as follows: + +```typescript +export interface DeclarationOptions extends WorkDoneProgressOptions { +} +``` + +_Registration Options_: `DeclarationRegistrationOptions` defined as follows: +```typescript +export interface DeclarationRegistrationOptions extends DeclarationOptions, TextDocumentRegistrationOptions, StaticRegistrationOptions { +} +``` _Request_: * method: 'textDocument/declaration' -* params: [`TextDocumentPositionParams`](#textdocumentpositionparams) +* params: `DeclarationParams` defined as follows: + +```typescript +export interface DeclarationParams extends TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams { +} +``` _Response_: -* result: [`Location`](#location) \| [`Location`](#location)[] \| [`LocationLink`](#locationlink)[] \|`null` +* result: [`Location`](#location) \| [`Location`](#location)[] \| [`LocationLink`](#locationLink)[] \|`null` +* partial result: [`Location`](#location)[] \| [`LocationLink`](#locationLink)[] * error: code and message set in case an exception happens during the declaration request. -_Registration Options_: `TextDocumentRegistrationOptions` - #### Goto Definition Request (:leftwards_arrow_with_hook:) -> *Since version 3.14.0* - The go to definition request is sent from the client to the server to resolve the definition location of a symbol at a given text document position. -The result type [`LocationLink`](#locationlink)[] got introduce with version 3.14.0 and depends in the corresponding client capability `clientCapabilities.textDocument.definition.linkSupport`. +The result type [`LocationLink`](#locationLink)[] got introduced with version 3.14.0 and depends on the corresponding client capability `textDocument.definition.linkSupport`. + +_Client Capability_: +* property name (optional): `textDocument.definition` +* property type: `DefinitionClientCapabilities` defined as follows: + +```typescript +export interface DefinitionClientCapabilities { + /** + * Whether definition supports dynamic registration. + */ + dynamicRegistration?: boolean; + + /** + * The client supports additional metadata in the form of definition links. + * + * @since 3.14.0 + */ + linkSupport?: boolean; +} +``` + +_Server Capability_: +* property name (optional): `definitionProvider` +* property type: `boolean | DefinitionOptions` where `DefinitionOptions` is defined as follows: + +```typescript +export interface DefinitionOptions extends WorkDoneProgressOptions { +} +``` + +_Registration Options_: `DefinitionRegistrationOptions` defined as follows: +```typescript +export interface DefinitionRegistrationOptions extends TextDocumentRegistrationOptions, DefinitionOptions { +} +``` _Request_: * method: 'textDocument/definition' -* params: [`TextDocumentPositionParams`](#textdocumentpositionparams) +* params: `DefinitionParams` defined as follows: + +```typescript +export interface DefinitionParams extends TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams { +} +``` _Response_: -* result: [`Location`](#location) \| [`Location`](#location)[] \| [`LocationLink`](#locationlink)[] \| `null` +* result: [`Location`](#location) \| [`Location`](#location)[] \| [`LocationLink`](#locationLink)[] \| `null` +* partial result: [`Location`](#location)[] \| [`LocationLink`](#locationLink)[] * error: code and message set in case an exception happens during the definition request. -_Registration Options_: `TextDocumentRegistrationOptions` - #### Goto Type Definition Request (:leftwards_arrow_with_hook:) > *Since version 3.6.0* The go to type definition request is sent from the client to the server to resolve the type definition location of a symbol at a given text document position. -The result type [`LocationLink`](#locationlink)[] got introduce with version 3.14.0 and depends in the corresponding client capability `clientCapabilities.textDocument.typeDefinition.linkSupport`. +The result type [`LocationLink`](#locationLink)[] got introduced with version 3.14.0 and depends on the corresponding client capability `textDocument.typeDefinition.linkSupport`. + +_Client Capability_: +* property name (optional): `textDocument.typeDefinition` +* property type: `TypeDefinitionClientCapabilities` defined as follows: + +```typescript +export interface TypeDefinitionClientCapabilities { + /** + * Whether implementation supports dynamic registration. If this is set to `true` + * the client supports the new `TypeDefinitionRegistrationOptions` return value + * for the corresponding server capability as well. + */ + dynamicRegistration?: boolean; + + /** + * The client supports additional metadata in the form of definition links. + * + * @since 3.14.0 + */ + linkSupport?: boolean; +} +``` + +_Server Capability_: +* property name (optional): `typeDefinitionProvider` +* property type: `boolean | TypeDefinitionOptions | TypeDefinitionRegistrationOptions` where `TypeDefinitionOptions` is defined as follows: + +```typescript +export interface TypeDefinitionOptions extends WorkDoneProgressOptions { +} +``` + +_Registration Options_: `TypeDefinitionRegistrationOptions` defined as follows: +```typescript +export interface TypeDefinitionRegistrationOptions extends TextDocumentRegistrationOptions, TypeDefinitionOptions, StaticRegistrationOptions { +} +``` _Request_: * method: 'textDocument/typeDefinition' -* params: [`TextDocumentPositionParams`](#textdocumentpositionparams) +* params: `TypeDefinitionParams` defined as follows: + +```typescript +export interface TypeDefinitionParams extends TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams { +} +``` _Response_: -* result: [`Location`](#location) \| [`Location`](#location)[] \| [`LocationLink`](#locationlink)[] \| `null` +* result: [`Location`](#location) \| [`Location`](#location)[] \| [`LocationLink`](#locationLink)[] \| `null` +* partial result: [`Location`](#location)[] \| [`LocationLink`](#locationLink)[] * error: code and message set in case an exception happens during the definition request. -_Registration Options_: `TextDocumentRegistrationOptions` - #### Goto Implementation Request (:leftwards_arrow_with_hook:) > *Since version 3.6.0* The go to implementation request is sent from the client to the server to resolve the implementation location of a symbol at a given text document position. -The result type [`LocationLink`](#locationlink)[] got introduce with version 3.14.0 and depends in the corresponding client capability `clientCapabilities.implementation.typeDefinition.linkSupport`. +The result type [`LocationLink`](#locationLink)[] got introduced with version 3.14.0 and depends on the corresponding client capability `textDocument.implementation.linkSupport`. + +_Client Capability_: +* property name (optional): `textDocument.implementation` +* property type: `ImplementationClientCapabilities` defined as follows: + +```typescript +export interface ImplementationClientCapabilities { + /** + * Whether implementation supports dynamic registration. If this is set to `true` + * the client supports the new `ImplementationRegistrationOptions` return value + * for the corresponding server capability as well. + */ + dynamicRegistration?: boolean; + + /** + * The client supports additional metadata in the form of definition links. + * + * @since 3.14.0 + */ + linkSupport?: boolean; +} +``` + +_Server Capability_: +* property name (optional): `implementationProvider` +* property type: `boolean | ImplementationOptions | ImplementationRegistrationOptions` where `ImplementationOptions` is defined as follows: + +```typescript +export interface ImplementationOptions extends WorkDoneProgressOptions { +} +``` + +_Registration Options_: `ImplementationRegistrationOptions` defined as follows: +```typescript +export interface ImplementationRegistrationOptions extends TextDocumentRegistrationOptions, ImplementationOptions, StaticRegistrationOptions { +} +``` _Request_: * method: 'textDocument/implementation' -* params: [`TextDocumentPositionParams`](#textdocumentpositionparams) +* params: `ImplementationParams` defined as follows: + +```typescript +export interface ImplementationParams extends TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams { +} +``` _Response_: -* result: [`Location`](#location) \| [`Location`](#location)[] \| [`LocationLink`](#locationlink)[] \| `null` +* result: [`Location`](#location) \| [`Location`](#location)[] \| [`LocationLink`](#locationLink)[] \| `null` +* partial result: [`Location`](#location)[] \| [`LocationLink`](#locationLink)[] * error: code and message set in case an exception happens during the definition request. -_Registration Options_: `TextDocumentRegistrationOptions` - #### Find References Request (:leftwards_arrow_with_hook:) The references request is sent from the client to the server to resolve project-wide references for the symbol denoted by the given text document position. +_Client Capability_: +* property name (optional): `textDocument.references` +* property type: `ReferenceClientCapabilities` defined as follows: + +```typescript +export interface ReferenceClientCapabilities { + /** + * Whether references supports dynamic registration. + */ + dynamicRegistration?: boolean; +} +``` + +_Server Capability_: +* property name (optional): `referencesProvider` +* property type: `boolean | ReferenceOptions` where `ReferenceOptions` is defined as follows: + +```typescript +export interface ReferenceOptions extends WorkDoneProgressOptions { +} +``` + +_Registration Options_: `ReferenceRegistrationOptions` defined as follows: +```typescript +export interface ReferenceRegistrationOptions extends TextDocumentRegistrationOptions, ReferenceOptions { +} +``` + _Request_: * method: 'textDocument/references' * params: `ReferenceParams` defined as follows: ```typescript -interface ReferenceParams extends TextDocumentPositionParams { +export interface ReferenceParams extends TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams { context: ReferenceContext } -interface ReferenceContext { +export interface ReferenceContext { /** * Include the declaration of the current symbol. */ @@ -3443,10 +4220,9 @@ interface ReferenceContext { ``` _Response_: * result: [`Location`](#location)[] \| `null` +* partial result: [`Location`](#location)[] * error: code and message set in case an exception happens during the reference request. -_Registration Options_: `TextDocumentRegistrationOptions` - #### Document Highlights Request (:leftwards_arrow_with_hook:) The document highlight request is sent from the client to the server to resolve a document highlights for a given text document position. @@ -3454,9 +4230,42 @@ For programming languages this usually highlights all references to the symbol s and 'textDocument/references' separate requests since the first one is allowed to be more fuzzy. Symbol matches usually have a `DocumentHighlightKind` of `Read` or `Write` whereas fuzzy or textual matches use `Text`as the kind. +_Client Capability_: +* property name (optional): `textDocument.documentHighlight` +* property type: `DocumentHighlightClientCapabilities` defined as follows: + +```typescript +export interface DocumentHighlightClientCapabilities { + /** + * Whether document highlight supports dynamic registration. + */ + dynamicRegistration?: boolean; +} +``` + +_Server Capability_: +* property name (optional): `documentHighlightProvider` +* property type: `boolean | DocumentHighlightOptions` where `DocumentHighlightOptions` is defined as follows: + +```typescript +export interface DocumentHighlightOptions extends WorkDoneProgressOptions { +} +``` + +_Registration Options_: `DocumentHighlightRegistrationOptions` defined as follows: +```typescript +export interface DocumentHighlightRegistrationOptions extends TextDocumentRegistrationOptions, DocumentHighlightOptions { +} +``` + _Request_: * method: 'textDocument/documentHighlight' -* params: [`TextDocumentPositionParams`](#textdocumentpositionparams) +* params: `DocumentHighlightParams` defined as follows: + +```typescript +export interface DocumentHighlightParams extends TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams { +} +``` _Response_: * result: `DocumentHighlight[]` \| `null` defined as follows: @@ -3468,7 +4277,7 @@ _Response_: * the background color of its range. * */ -interface DocumentHighlight { +export interface DocumentHighlight { /** * The range this highlight applies to. */ @@ -3501,10 +4310,9 @@ export namespace DocumentHighlightKind { } ``` +* partial result: `DocumentHighlight[]` * error: code and message set in case an exception happens during the document highlight request. -_Registration Options_: `TextDocumentRegistrationOptions` - #### Document Symbols Request (:leftwards_arrow_with_hook:) The document symbol request is sent from the client to the server. The returned result is either @@ -3512,12 +4320,62 @@ The document symbol request is sent from the client to the server. The returned - `SymbolInformation[]` which is a flat list of all symbols found in a given text document. Then neither the symbol's location range nor the symbol's container name should be used to infer a hierarchy. - `DocumentSymbol[]` which is a hierarchy of symbols found in a given text document. +_Client Capability_: +* property name (optional): `textDocument.documentSymbol` +* property type: `DocumentSymbolClientCapabilities` defined as follows: + +```typescript +export interface DocumentSymbolClientCapabilities { + /** + * Whether document symbol supports dynamic registration. + */ + dynamicRegistration?: boolean; + + /** + * Specific capabilities for the `SymbolKind` in the `textDocument/documentSymbol` request. + */ + symbolKind?: { + /** + * The symbol kind values the client supports. When this + * property exists the client also guarantees that it will + * handle values outside its set gracefully and falls back + * to a default value when unknown. + * + * If this property is not present the client only supports + * the symbol kinds from `File` to `Array` as defined in + * the initial version of the protocol. + */ + valueSet?: SymbolKind[]; + } + + /** + * The client supports hierarchical document symbols. + */ + hierarchicalDocumentSymbolSupport?: boolean; +} +``` + +_Server Capability_: +* property name (optional): `documentSymbolProvider` +* property type: `boolean | DocumentSymbolOptions` where `DocumentSymbolOptions` is defined as follows: + +```typescript +export interface DocumentSymbolOptions extends WorkDoneProgressOptions { +} +``` + +_Registration Options_: `DocumentSymbolRegistrationOptions` defined as follows: +```typescript +export interface DocumentSymbolRegistrationOptions extends TextDocumentRegistrationOptions, DocumentSymbolOptions { +} +``` + _Request_: * method: 'textDocument/documentSymbol' * params: `DocumentSymbolParams` defined as follows: ```typescript -interface DocumentSymbolParams { +export interface DocumentSymbolParams extends WorkDoneProgressParams, PartialResultParams { /** * The text document. */ @@ -3566,7 +4424,7 @@ export namespace SymbolKind { * hierarchical and they have two ranges: one that encloses its definition and one that points to its most interesting range, * e.g. the range of an identifier. */ -export class DocumentSymbol { +export interface DocumentSymbol { /** * The name of this symbol. Will be displayed in the user interface and therefore must not be @@ -3612,7 +4470,7 @@ export class DocumentSymbol { * Represents information about programming constructs like variables, classes, * interfaces etc. */ -interface SymbolInformation { +export interface SymbolInformation { /** * The name of this symbol. */ @@ -3621,7 +4479,7 @@ interface SymbolInformation { /** * The kind of this symbol. */ - kind: number; + kind: SymbolKind; /** * Indicates if this symbol is deprecated. @@ -3649,13 +4507,11 @@ interface SymbolInformation { */ containerName?: string; } - ``` +* partial result: `DocumentSymbol[]` \| `SymbolInformation[]`. `DocumentSymbol[]` and `SymbolInformation[]` can not be mixed. That means the first chunk defines the type of all the other chunks. * error: code and message set in case an exception happens during the document symbol request. -_Registration Options_: `TextDocumentRegistrationOptions` - #### Code Action Request (:leftwards_arrow_with_hook:) The code action request is sent from the client to the server to compute commands for a given text document and range. These commands are typically code fixes to either fix problems or to beautify/refactor code. The result of a `textDocument/codeAction` request is an array of `Command` literals which are typically presented in the user interface. To ensure that a server is useful in many clients the commands specified in a code actions should be handled by the server and not by the client (see `workspace/executeCommand` and `ServerCapabilities.executeCommandProvider`). If the client supports providing edits with a code action then the mode should be used. @@ -3667,7 +4523,71 @@ When the command is selected the server should be contacted again (via the `work - the ability to directly return a workspace edit from the code action request. This avoids having another server roundtrip to execute an actual code action. However server providers should be aware that if the code action is expensive to compute or the edits are huge it might still be beneficial if the result is simply a command and the actual edit is only computed when needed. - the ability to group code actions using a kind. Clients are allowed to ignore that information. However it allows them to better group code action for example into corresponding menus (e.g. all refactor code actions into a refactor menu). -Clients need to announce their support for code action literals and code action kinds via the corresponding client capability `textDocument.codeAction.codeActionLiteralSupport`. +Clients need to announce their support for code action literals (e.g. literals of type `CodeAction`) and code action kinds via the corresponding client capability `codeAction.codeActionLiteralSupport`. + +_Client Capability_: +* property name (optional): `textDocument.codeAction` +* property type: `CodeActionClientCapabilities` defined as follows: + +```typescript +export interface CodeActionClientCapabilities { + /** + * Whether code action supports dynamic registration. + */ + dynamicRegistration?: boolean; + + /** + * The client supports code action literals as a valid + * response of the `textDocument/codeAction` request. + * + * @since 3.8.0 + */ + codeActionLiteralSupport?: { + /** + * The code action kind is supported with the following value + * set. + */ + codeActionKind: { + + /** + * The code action kind values the client supports. When this + * property exists the client also guarantees that it will + * handle values outside its set gracefully and falls back + * to a default value when unknown. + */ + valueSet: CodeActionKind[]; + }; + }; + + /** + * Whether code action supports the `isPreferred` property. + * @since 3.15.0 + */ + isPreferredSupport?: boolean; +} +``` + +_Server Capability_: +* property name (optional): `codeActionProvider` +* property type: `boolean | CodeActionOptions` where `CodeActionOptions` is defined as follows: + +```typescript +export interface CodeActionOptions extends 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. + */ + codeActionKinds?: CodeActionKind[]; +} +``` + +_Registration Options_: `CodeActionRegistrationOptions` defined as follows: +```typescript +export interface CodeActionRegistrationOptions extends TextDocumentRegistrationOptions, CodeActionOptions { +} +``` _Request_: * method: 'textDocument/codeAction' @@ -3677,7 +4597,7 @@ _Request_: /** * Params for the CodeActionRequest */ -interface CodeActionParams { +export interface CodeActionParams extends WorkDoneProgressParams, PartialResultParams { /** * The document in which the command was invoked. */ @@ -3705,7 +4625,7 @@ interface CodeActionParams { export type CodeActionKind = string; /** - * A set of predefined code action kinds + * A set of predefined code action kinds. */ export namespace CodeActionKind { @@ -3715,17 +4635,17 @@ export namespace CodeActionKind { export const Empty: CodeActionKind = ''; /** - * Base kind for quickfix actions: 'quickfix' + * Base kind for quickfix actions: 'quickfix'. */ export const QuickFix: CodeActionKind = 'quickfix'; /** - * Base kind for refactoring actions: 'refactor' + * Base kind for refactoring actions: 'refactor'. */ export const Refactor: CodeActionKind = 'refactor'; /** - * Base kind for refactoring extraction actions: 'refactor.extract' + * Base kind for refactoring extraction actions: 'refactor.extract'. * * Example extract actions: * @@ -3738,7 +4658,7 @@ export namespace CodeActionKind { export const RefactorExtract: CodeActionKind = 'refactor.extract'; /** - * Base kind for refactoring inline actions: 'refactor.inline' + * Base kind for refactoring inline actions: 'refactor.inline'. * * Example inline actions: * @@ -3750,7 +4670,7 @@ export namespace CodeActionKind { export const RefactorInline: CodeActionKind = 'refactor.inline'; /** - * Base kind for refactoring rewrite actions: 'refactor.rewrite' + * Base kind for refactoring rewrite actions: 'refactor.rewrite'. * * Example rewrite actions: * @@ -3764,14 +4684,14 @@ export namespace CodeActionKind { export const RefactorRewrite: CodeActionKind = 'refactor.rewrite'; /** - * Base kind for source actions: `source` + * Base kind for source actions: `source`. * * Source code actions apply to the entire file. */ export const Source: CodeActionKind = 'source'; /** - * Base kind for an organize imports source action: `source.organizeImports` + * Base kind for an organize imports source action: `source.organizeImports`. */ export const SourceOrganizeImports: CodeActionKind = 'source.organizeImports'; } @@ -3780,9 +4700,13 @@ export namespace CodeActionKind { * Contains additional diagnostic information about the context in which * a code action is run. */ -interface CodeActionContext { +export interface CodeActionContext { /** - * An array of diagnostics. + * An array of diagnostics known on the client side overlapping the range provided to the + * `textDocument/codeAction` request. They are provided so that the server knows which + * errors are currently presented to the user for the given range. There is no guarantee + * that these accurately reflect the error state of the resource. The primary parameter + * to compute code actions is the provided range. */ diagnostics: Diagnostic[]; @@ -3825,6 +4749,17 @@ export interface CodeAction { */ diagnostics?: Diagnostic[]; + /** + * Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted + * by keybindings. + * + * A quick fix should be marked preferred if it properly addresses the underlying error. + * A refactoring should be marked preferred if it is the most reasonable choice of actions to take. + * + * @since 3.15.0 + */ + isPreferred?: boolean; + /** * The workspace edit this code action performs. */ @@ -3838,27 +4773,51 @@ export interface CodeAction { command?: Command; } ``` - +* partial result: `(Command | CodeAction)[]` * error: code and message set in case an exception happens during the code action request. -_Registration Options_: `CodeActionRegistrationOptions` defined as follows: - -```typescript -export interface CodeActionRegistrationOptions extends TextDocumentRegistrationOptions, CodeActionOptions { -} -``` - - #### Code Lens Request (:leftwards_arrow_with_hook:) The code lens request is sent from the client to the server to compute code lenses for a given text document. +_Client Capability_: +* property name (optional): `textDocument.codeLens` +* property type: `CodeLensClientCapabilities` defined as follows: + +```typescript +export interface CodeLensClientCapabilities { + /** + * Whether code lens supports dynamic registration. + */ + dynamicRegistration?: boolean; +} +``` + +_Server Capability_: +* property name (optional): `codeLensProvider` +* property type: `CodeLensOptions` defined as follows: + +```typescript +export interface CodeLensOptions extends WorkDoneProgressOptions { + /** + * Code lens has a resolve provider as well. + */ + resolveProvider?: boolean; +} +``` + +_Registration Options_: `CodeLensRegistrationOptions` defined as follows: +```typescript +export interface CodeLensRegistrationOptions extends TextDocumentRegistrationOptions, CodeLensOptions { +} +``` + _Request_: * method: 'textDocument/codeLens' * params: `CodeLensParams` defined as follows: ```typescript -interface CodeLensParams { +interface CodeLensParams extends WorkDoneProgressParams, PartialResultParams { /** * The document to request code lens for. */ @@ -3895,19 +4854,9 @@ interface CodeLens { data?: any } ``` +* partial result: `CodeLens[]` * error: code and message set in case an exception happens during the code lens request. -_Registration Options_: `CodeLensRegistrationOptions` defined as follows: - -```typescript -export interface CodeLensRegistrationOptions extends TextDocumentRegistrationOptions { - /** - * Code lens has a resolve provider as well. - */ - resolveProvider?: boolean; -} -``` - #### Code Lens Resolve Request (:leftwards_arrow_with_hook:) The code lens resolve request is sent from the client to the server to resolve the command for a given code lens item. @@ -3924,12 +4873,51 @@ _Response_: The document links request is sent from the client to the server to request the location of links in a document. -_Request_: -* method: 'textDocument/documentLink' -* params: `DocumentLinkParams`, defined as follows: +_Client Capability_: +* property name (optional): `textDocument.documentLink` +* property type: `DocumentLinkClientCapabilities` defined as follows: ```typescript -interface DocumentLinkParams { +export interface DocumentLinkClientCapabilities { + /** + * Whether document link supports dynamic registration. + */ + dynamicRegistration?: boolean; + + /** + * Whether the client supports the `tooltip` property on `DocumentLink`. + * + * @since 3.15.0 + */ + tooltipSupport?: boolean; +} +``` + +_Server Capability_: +* property name (optional): `documentLinkProvider` +* property type: `DocumentLinkOptions` defined as follows: + +```typescript +export interface DocumentLinkOptions extends WorkDoneProgressOptions { + /** + * Document links have a resolve provider as well. + */ + resolveProvider?: boolean; +} +``` + +_Registration Options_: `DocumentLinkRegistrationOptions` defined as follows: +```typescript +export interface DocumentLinkRegistrationOptions extends TextDocumentRegistrationOptions, DocumentLinkOptions { +} +``` + +_Request_: +* method: 'textDocument/documentLink' +* params: `DocumentLinkParams` defined as follows: + +```typescript +interface DocumentLinkParams extends WorkDoneProgressParams, PartialResultParams { /** * The document to provide document links for. */ @@ -3938,7 +4926,7 @@ interface DocumentLinkParams { ``` _Response_: -* result: An array of `DocumentLink` \| `null`. +* result: `DocumentLink[]` \| `null`. ```typescript /** @@ -3950,10 +4938,23 @@ interface DocumentLink { * The range this link applies to. */ range: Range; + /** * The uri this link points to. If missing a resolve request is sent later. */ target?: DocumentUri; + + /** + * The tooltip text when you hover over this link. + * + * If a tooltip is provided, is will be displayed in a string that includes instructions on how to + * trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS, + * user settings, and localization. + * + * @since 3.15.0 + */ + tooltip?: string; + /** * A data entry field that is preserved on a document link between a * DocumentLinkRequest and a DocumentLinkResolveRequest. @@ -3961,19 +4962,9 @@ interface DocumentLink { data?: any; } ``` +* partial result: `DocumentLink[]` * error: code and message set in case an exception happens during the document link request. -_Registration Options_: `DocumentLinkRegistrationOptions` defined as follows: - -```typescript -export interface DocumentLinkRegistrationOptions extends TextDocumentRegistrationOptions { - /** - * Document links have a resolve provider as well. - */ - resolveProvider?: boolean; -} -``` - #### Document Link Resolve Request (:leftwards_arrow_with_hook:) The document link resolve request is sent from the client to the server to resolve the target of a given document link. @@ -3996,13 +4987,41 @@ Clients can use the result to decorate color references in an editor. For exampl - Color boxes showing the actual color next to the reference - Show a color picker when a color reference is edited +_Client Capability_: +* property name (optional): `textDocument.colorProvider` +* property type: `DocumentColorClientCapabilities` defined as follows: + +```typescript +export interface DocumentColorClientCapabilities { + /** + * Whether document color supports dynamic registration. + */ + dynamicRegistration?: boolean; +} +``` + +_Server Capability_: +* property name (optional): `colorProvider` +* property type: `boolean | DocumentColorOptions | DocumentColorRegistrationOptions` where `DocumentColorOptions` is defined as follows: + +```typescript +export interface DocumentColorOptions extends WorkDoneProgressOptions { +} +``` + +_Registration Options_: `DocumentColorRegistrationOptions` defined as follows: +```typescript +export interface DocumentColorRegistrationOptions extends TextDocumentRegistrationOptions, StaticRegistrationOptions, DocumentColorOptions { +} +``` + _Request_: * method: 'textDocument/documentColor' * params: `DocumentColorParams` defined as follows -```ts -interface DocumentColorParams { +```typescript +interface DocumentColorParams extends WorkDoneProgressParams, PartialResultParams { /** * The text document. */ @@ -4052,6 +5071,7 @@ interface Color { readonly alpha: number; } ``` +* partial result: `ColorInformation[]` * error: code and message set in case an exception happens during the 'textDocument/documentColor' request #### Color Presentation Request (:leftwards_arrow_with_hook:) @@ -4062,6 +5082,7 @@ The color presentation request is sent from the client to the server to obtain a - modify a color reference. - show in a color picker and let users pick one of the presentations +This request has no special capabilities and registration options since it is send as a resolve request for the `textDocument/documentColor` request. _Request_: @@ -4069,7 +5090,7 @@ _Request_: * params: `ColorPresentationParams` defined as follows ```typescript -interface ColorPresentationParams { +interface ColorPresentationParams extends WorkDoneProgressParams, PartialResultParams { /** * The text document. */ @@ -4112,18 +5133,47 @@ interface ColorPresentation { } ``` +* partial result: `ColorPresentation[]` * error: code and message set in case an exception happens during the 'textDocument/colorPresentation' request #### Document Formatting Request (:leftwards_arrow_with_hook:) The document formatting request is sent from the client to the server to format a whole document. +_Client Capability_: +* property name (optional): `textDocument.formatting` +* property type: `DocumentFormattingClientCapabilities` defined as follows: + +```typescript +export interface DocumentFormattingClientCapabilities { + /** + * Whether formatting supports dynamic registration. + */ + dynamicRegistration?: boolean; +} +``` + +_Server Capability_: +* property name (optional): `documentFormattingProvider` +* property type: `boolean | DocumentFormattingOptions` where `DocumentFormattingOptions` is defined as follows: + +```typescript +export interface DocumentFormattingOptions extends WorkDoneProgressOptions { +} +``` + +_Registration Options_: `DocumentFormattingRegistrationOptions` defined as follows: +```typescript +export interface DocumentFormattingRegistrationOptions extends TextDocumentRegistrationOptions, DocumentFormattingOptions { +} +``` + _Request_: * method: 'textDocument/formatting' * params: `DocumentFormattingParams` defined as follows ```typescript -interface DocumentFormattingParams { +interface DocumentFormattingParams extends WorkDoneProgressParams { /** * The document to format. */ @@ -4149,6 +5199,27 @@ interface FormattingOptions { */ insertSpaces: boolean; + /** + * Trim trailing whitespace on a line. + * + * @since 3.15.0 + */ + trimTrailingWhitespace?: boolean; + + /** + * Insert a newline character at the end of the file if one does not exist. + * + * @since 3.15.0 + */ + insertFinalNewline?: boolean; + + /** + * Trim all newlines after the final newline at the end of the file. + * + * @since 3.15.0 + */ + trimFinalNewlines?: boolean; + /** * Signature for further properties. */ @@ -4160,18 +5231,44 @@ _Response_: * result: [`TextEdit[]`](#textedit) \| `null` describing the modification to the document to be formatted. * error: code and message set in case an exception happens during the formatting request. -_Registration Options_: `TextDocumentRegistrationOptions` - #### Document Range Formatting Request (:leftwards_arrow_with_hook:) The document range formatting request is sent from the client to the server to format a given range in a document. +_Client Capability_: +* property name (optional): `textDocument.rangeFormatting` +* property type: `DocumentRangeFormattingClientCapabilities` defined as follows: + +```typescript +export interface DocumentRangeFormattingClientCapabilities { + /** + * Whether formatting supports dynamic registration. + */ + dynamicRegistration?: boolean; +} +``` + +_Server Capability_: +* property name (optional): `documentRangeFormattingProvider` +* property type: `boolean | DocumentRangeFormattingOptions` where `DocumentRangeFormattingOptions` is defined as follows: + +```typescript +export interface DocumentRangeFormattingOptions extends WorkDoneProgressOptions { +} +``` + +_Registration Options_: `DocumentFormattingRegistrationOptions` defined as follows: +```typescript +export interface DocumentRangeFormattingRegistrationOptions extends TextDocumentRegistrationOptions, DocumentRangeFormattingOptions { +} +``` + _Request_: * method: 'textDocument/rangeFormatting', * params: `DocumentRangeFormattingParams` defined as follows: ```typescript -interface DocumentRangeFormattingParams { +interface DocumentRangeFormattingParams extends WorkDoneProgressParams { /** * The document to format. */ @@ -4193,28 +5290,53 @@ _Response_: * result: [`TextEdit[]`](#textedit) \| `null` describing the modification to the document to be formatted. * error: code and message set in case an exception happens during the range formatting request. -_Registration Options_: `TextDocumentRegistrationOptions` - #### Document on Type Formatting Request (:leftwards_arrow_with_hook:) The document on type formatting request is sent from the client to the server to format parts of the document during typing. +_Client Capability_: +* property name (optional): `textDocument.onTypeFormatting` +* property type: `DocumentOnTypeFormattingClientCapabilities` defined as follows: + +```typescript +export interface DocumentOnTypeFormattingClientCapabilities { + /** + * Whether on type formatting supports dynamic registration. + */ + dynamicRegistration?: boolean; +} +``` + +_Server Capability_: +* property name (optional): `documentOnTypeFormattingProvider` +* property type: `DocumentOnTypeFormattingOptions` defined as follows: + +```typescript +export interface DocumentOnTypeFormattingOptions { + /** + * A character on which formatting should be triggered, like `}`. + */ + firstTriggerCharacter: string; + + /** + * More trigger characters. + */ + moreTriggerCharacter?: string[]; +} +``` + +_Registration Options_: `DocumentOnTypeFormattingRegistrationOptions` defined as follows: +```typescript +export interface DocumentOnTypeFormattingRegistrationOptions extends TextDocumentRegistrationOptions, DocumentOnTypeFormattingOptions { +} +``` + _Request_: * method: 'textDocument/onTypeFormatting' * params: `DocumentOnTypeFormattingParams` defined as follows: ```typescript -interface DocumentOnTypeFormattingParams { - /** - * The document to format. - */ - textDocument: TextDocumentIdentifier; - - /** - * The position at which this request was sent. - */ - position: Position; - +interface DocumentOnTypeFormattingParams extends TextDocumentPositionParams { /** * The character that has been typed. */ @@ -4231,40 +5353,58 @@ _Response_: * result: [`TextEdit[]`](#textedit) \| `null` describing the modification to the document. * error: code and message set in case an exception happens during the range formatting request. -_Registration Options_: `DocumentOnTypeFormattingRegistrationOptions` defined as follows: - -```typescript -export interface DocumentOnTypeFormattingRegistrationOptions extends TextDocumentRegistrationOptions { - /** - * A character on which formatting should be triggered, like `}`. - */ - firstTriggerCharacter: string; - /** - * More trigger characters. - */ - moreTriggerCharacter?: string[] -} -``` #### Rename Request (:leftwards_arrow_with_hook:) The rename request is sent from the client to the server to ask the server to compute a workspace change so that the client can perform a workspace-wide rename of a symbol. +_Client Capability_: +* property name (optional): `textDocument.rename` +* property type: `RenameClientCapabilities` defined as follows: + +```typescript +export interface RenameClientCapabilities { + /** + * Whether rename supports dynamic registration. + */ + dynamicRegistration?: boolean; + + /** + * Client supports testing for validity of rename operations + * before execution. + * + * @since version 3.12.0 + */ + prepareSupport?: boolean; +} +``` + +_Server Capability_: +* property name (optional): `renameProvider` +* property type: `boolean | RenameOptions` where `RenameOptions` is defined as follows: + +`RenameOptions` may only be specified if the client states that it supports `prepareSupport` in its initial `initialize` request. + +```typescript +export interface RenameOptions extends WorkDoneProgressOptions { + /** + * Renames should be checked and tested before being executed. + */ + prepareProvider?: boolean; +} +``` + +_Registration Options_: `RenameRegistrationOptions` defined as follows: +```typescript +export interface RenameRegistrationOptions extends TextDocumentRegistrationOptions, RenameOptions { +} +``` + _Request_: * method: 'textDocument/rename' * params: `RenameParams` defined as follows ```typescript -interface RenameParams { - /** - * The document to rename. - */ - textDocument: TextDocumentIdentifier; - - /** - * The position at which this request was sent. - */ - position: Position; - +interface RenameParams extends TextDocumentPositionParams, WorkDoneProgressParams { /** * The new name of the symbol. If the given name is not valid the * request must return a [ResponseError](#ResponseError) with an @@ -4278,17 +5418,6 @@ _Response_: * result: [`WorkspaceEdit`](#workspaceedit) \| `null` describing the modification to the workspace. * error: code and message set in case an exception happens during the rename request. -_Registration Options_: `RenameRegistrationOptions` defined as follows: - -```typescript -export interface RenameRegistrationOptions extends TextDocumentRegistrationOptions { - /** - * Renames should be checked and tested for validity before being executed. - */ - prepareProvider?: boolean; -} -``` - #### Prepare Rename Request (:leftwards_arrow_with_hook:) > *Since version 3.12.0* @@ -4297,11 +5426,15 @@ The prepare rename request is sent from the client to the server to setup and te _Request_: * method: 'textDocument/prepareRename' -* params: [`TextDocumentPositionParams`](#textdocumentpositionparams) +* params: `PrepareRenameParams` defined as follows: +```typescript +export interface PrepareRenameParams extends TextDocumentPositionParams { +} +``` _Response_: * result: [`Range`](#range) \| `{ range: Range, placeholder: string }` \| `null` describing the range of the string to rename and optionally a placeholder text of the string content to be renamed. If `null` is returned then it is deemed that a 'textDocument/rename' request is not valid at the given position. -* error: code and message set in case an exception happens during the prepare rename request. +* error: code and message set in case the element can't be renamed. Clients should show the information in their user interface. #### Folding Range Request (:leftwards_arrow_with_hook:) @@ -4309,19 +5442,58 @@ _Response_: The folding range request is sent from the client to the server to return all folding ranges found in a given text document. +_Client Capability_: +* property name (optional): `textDocument.foldingRange` +* property type: `FoldingRangeClientCapabilities` defined as follows: + +```typescript +export interface FoldingRangeClientCapabilities { + /** + * Whether implementation supports dynamic registration for folding range providers. If this is set to `true` + * the client supports the new `FoldingRangeRegistrationOptions` return value for the corresponding server + * capability as well. + */ + dynamicRegistration?: boolean; + /** + * The maximum number of folding ranges that the client prefers to receive per document. The value serves as a + * hint, servers are free to follow the limit. + */ + rangeLimit?: number; + /** + * If set, the client signals that it only supports folding complete lines. If set, client will + * ignore specified `startCharacter` and `endCharacter` properties in a FoldingRange. + */ + lineFoldingOnly?: boolean; +} +``` + +_Server Capability_: +* property name (optional): `foldingRangeProvider` +* property type: `boolean | FoldingRangeOptions | FoldingRangeRegistrationOptions` where `FoldingRangeOptions` is defined as follows: + +```typescript +export interface FoldingRangeOptions extends WorkDoneProgressOptions { +} +``` + +_Registration Options_: `FoldingRangeRegistrationOptions` defined as follows: +```typescript +export interface FoldingRangeRegistrationOptions extends TextDocumentRegistrationOptions, FoldingRangeOptions, StaticRegistrationOptions { +} +``` + _Request_: * method: 'textDocument/foldingRange' * params: `FoldingRangeParams` defined as follows ```typescript -export interface FoldingRangeParams { +export interface FoldingRangeParams extends WorkDoneProgressParams, PartialResultParams { /** * The text document. */ textDocument: TextDocumentIdentifier; } - ``` _Response_: @@ -4380,10 +5552,86 @@ export interface FoldingRange { } ``` +* partial result: `FoldingRange[]` * error: code and message set in case an exception happens during the 'textDocument/foldingRange' request -_Registration Options_: `TextDocumentRegistrationOptions` +#### Selection Range Request (:leftwards_arrow_with_hook:) +> *Since version 3.15.0* + +The selection range request is sent from the client to the server to return suggested selection ranges at an array of given positions. A selection range is a range around the cursor position which the user might be interested in selecting. + +A selection range in the return array is for the position in the provided parameters at the same index. Therefore positions[i] must be contained in result[i].range. + +Typically, but not necessary, selection ranges correspond to the nodes of the syntax tree. + +_Client Capability_: +* property name (optional): `textDocument.selectionRange` +* property type: `SelectionRangeClientCapabilities` defined as follows: + +```typescript +export interface SelectionRangeClientCapabilities { + /** + * Whether implementation supports dynamic registration for selection range providers. If this is set to `true` + * the client supports the new `SelectionRangeRegistrationOptions` return value for the corresponding server + * capability as well. + */ + dynamicRegistration?: boolean; +} +``` + +_Server Capability_: +* property name (optional): `selectionRangeProvider` +* property type: `boolean | SelectionRangeOptions | SelectionRangeRegistrationOptions` where `SelectionRangeOptions` is defined as follows: + +```typescript +export interface SelectionRangeOptions extends WorkDoneProgressOptions { +} +``` + +_Registration Options_: `SelectionRangeRegistrationOptions` defined as follows: +```typescript +export interface SelectionRangeRegistrationOptions extends SelectionRangeOptions, TextDocumentRegistrationOptions, StaticRegistrationOptions { +} +``` + +_Request_: + +* method: 'textDocument/selectionRange' +* params: `SelectionRangeParams` defined as follows + +```typescript +export interface SelectionRangeParams extends WorkDoneProgressParams, PartialResultParams { + /** + * The text document. + */ + textDocument: TextDocumentIdentifier; + + /** + * The positions inside the text document. + */ + positions: Position[]; +} +``` + +_Response_: +* result: `SelectionRange[] | null` defined as follows: + +```typescript +export interface SelectionRange { + /** + * The [range](#Range) of this selection range. + */ + range: Range; + /** + * The parent selection range containing this range. Therefore `parent.range` must contain `this.range`. + */ + parent?: SelectionRange; +} +``` + +* partial result: `SelectionRange[]` +* error: code and message set in case an exception happens during the 'textDocument/selectionRange' request ### Implementation considerations @@ -4392,10 +5640,28 @@ Language servers usually run in a separate process and client communicate with t - if a client sends a request to the server and the client state changes in a way that the result will be invalid it should cancel the server request and ignore the result. If necessary it can resend the request to receive an up to date result. - if a server detects a state change that invalidates the result of a request in execution the server can error these requests with `ContentModified`. If clients receive a `ContentModified` error, it generally should not show it in the UI for the end-user. Clients can resend the request if appropriate. - if servers end up in an inconsistent state they should log this to the client using the `window/logMessage` request. If they can't recover from this the best they can do right now is to exit themselves. We are considering an [extension to the protocol](https://github.com/Microsoft/language-server-protocol/issues/646) that allows servers to request a restart on the client side. -- if a client notices that a server exists unexpectedly it should try to restart the server. However clients should be careful to not restart a crashing server endlessly. VS Code for example doesn't restart a server if it crashes 5 times in the last 180 seconds. +- if a client notices that a server exits unexpectedly, it should try to restart the server. However clients should be careful not to restart a crashing server endlessly. VS Code, for example, doesn't restart a server which has crashed 5 times in the last 180 seconds. ### Change Log +#### 3.15.0 (01/14/2020) + +* Add generic progress reporting support. +* Add specific work done progress reporting support to requests where applicable. +* Add specific partial result progress support to requests where applicable. +* Add support for `textDocument/selectionRange`. +* Add support for server and client information. +* Add signature help context. +* Add Erlang and Elixir to the list of supported programming languages +* Add `version` on `PublishDiagnosticsParams` +* Add `CodeAction#isPreferred` support. +* Add `CompletionItem#tag` support. +* Add `Diagnostic#tag` support. +* Add `DocumentLink#tooltip` support. +* Add `trimTrailingWhitespace`, `insertFinalNewline` and `trimFinalNewlines` to `FormattingOptions`. +* Clarified `WorkspaceSymbolParams#query` parameter. + + #### 3.14.0 (12/13/2018) * Add support for signature label offsets.