| // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file |
| // 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. |
| |
| // This file has been automatically generated. Please do not edit it manually. |
| // To regenerate the file, use the script |
| // "pkg/analysis_server/tool/lsp_spec/generate_all.dart". |
| |
| // ignore_for_file: deprecated_member_use |
| // ignore_for_file: deprecated_member_use_from_same_package |
| // ignore_for_file: unnecessary_brace_in_string_interps |
| // ignore_for_file: unused_import |
| |
| import 'dart:core' hide deprecated; |
| import 'dart:core' as core show deprecated; |
| import 'dart:convert' show JsonEncoder; |
| import 'package:analysis_server/lsp_protocol/protocol_special.dart'; |
| import 'package:analysis_server/src/protocol/protocol_internal.dart' |
| show listEqual, mapEqual; |
| import 'package:analyzer/src/generated/utilities_general.dart'; |
| |
| const jsonEncoder = const JsonEncoder.withIndent(' '); |
| |
| class ApplyWorkspaceEditParams implements ToJsonable { |
| static const jsonHandler = const LspJsonHandler( |
| ApplyWorkspaceEditParams.canParse, ApplyWorkspaceEditParams.fromJson); |
| |
| ApplyWorkspaceEditParams(this.label, this.edit) { |
| if (edit == null) { |
| throw 'edit is required but was not provided'; |
| } |
| } |
| static ApplyWorkspaceEditParams fromJson(Map<String, dynamic> json) { |
| final label = json['label']; |
| final edit = |
| json['edit'] != null ? WorkspaceEdit.fromJson(json['edit']) : null; |
| return new ApplyWorkspaceEditParams(label, edit); |
| } |
| |
| /// The edits to apply. |
| final WorkspaceEdit edit; |
| |
| /// An optional label of the workspace edit. This label is presented in the |
| /// user interface for example on an undo stack to undo the workspace edit. |
| final String label; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| if (label != null) { |
| __result['label'] = label; |
| } |
| __result['edit'] = edit ?? (throw 'edit is required but was not set'); |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| (obj['label'] == null || obj['label'] is String) && |
| obj.containsKey('edit') && |
| WorkspaceEdit.canParse(obj['edit']); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is ApplyWorkspaceEditParams) { |
| return label == other.label && edit == other.edit && true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, label.hashCode); |
| hash = JenkinsSmiHash.combine(hash, edit.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| class ApplyWorkspaceEditResponse implements ToJsonable { |
| static const jsonHandler = const LspJsonHandler( |
| ApplyWorkspaceEditResponse.canParse, ApplyWorkspaceEditResponse.fromJson); |
| |
| ApplyWorkspaceEditResponse(this.applied) { |
| if (applied == null) { |
| throw 'applied is required but was not provided'; |
| } |
| } |
| static ApplyWorkspaceEditResponse fromJson(Map<String, dynamic> json) { |
| final applied = json['applied']; |
| return new ApplyWorkspaceEditResponse(applied); |
| } |
| |
| /// Indicates whether the edit was applied or not. |
| final bool applied; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| __result['applied'] = |
| applied ?? (throw 'applied is required but was not set'); |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| obj.containsKey('applied') && |
| obj['applied'] is bool; |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is ApplyWorkspaceEditResponse) { |
| return applied == other.applied && true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, applied.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| class CancelParams implements ToJsonable { |
| static const jsonHandler = |
| const LspJsonHandler(CancelParams.canParse, CancelParams.fromJson); |
| |
| CancelParams(this.id) { |
| if (id == null) { |
| throw 'id is required but was not provided'; |
| } |
| } |
| static CancelParams fromJson(Map<String, dynamic> json) { |
| final id = json['id'] is num |
| ? new Either2<num, String>.t1(json['id']) |
| : (json['id'] is String |
| ? new Either2<num, String>.t2(json['id']) |
| : (throw '''${json['id']} was not one of (num, String)''')); |
| return new CancelParams(id); |
| } |
| |
| /// The request id to cancel. |
| final Either2<num, String> id; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| __result['id'] = id ?? (throw 'id is required but was not set'); |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| obj.containsKey('id') && |
| (obj['id'] is num || obj['id'] is String); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is CancelParams) { |
| return id == other.id && true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, id.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| class ClientCapabilities implements ToJsonable { |
| static const jsonHandler = const LspJsonHandler( |
| ClientCapabilities.canParse, ClientCapabilities.fromJson); |
| |
| ClientCapabilities(this.workspace, this.textDocument, this.experimental); |
| static ClientCapabilities fromJson(Map<String, dynamic> json) { |
| final workspace = json['workspace'] != null |
| ? WorkspaceClientCapabilities.fromJson(json['workspace']) |
| : null; |
| final textDocument = json['textDocument'] != null |
| ? TextDocumentClientCapabilities.fromJson(json['textDocument']) |
| : null; |
| final experimental = json['experimental']; |
| return new ClientCapabilities(workspace, textDocument, experimental); |
| } |
| |
| /// Experimental client capabilities. |
| final dynamic experimental; |
| |
| /// Text document specific client capabilities. |
| final TextDocumentClientCapabilities textDocument; |
| |
| /// Workspace specific client capabilities. |
| final WorkspaceClientCapabilities workspace; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| if (workspace != null) { |
| __result['workspace'] = workspace; |
| } |
| if (textDocument != null) { |
| __result['textDocument'] = textDocument; |
| } |
| if (experimental != null) { |
| __result['experimental'] = experimental; |
| } |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| (obj['workspace'] == null || |
| WorkspaceClientCapabilities.canParse(obj['workspace'])) && |
| (obj['textDocument'] == null || |
| TextDocumentClientCapabilities.canParse(obj['textDocument'])) && |
| (obj['experimental'] == null || true); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is ClientCapabilities) { |
| return workspace == other.workspace && |
| textDocument == other.textDocument && |
| experimental == other.experimental && |
| true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, workspace.hashCode); |
| hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); |
| hash = JenkinsSmiHash.combine(hash, experimental.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. |
| /// |
| /// A CodeAction must set either `edit` and/or a `command`. If both are |
| /// supplied, the `edit` is applied first, then the `command` is executed. |
| class CodeAction implements ToJsonable { |
| static const jsonHandler = |
| const LspJsonHandler(CodeAction.canParse, CodeAction.fromJson); |
| |
| CodeAction(this.title, this.kind, this.diagnostics, this.edit, this.command) { |
| if (title == null) { |
| throw 'title is required but was not provided'; |
| } |
| } |
| static CodeAction fromJson(Map<String, dynamic> json) { |
| final title = json['title']; |
| final kind = |
| json['kind'] != null ? CodeActionKind.fromJson(json['kind']) : null; |
| final diagnostics = json['diagnostics'] |
| ?.map((item) => item != null ? Diagnostic.fromJson(item) : null) |
| ?.cast<Diagnostic>() |
| ?.toList(); |
| final edit = |
| json['edit'] != null ? WorkspaceEdit.fromJson(json['edit']) : null; |
| final command = |
| json['command'] != null ? Command.fromJson(json['command']) : null; |
| return new CodeAction(title, kind, diagnostics, edit, command); |
| } |
| |
| /// A command this code action executes. If a code action provides an edit and |
| /// a command, first the edit is executed and then the command. |
| final Command command; |
| |
| /// The diagnostics that this code action resolves. |
| final List<Diagnostic> diagnostics; |
| |
| /// The workspace edit this code action performs. |
| final WorkspaceEdit edit; |
| |
| /// The kind of the code action. |
| /// |
| /// Used to filter code actions. |
| final CodeActionKind kind; |
| |
| /// A short, human-readable, title for this code action. |
| final String title; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| __result['title'] = title ?? (throw 'title is required but was not set'); |
| if (kind != null) { |
| __result['kind'] = kind; |
| } |
| if (diagnostics != null) { |
| __result['diagnostics'] = diagnostics; |
| } |
| if (edit != null) { |
| __result['edit'] = edit; |
| } |
| if (command != null) { |
| __result['command'] = command; |
| } |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| obj.containsKey('title') && |
| obj['title'] is String && |
| (obj['kind'] == null || CodeActionKind.canParse(obj['kind'])) && |
| (obj['diagnostics'] == null || |
| (obj['diagnostics'] is List && |
| (obj['diagnostics'] |
| .every((item) => Diagnostic.canParse(item))))) && |
| (obj['edit'] == null || WorkspaceEdit.canParse(obj['edit'])) && |
| (obj['command'] == null || Command.canParse(obj['command'])); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is CodeAction) { |
| return title == other.title && |
| kind == other.kind && |
| listEqual(diagnostics, other.diagnostics, |
| (Diagnostic a, Diagnostic b) => a == b) && |
| edit == other.edit && |
| command == other.command && |
| true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, title.hashCode); |
| hash = JenkinsSmiHash.combine(hash, kind.hashCode); |
| hash = JenkinsSmiHash.combine(hash, diagnostics.hashCode); |
| hash = JenkinsSmiHash.combine(hash, edit.hashCode); |
| hash = JenkinsSmiHash.combine(hash, command.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 { |
| static const jsonHandler = const LspJsonHandler( |
| CodeActionContext.canParse, CodeActionContext.fromJson); |
| |
| CodeActionContext(this.diagnostics, this.only) { |
| if (diagnostics == null) { |
| throw 'diagnostics is required but was not provided'; |
| } |
| } |
| static CodeActionContext fromJson(Map<String, dynamic> json) { |
| final diagnostics = json['diagnostics'] |
| ?.map((item) => item != null ? Diagnostic.fromJson(item) : null) |
| ?.cast<Diagnostic>() |
| ?.toList(); |
| final only = json['only'] |
| ?.map((item) => item != null ? CodeActionKind.fromJson(item) : null) |
| ?.cast<CodeActionKind>() |
| ?.toList(); |
| return new CodeActionContext(diagnostics, only); |
| } |
| |
| /// An array of diagnostics. |
| final List<Diagnostic> diagnostics; |
| |
| /// Requested kind of actions to return. |
| /// |
| /// Actions not of this kind are filtered out by the client before being |
| /// shown. So servers can omit computing them. |
| final List<CodeActionKind> only; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| __result['diagnostics'] = |
| diagnostics ?? (throw 'diagnostics is required but was not set'); |
| if (only != null) { |
| __result['only'] = only; |
| } |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| obj.containsKey('diagnostics') && |
| (obj['diagnostics'] is List && |
| (obj['diagnostics'].every((item) => Diagnostic.canParse(item)))) && |
| (obj['only'] == null || |
| (obj['only'] is List && |
| (obj['only'].every((item) => CodeActionKind.canParse(item))))); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is CodeActionContext) { |
| return listEqual(diagnostics, other.diagnostics, |
| (Diagnostic a, Diagnostic b) => a == b) && |
| listEqual(only, other.only, |
| (CodeActionKind a, CodeActionKind b) => a == b) && |
| true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, diagnostics.hashCode); |
| hash = JenkinsSmiHash.combine(hash, only.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| /// A set of predefined code action kinds |
| class CodeActionKind { |
| const CodeActionKind(this._value); |
| const CodeActionKind.fromJson(this._value); |
| |
| final String _value; |
| |
| static bool canParse(Object obj) { |
| return obj is String; |
| } |
| |
| /// Base kind for quickfix actions: 'quickfix' |
| static const QuickFix = const CodeActionKind('quickfix'); |
| |
| /// Base kind for refactoring actions: 'refactor' |
| static const Refactor = const CodeActionKind('refactor'); |
| |
| /// Base kind for refactoring extraction actions: 'refactor.extract' |
| /// |
| /// Example extract actions: |
| /// |
| /// - Extract method |
| /// - Extract function |
| /// - Extract variable |
| /// - Extract interface from class |
| /// - ... |
| static const RefactorExtract = const CodeActionKind('refactor.extract'); |
| |
| /// Base kind for refactoring inline actions: 'refactor.inline' |
| /// |
| /// Example inline actions: |
| /// |
| /// - Inline function |
| /// - Inline variable |
| /// - Inline constant |
| /// - ... |
| static const RefactorInline = const CodeActionKind('refactor.inline'); |
| |
| /// Base kind for refactoring rewrite actions: 'refactor.rewrite' |
| /// |
| /// Example rewrite actions: |
| /// |
| /// - Convert JavaScript function to class |
| /// - Add or remove parameter |
| /// - Encapsulate field |
| /// - Make method static |
| /// - Move method to base class |
| /// - ... |
| static const RefactorRewrite = const CodeActionKind('refactor.rewrite'); |
| |
| /// Base kind for source actions: `source` |
| /// |
| /// Source code actions apply to the entire file. |
| static const Source = const CodeActionKind('source'); |
| |
| /// Base kind for an organize imports source action: `source.organizeImports` |
| static const SourceOrganizeImports = |
| const CodeActionKind('source.organizeImports'); |
| |
| Object toJson() => _value; |
| |
| @override |
| String toString() => _value.toString(); |
| |
| @override |
| get hashCode => _value.hashCode; |
| |
| bool operator ==(o) => o is CodeActionKind && o._value == _value; |
| } |
| |
| /// Code Action options. |
| class CodeActionOptions implements ToJsonable { |
| static const jsonHandler = const LspJsonHandler( |
| CodeActionOptions.canParse, CodeActionOptions.fromJson); |
| |
| CodeActionOptions(this.codeActionKinds); |
| static CodeActionOptions fromJson(Map<String, dynamic> json) { |
| if (CodeActionRegistrationOptions.canParse(json)) { |
| return CodeActionRegistrationOptions.fromJson(json); |
| } |
| final codeActionKinds = json['codeActionKinds'] |
| ?.map((item) => item != null ? CodeActionKind.fromJson(item) : null) |
| ?.cast<CodeActionKind>() |
| ?.toList(); |
| return new CodeActionOptions(codeActionKinds); |
| } |
| |
| /// 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. |
| final List<CodeActionKind> codeActionKinds; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| if (codeActionKinds != null) { |
| __result['codeActionKinds'] = codeActionKinds; |
| } |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| (obj['codeActionKinds'] == null || |
| (obj['codeActionKinds'] is List && |
| (obj['codeActionKinds'] |
| .every((item) => CodeActionKind.canParse(item))))); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is CodeActionOptions) { |
| return listEqual(codeActionKinds, other.codeActionKinds, |
| (CodeActionKind a, CodeActionKind b) => a == b) && |
| true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, codeActionKinds.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| /// Params for the CodeActionRequest |
| class CodeActionParams implements ToJsonable { |
| static const jsonHandler = const LspJsonHandler( |
| CodeActionParams.canParse, CodeActionParams.fromJson); |
| |
| CodeActionParams(this.textDocument, this.range, this.context) { |
| if (textDocument == null) { |
| throw 'textDocument is required but was not provided'; |
| } |
| if (range == null) { |
| throw 'range is required but was not provided'; |
| } |
| if (context == null) { |
| throw 'context is required but was not provided'; |
| } |
| } |
| static CodeActionParams fromJson(Map<String, dynamic> json) { |
| final textDocument = json['textDocument'] != null |
| ? TextDocumentIdentifier.fromJson(json['textDocument']) |
| : null; |
| final range = json['range'] != null ? Range.fromJson(json['range']) : null; |
| final context = json['context'] != null |
| ? CodeActionContext.fromJson(json['context']) |
| : null; |
| return new CodeActionParams(textDocument, range, context); |
| } |
| |
| /// Context carrying additional information. |
| final CodeActionContext context; |
| |
| /// The range for which the command was invoked. |
| final Range range; |
| |
| /// The document in which the command was invoked. |
| final TextDocumentIdentifier textDocument; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| __result['textDocument'] = |
| textDocument ?? (throw 'textDocument is required but was not set'); |
| __result['range'] = range ?? (throw 'range is required but was not set'); |
| __result['context'] = |
| context ?? (throw 'context is required but was not set'); |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| obj.containsKey('textDocument') && |
| TextDocumentIdentifier.canParse(obj['textDocument']) && |
| obj.containsKey('range') && |
| Range.canParse(obj['range']) && |
| obj.containsKey('context') && |
| CodeActionContext.canParse(obj['context']); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is CodeActionParams) { |
| return textDocument == other.textDocument && |
| range == other.range && |
| context == other.context && |
| true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); |
| hash = JenkinsSmiHash.combine(hash, range.hashCode); |
| hash = JenkinsSmiHash.combine(hash, context.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| class CodeActionRegistrationOptions |
| implements TextDocumentRegistrationOptions, CodeActionOptions, ToJsonable { |
| static const jsonHandler = const LspJsonHandler( |
| CodeActionRegistrationOptions.canParse, |
| CodeActionRegistrationOptions.fromJson); |
| |
| CodeActionRegistrationOptions(this.documentSelector, this.codeActionKinds); |
| static CodeActionRegistrationOptions fromJson(Map<String, dynamic> json) { |
| final documentSelector = json['documentSelector'] |
| ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) |
| ?.cast<DocumentFilter>() |
| ?.toList(); |
| final codeActionKinds = json['codeActionKinds'] |
| ?.map((item) => item != null ? CodeActionKind.fromJson(item) : null) |
| ?.cast<CodeActionKind>() |
| ?.toList(); |
| return new CodeActionRegistrationOptions(documentSelector, codeActionKinds); |
| } |
| |
| /// 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. |
| final List<CodeActionKind> codeActionKinds; |
| |
| /// 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<DocumentFilter> documentSelector; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| __result['documentSelector'] = documentSelector; |
| if (codeActionKinds != null) { |
| __result['codeActionKinds'] = codeActionKinds; |
| } |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| obj.containsKey('documentSelector') && |
| (obj['documentSelector'] == null || |
| (obj['documentSelector'] is List && |
| (obj['documentSelector'] |
| .every((item) => DocumentFilter.canParse(item))))) && |
| (obj['codeActionKinds'] == null || |
| (obj['codeActionKinds'] is List && |
| (obj['codeActionKinds'] |
| .every((item) => CodeActionKind.canParse(item))))); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is CodeActionRegistrationOptions) { |
| return documentSelector == other.documentSelector && |
| listEqual(codeActionKinds, other.codeActionKinds, |
| (CodeActionKind a, CodeActionKind b) => a == b) && |
| true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, documentSelector.hashCode); |
| hash = JenkinsSmiHash.combine(hash, codeActionKinds.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| /// A code lens represents a command that should be shown along with source |
| /// text, like the number of references, a way to run tests, etc. |
| /// |
| /// A code lens is _unresolved_ when no command is associated to it. For |
| /// performance reasons the creation of a code lens and resolving should be done |
| /// in two stages. |
| class CodeLens implements ToJsonable { |
| static const jsonHandler = |
| const LspJsonHandler(CodeLens.canParse, CodeLens.fromJson); |
| |
| CodeLens(this.range, this.command, this.data) { |
| if (range == null) { |
| throw 'range is required but was not provided'; |
| } |
| } |
| static CodeLens fromJson(Map<String, dynamic> json) { |
| final range = json['range'] != null ? Range.fromJson(json['range']) : null; |
| final command = |
| json['command'] != null ? Command.fromJson(json['command']) : null; |
| final data = json['data']; |
| return new CodeLens(range, command, data); |
| } |
| |
| /// The command this code lens represents. |
| final Command command; |
| |
| /// A data entry field that is preserved on a code lens item between a code |
| /// lens and a code lens resolve request. |
| final dynamic data; |
| |
| /// The range in which this code lens is valid. Should only span a single |
| /// line. |
| final Range range; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| __result['range'] = range ?? (throw 'range is required but was not set'); |
| if (command != null) { |
| __result['command'] = command; |
| } |
| if (data != null) { |
| __result['data'] = data; |
| } |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| obj.containsKey('range') && |
| Range.canParse(obj['range']) && |
| (obj['command'] == null || Command.canParse(obj['command'])) && |
| (obj['data'] == null || true); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is CodeLens) { |
| return range == other.range && |
| command == other.command && |
| data == other.data && |
| true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, range.hashCode); |
| hash = JenkinsSmiHash.combine(hash, command.hashCode); |
| hash = JenkinsSmiHash.combine(hash, data.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| /// Code Lens options. |
| class CodeLensOptions implements ToJsonable { |
| static const jsonHandler = |
| const LspJsonHandler(CodeLensOptions.canParse, CodeLensOptions.fromJson); |
| |
| CodeLensOptions(this.resolveProvider); |
| static CodeLensOptions fromJson(Map<String, dynamic> json) { |
| final resolveProvider = json['resolveProvider']; |
| return new CodeLensOptions(resolveProvider); |
| } |
| |
| /// Code lens has a resolve provider as well. |
| final bool resolveProvider; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| if (resolveProvider != null) { |
| __result['resolveProvider'] = resolveProvider; |
| } |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| (obj['resolveProvider'] == null || obj['resolveProvider'] is bool); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is CodeLensOptions) { |
| return resolveProvider == other.resolveProvider && true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, resolveProvider.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| class CodeLensParams implements ToJsonable { |
| static const jsonHandler = |
| const LspJsonHandler(CodeLensParams.canParse, CodeLensParams.fromJson); |
| |
| CodeLensParams(this.textDocument) { |
| if (textDocument == null) { |
| throw 'textDocument is required but was not provided'; |
| } |
| } |
| static CodeLensParams fromJson(Map<String, dynamic> json) { |
| final textDocument = json['textDocument'] != null |
| ? TextDocumentIdentifier.fromJson(json['textDocument']) |
| : null; |
| return new CodeLensParams(textDocument); |
| } |
| |
| /// The document to request code lens for. |
| final TextDocumentIdentifier textDocument; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| __result['textDocument'] = |
| textDocument ?? (throw 'textDocument is required but was not set'); |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| obj.containsKey('textDocument') && |
| TextDocumentIdentifier.canParse(obj['textDocument']); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is CodeLensParams) { |
| return textDocument == other.textDocument && true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| class CodeLensRegistrationOptions |
| implements TextDocumentRegistrationOptions, ToJsonable { |
| static const jsonHandler = const LspJsonHandler( |
| CodeLensRegistrationOptions.canParse, |
| CodeLensRegistrationOptions.fromJson); |
| |
| CodeLensRegistrationOptions(this.resolveProvider, this.documentSelector); |
| static CodeLensRegistrationOptions fromJson(Map<String, dynamic> json) { |
| final resolveProvider = json['resolveProvider']; |
| final documentSelector = json['documentSelector'] |
| ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) |
| ?.cast<DocumentFilter>() |
| ?.toList(); |
| return new CodeLensRegistrationOptions(resolveProvider, documentSelector); |
| } |
| |
| /// 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<DocumentFilter> documentSelector; |
| |
| /// Code lens has a resolve provider as well. |
| final bool resolveProvider; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| if (resolveProvider != null) { |
| __result['resolveProvider'] = resolveProvider; |
| } |
| __result['documentSelector'] = documentSelector; |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| (obj['resolveProvider'] == null || obj['resolveProvider'] is bool) && |
| obj.containsKey('documentSelector') && |
| (obj['documentSelector'] == null || |
| (obj['documentSelector'] is List && |
| (obj['documentSelector'] |
| .every((item) => DocumentFilter.canParse(item))))); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is CodeLensRegistrationOptions) { |
| return resolveProvider == other.resolveProvider && |
| documentSelector == other.documentSelector && |
| true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, resolveProvider.hashCode); |
| hash = JenkinsSmiHash.combine(hash, documentSelector.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| /// Represents a color in RGBA space. |
| class Color implements ToJsonable { |
| static const jsonHandler = |
| const LspJsonHandler(Color.canParse, Color.fromJson); |
| |
| Color(this.red, this.green, this.blue, this.alpha) { |
| if (red == null) { |
| throw 'red is required but was not provided'; |
| } |
| if (green == null) { |
| throw 'green is required but was not provided'; |
| } |
| if (blue == null) { |
| throw 'blue is required but was not provided'; |
| } |
| if (alpha == null) { |
| throw 'alpha is required but was not provided'; |
| } |
| } |
| static Color fromJson(Map<String, dynamic> json) { |
| final red = json['red']; |
| final green = json['green']; |
| final blue = json['blue']; |
| final alpha = json['alpha']; |
| return new Color(red, green, blue, alpha); |
| } |
| |
| /// The alpha component of this color in the range [0-1]. |
| final num alpha; |
| |
| /// The blue component of this color in the range [0-1]. |
| final num blue; |
| |
| /// The green component of this color in the range [0-1]. |
| final num green; |
| |
| /// The red component of this color in the range [0-1]. |
| final num red; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| __result['red'] = red ?? (throw 'red is required but was not set'); |
| __result['green'] = green ?? (throw 'green is required but was not set'); |
| __result['blue'] = blue ?? (throw 'blue is required but was not set'); |
| __result['alpha'] = alpha ?? (throw 'alpha is required but was not set'); |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| obj.containsKey('red') && |
| obj['red'] is num && |
| obj.containsKey('green') && |
| obj['green'] is num && |
| obj.containsKey('blue') && |
| obj['blue'] is num && |
| obj.containsKey('alpha') && |
| obj['alpha'] is num; |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is Color) { |
| return red == other.red && |
| green == other.green && |
| blue == other.blue && |
| alpha == other.alpha && |
| true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, red.hashCode); |
| hash = JenkinsSmiHash.combine(hash, green.hashCode); |
| hash = JenkinsSmiHash.combine(hash, blue.hashCode); |
| hash = JenkinsSmiHash.combine(hash, alpha.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| class ColorInformation implements ToJsonable { |
| static const jsonHandler = const LspJsonHandler( |
| ColorInformation.canParse, ColorInformation.fromJson); |
| |
| ColorInformation(this.range, this.color) { |
| if (range == null) { |
| throw 'range is required but was not provided'; |
| } |
| if (color == null) { |
| throw 'color is required but was not provided'; |
| } |
| } |
| static ColorInformation fromJson(Map<String, dynamic> json) { |
| final range = json['range'] != null ? Range.fromJson(json['range']) : null; |
| final color = json['color'] != null ? Color.fromJson(json['color']) : null; |
| return new ColorInformation(range, color); |
| } |
| |
| /// The actual color value for this color range. |
| final Color color; |
| |
| /// The range in the document where this color appears. |
| final Range range; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| __result['range'] = range ?? (throw 'range is required but was not set'); |
| __result['color'] = color ?? (throw 'color is required but was not set'); |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| obj.containsKey('range') && |
| Range.canParse(obj['range']) && |
| obj.containsKey('color') && |
| Color.canParse(obj['color']); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is ColorInformation) { |
| return range == other.range && color == other.color && true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, range.hashCode); |
| hash = JenkinsSmiHash.combine(hash, color.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| class ColorPresentation implements ToJsonable { |
| static const jsonHandler = const LspJsonHandler( |
| ColorPresentation.canParse, ColorPresentation.fromJson); |
| |
| ColorPresentation(this.label, this.textEdit, this.additionalTextEdits) { |
| if (label == null) { |
| throw 'label is required but was not provided'; |
| } |
| } |
| static ColorPresentation fromJson(Map<String, dynamic> json) { |
| final label = json['label']; |
| final textEdit = |
| json['textEdit'] != null ? TextEdit.fromJson(json['textEdit']) : null; |
| final additionalTextEdits = json['additionalTextEdits'] |
| ?.map((item) => item != null ? TextEdit.fromJson(item) : null) |
| ?.cast<TextEdit>() |
| ?.toList(); |
| return new ColorPresentation(label, textEdit, additionalTextEdits); |
| } |
| |
| /// An optional array of additional text edits ([TextEdit]) that are applied |
| /// when selecting this color presentation. Edits must not overlap with the |
| /// main [edit](#ColorPresentation.textEdit) nor with themselves. |
| final List<TextEdit> additionalTextEdits; |
| |
| /// The label of this color presentation. It will be shown on the color picker |
| /// header. By default this is also the text that is inserted when selecting |
| /// this color presentation. |
| final String label; |
| |
| /// An edit ([TextEdit]) which is applied to a document when selecting this |
| /// presentation for the color. When `falsy` the |
| /// [label](#ColorPresentation.label) is used. |
| final TextEdit textEdit; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| __result['label'] = label ?? (throw 'label is required but was not set'); |
| if (textEdit != null) { |
| __result['textEdit'] = textEdit; |
| } |
| if (additionalTextEdits != null) { |
| __result['additionalTextEdits'] = additionalTextEdits; |
| } |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| obj.containsKey('label') && |
| obj['label'] is String && |
| (obj['textEdit'] == null || TextEdit.canParse(obj['textEdit'])) && |
| (obj['additionalTextEdits'] == null || |
| (obj['additionalTextEdits'] is List && |
| (obj['additionalTextEdits'] |
| .every((item) => TextEdit.canParse(item))))); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is ColorPresentation) { |
| return label == other.label && |
| textEdit == other.textEdit && |
| listEqual(additionalTextEdits, other.additionalTextEdits, |
| (TextEdit a, TextEdit b) => a == b) && |
| true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, label.hashCode); |
| hash = JenkinsSmiHash.combine(hash, textEdit.hashCode); |
| hash = JenkinsSmiHash.combine(hash, additionalTextEdits.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| class ColorPresentationParams implements ToJsonable { |
| static const jsonHandler = const LspJsonHandler( |
| ColorPresentationParams.canParse, ColorPresentationParams.fromJson); |
| |
| ColorPresentationParams(this.textDocument, this.color, this.range) { |
| if (textDocument == null) { |
| throw 'textDocument is required but was not provided'; |
| } |
| if (color == null) { |
| throw 'color is required but was not provided'; |
| } |
| if (range == null) { |
| throw 'range is required but was not provided'; |
| } |
| } |
| static ColorPresentationParams fromJson(Map<String, dynamic> json) { |
| final textDocument = json['textDocument'] != null |
| ? TextDocumentIdentifier.fromJson(json['textDocument']) |
| : null; |
| final color = json['color'] != null ? Color.fromJson(json['color']) : null; |
| final range = json['range'] != null ? Range.fromJson(json['range']) : null; |
| return new ColorPresentationParams(textDocument, color, range); |
| } |
| |
| /// The color information to request presentations for. |
| final Color color; |
| |
| /// The range where the color would be inserted. Serves as a context. |
| final Range range; |
| |
| /// The text document. |
| final TextDocumentIdentifier textDocument; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __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'); |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| obj.containsKey('textDocument') && |
| TextDocumentIdentifier.canParse(obj['textDocument']) && |
| obj.containsKey('color') && |
| Color.canParse(obj['color']) && |
| obj.containsKey('range') && |
| Range.canParse(obj['range']); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is ColorPresentationParams) { |
| return textDocument == other.textDocument && |
| color == other.color && |
| range == other.range && |
| true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| 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 = const LspJsonHandler( |
| ColorProviderOptions.canParse, ColorProviderOptions.fromJson); |
| |
| static ColorProviderOptions fromJson(Map<String, dynamic> json) { |
| return new ColorProviderOptions(); |
| } |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic>; |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is ColorProviderOptions) { |
| return true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| class Command implements ToJsonable { |
| static const jsonHandler = |
| const LspJsonHandler(Command.canParse, Command.fromJson); |
| |
| Command(this.title, this.command, this.arguments) { |
| if (title == null) { |
| throw 'title is required but was not provided'; |
| } |
| if (command == null) { |
| throw 'command is required but was not provided'; |
| } |
| } |
| static Command fromJson(Map<String, dynamic> json) { |
| final title = json['title']; |
| final command = json['command']; |
| final arguments = |
| json['arguments']?.map((item) => item)?.cast<dynamic>()?.toList(); |
| return new Command(title, command, arguments); |
| } |
| |
| /// Arguments that the command handler should be invoked with. |
| final List<dynamic> arguments; |
| |
| /// The identifier of the actual command handler. |
| final String command; |
| |
| /// Title of the command, like `save`. |
| final String title; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| __result['title'] = title ?? (throw 'title is required but was not set'); |
| __result['command'] = |
| command ?? (throw 'command is required but was not set'); |
| if (arguments != null) { |
| __result['arguments'] = arguments; |
| } |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| obj.containsKey('title') && |
| obj['title'] is String && |
| obj.containsKey('command') && |
| obj['command'] is String && |
| (obj['arguments'] == null || |
| (obj['arguments'] is List && |
| (obj['arguments'].every((item) => true)))); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is Command) { |
| return title == other.title && |
| command == other.command && |
| listEqual( |
| arguments, other.arguments, (dynamic a, dynamic b) => a == b) && |
| true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, title.hashCode); |
| hash = JenkinsSmiHash.combine(hash, command.hashCode); |
| hash = JenkinsSmiHash.combine(hash, arguments.hashCode); |
| 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 { |
| static const jsonHandler = const LspJsonHandler( |
| CompletionContext.canParse, CompletionContext.fromJson); |
| |
| CompletionContext(this.triggerKind, this.triggerCharacter) { |
| if (triggerKind == null) { |
| throw 'triggerKind is required but was not provided'; |
| } |
| } |
| static CompletionContext fromJson(Map<String, dynamic> json) { |
| final triggerKind = json['triggerKind'] != null |
| ? CompletionTriggerKind.fromJson(json['triggerKind']) |
| : null; |
| final triggerCharacter = json['triggerCharacter']; |
| return new CompletionContext(triggerKind, triggerCharacter); |
| } |
| |
| /// The trigger character (a single character) that has trigger code complete. |
| /// Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter` |
| final String triggerCharacter; |
| |
| /// How the completion was triggered. |
| final CompletionTriggerKind triggerKind; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| __result['triggerKind'] = |
| triggerKind ?? (throw 'triggerKind is required but was not set'); |
| if (triggerCharacter != null) { |
| __result['triggerCharacter'] = triggerCharacter; |
| } |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| obj.containsKey('triggerKind') && |
| CompletionTriggerKind.canParse(obj['triggerKind']) && |
| (obj['triggerCharacter'] == null || obj['triggerCharacter'] is String); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is CompletionContext) { |
| return triggerKind == other.triggerKind && |
| triggerCharacter == other.triggerCharacter && |
| true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, triggerKind.hashCode); |
| hash = JenkinsSmiHash.combine(hash, triggerCharacter.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| class CompletionItem implements ToJsonable { |
| static const jsonHandler = |
| const LspJsonHandler(CompletionItem.canParse, CompletionItem.fromJson); |
| |
| CompletionItem( |
| this.label, |
| this.kind, |
| this.detail, |
| this.documentation, |
| this.deprecated, |
| this.preselect, |
| this.sortText, |
| this.filterText, |
| this.insertText, |
| this.insertTextFormat, |
| this.textEdit, |
| this.additionalTextEdits, |
| this.commitCharacters, |
| this.command, |
| this.data) { |
| if (label == null) { |
| throw 'label is required but was not provided'; |
| } |
| } |
| static CompletionItem fromJson(Map<String, dynamic> json) { |
| final label = json['label']; |
| final kind = |
| json['kind'] != null ? CompletionItemKind.fromJson(json['kind']) : null; |
| final detail = json['detail']; |
| final documentation = json['documentation'] is String |
| ? new Either2<String, MarkupContent>.t1(json['documentation']) |
| : (MarkupContent.canParse(json['documentation']) |
| ? new Either2<String, MarkupContent>.t2( |
| json['documentation'] != null |
| ? MarkupContent.fromJson(json['documentation']) |
| : null) |
| : (json['documentation'] == null |
| ? null |
| : (throw '''${json['documentation']} was not one of (String, MarkupContent)'''))); |
| final deprecated = json['deprecated']; |
| final preselect = json['preselect']; |
| final sortText = json['sortText']; |
| final filterText = json['filterText']; |
| final insertText = json['insertText']; |
| final insertTextFormat = json['insertTextFormat'] != null |
| ? InsertTextFormat.fromJson(json['insertTextFormat']) |
| : null; |
| final textEdit = |
| json['textEdit'] != null ? TextEdit.fromJson(json['textEdit']) : null; |
| final additionalTextEdits = json['additionalTextEdits'] |
| ?.map((item) => item != null ? TextEdit.fromJson(item) : null) |
| ?.cast<TextEdit>() |
| ?.toList(); |
| final commitCharacters = |
| json['commitCharacters']?.map((item) => item)?.cast<String>()?.toList(); |
| final command = |
| json['command'] != null ? Command.fromJson(json['command']) : null; |
| final data = json['data']; |
| return new CompletionItem( |
| label, |
| kind, |
| detail, |
| documentation, |
| deprecated, |
| preselect, |
| sortText, |
| filterText, |
| insertText, |
| insertTextFormat, |
| textEdit, |
| additionalTextEdits, |
| commitCharacters, |
| command, |
| data); |
| } |
| |
| /// An optional array of additional text edits that are applied when selecting |
| /// this completion. Edits must not overlap (including the same insert |
| /// position) with the main edit nor with themselves. |
| /// |
| /// Additional text edits should be used to change text unrelated to the |
| /// current cursor position (for example adding an import statement at the top |
| /// of the file if the completion item will insert an unqualified type). |
| final List<TextEdit> additionalTextEdits; |
| |
| /// An optional command that is executed *after* inserting this completion. |
| /// *Note* that additional modifications to the current document should be |
| /// described with the additionalTextEdits-property. |
| final Command command; |
| |
| /// An optional set of characters that when pressed while this completion is |
| /// active will accept it first and then type that character. *Note* that all |
| /// commit characters should have `length=1` and that superfluous characters |
| /// will be ignored. |
| final List<String> commitCharacters; |
| |
| /// An data entry field that is preserved on a completion item between a |
| /// completion and a completion resolve request. |
| final dynamic data; |
| |
| /// Indicates if this item is deprecated. |
| final bool deprecated; |
| |
| /// A human-readable string with additional information about this item, like |
| /// type or symbol information. |
| final String detail; |
| |
| /// A human-readable string that represents a doc-comment. |
| final Either2<String, MarkupContent> documentation; |
| |
| /// A string that should be used when filtering a set of completion items. |
| /// When `falsy` the label is used. |
| final String filterText; |
| |
| /// A string that should be inserted into a document when selecting this |
| /// completion. When `falsy` the label is used. |
| /// |
| /// The `insertText` is subject to interpretation by the client side. Some |
| /// tools might not take the string literally. For example VS Code when code |
| /// complete is requested in this example `con<cursor position>` and a |
| /// completion item with an `insertText` of `console` is provided it will only |
| /// insert `sole`. Therefore it is recommended to use `textEdit` instead since |
| /// it avoids additional client side interpretation. |
| /// @deprecated Use textEdit instead. |
| @core.deprecated |
| 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`. |
| final InsertTextFormat insertTextFormat; |
| |
| /// The kind of this completion item. Based of the kind an icon is chosen by |
| /// the editor. |
| final CompletionItemKind kind; |
| |
| /// The label of this completion item. By default also the text that is |
| /// inserted when selecting this completion. |
| final String label; |
| |
| /// Select this item when showing. |
| /// |
| /// *Note* that only one completion item can be selected and that the tool / |
| /// client decides which item that is. The rule is that the *first* item of |
| /// those that match best is selected. |
| final bool preselect; |
| |
| /// A string that should be used when comparing this item with other items. |
| /// When `falsy` the label is used. |
| final String sortText; |
| |
| /// An edit which is applied to a document when selecting this completion. |
| /// When an edit is provided the value of `insertText` is ignored. |
| /// |
| /// *Note:* The range of the edit must be a single line range and it must |
| /// contain the position at which completion has been requested. |
| final TextEdit textEdit; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| __result['label'] = label ?? (throw 'label is required but was not set'); |
| if (kind != null) { |
| __result['kind'] = kind; |
| } |
| if (detail != null) { |
| __result['detail'] = detail; |
| } |
| if (documentation != null) { |
| __result['documentation'] = documentation; |
| } |
| if (deprecated != null) { |
| __result['deprecated'] = deprecated; |
| } |
| if (preselect != null) { |
| __result['preselect'] = preselect; |
| } |
| if (sortText != null) { |
| __result['sortText'] = sortText; |
| } |
| if (filterText != null) { |
| __result['filterText'] = filterText; |
| } |
| if (insertText != null) { |
| __result['insertText'] = insertText; |
| } |
| if (insertTextFormat != null) { |
| __result['insertTextFormat'] = insertTextFormat; |
| } |
| if (textEdit != null) { |
| __result['textEdit'] = textEdit; |
| } |
| if (additionalTextEdits != null) { |
| __result['additionalTextEdits'] = additionalTextEdits; |
| } |
| if (commitCharacters != null) { |
| __result['commitCharacters'] = commitCharacters; |
| } |
| if (command != null) { |
| __result['command'] = command; |
| } |
| if (data != null) { |
| __result['data'] = data; |
| } |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| obj.containsKey('label') && |
| obj['label'] is String && |
| (obj['kind'] == null || CompletionItemKind.canParse(obj['kind'])) && |
| (obj['detail'] == null || obj['detail'] is String) && |
| (obj['documentation'] == null || |
| (obj['documentation'] is String || |
| MarkupContent.canParse(obj['documentation']))) && |
| (obj['deprecated'] == null || obj['deprecated'] is bool) && |
| (obj['preselect'] == null || obj['preselect'] is bool) && |
| (obj['sortText'] == null || obj['sortText'] is String) && |
| (obj['filterText'] == null || obj['filterText'] is String) && |
| (obj['insertText'] == null || obj['insertText'] is String) && |
| (obj['insertTextFormat'] == null || |
| InsertTextFormat.canParse(obj['insertTextFormat'])) && |
| (obj['textEdit'] == null || TextEdit.canParse(obj['textEdit'])) && |
| (obj['additionalTextEdits'] == null || |
| (obj['additionalTextEdits'] is List && |
| (obj['additionalTextEdits'] |
| .every((item) => TextEdit.canParse(item))))) && |
| (obj['commitCharacters'] == null || |
| (obj['commitCharacters'] is List && |
| (obj['commitCharacters'].every((item) => item is String)))) && |
| (obj['command'] == null || Command.canParse(obj['command'])) && |
| (obj['data'] == null || true); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is CompletionItem) { |
| return label == other.label && |
| kind == other.kind && |
| detail == other.detail && |
| documentation == other.documentation && |
| deprecated == other.deprecated && |
| preselect == other.preselect && |
| sortText == other.sortText && |
| filterText == other.filterText && |
| insertText == other.insertText && |
| insertTextFormat == other.insertTextFormat && |
| textEdit == other.textEdit && |
| listEqual(additionalTextEdits, other.additionalTextEdits, |
| (TextEdit a, TextEdit b) => a == b) && |
| listEqual(commitCharacters, other.commitCharacters, |
| (String a, String b) => a == b) && |
| command == other.command && |
| data == other.data && |
| true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, label.hashCode); |
| hash = JenkinsSmiHash.combine(hash, kind.hashCode); |
| hash = JenkinsSmiHash.combine(hash, detail.hashCode); |
| hash = JenkinsSmiHash.combine(hash, documentation.hashCode); |
| hash = JenkinsSmiHash.combine(hash, deprecated.hashCode); |
| hash = JenkinsSmiHash.combine(hash, preselect.hashCode); |
| hash = JenkinsSmiHash.combine(hash, sortText.hashCode); |
| hash = JenkinsSmiHash.combine(hash, filterText.hashCode); |
| hash = JenkinsSmiHash.combine(hash, insertText.hashCode); |
| hash = JenkinsSmiHash.combine(hash, insertTextFormat.hashCode); |
| hash = JenkinsSmiHash.combine(hash, textEdit.hashCode); |
| hash = JenkinsSmiHash.combine(hash, additionalTextEdits.hashCode); |
| hash = JenkinsSmiHash.combine(hash, commitCharacters.hashCode); |
| hash = JenkinsSmiHash.combine(hash, command.hashCode); |
| hash = JenkinsSmiHash.combine(hash, data.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| /// The kind of a completion entry. |
| class CompletionItemKind { |
| const CompletionItemKind(this._value); |
| const CompletionItemKind.fromJson(this._value); |
| |
| final num _value; |
| |
| static bool canParse(Object obj) { |
| return obj is num; |
| } |
| |
| static const Text = const CompletionItemKind(1); |
| static const Method = const CompletionItemKind(2); |
| static const Function = const CompletionItemKind(3); |
| static const Constructor = const CompletionItemKind(4); |
| static const Field = const CompletionItemKind(5); |
| static const Variable = const CompletionItemKind(6); |
| static const Class = const CompletionItemKind(7); |
| static const Interface = const CompletionItemKind(8); |
| static const Module = const CompletionItemKind(9); |
| static const Property = const CompletionItemKind(10); |
| static const Unit = const CompletionItemKind(11); |
| static const Value = const CompletionItemKind(12); |
| static const Enum = const CompletionItemKind(13); |
| static const Keyword = const CompletionItemKind(14); |
| static const Snippet = const CompletionItemKind(15); |
| static const Color = const CompletionItemKind(16); |
| static const File = const CompletionItemKind(17); |
| static const Reference = const CompletionItemKind(18); |
| static const Folder = const CompletionItemKind(19); |
| static const EnumMember = const CompletionItemKind(20); |
| static const Constant = const CompletionItemKind(21); |
| static const Struct = const CompletionItemKind(22); |
| static const Event = const CompletionItemKind(23); |
| static const Operator = const CompletionItemKind(24); |
| static const TypeParameter = const CompletionItemKind(25); |
| |
| Object toJson() => _value; |
| |
| @override |
| String toString() => _value.toString(); |
| |
| @override |
| get hashCode => _value.hashCode; |
| |
| bool operator ==(o) => o is CompletionItemKind && o._value == _value; |
| } |
| |
| /// Represents a collection of completion items ([CompletionItem]) to be |
| /// presented in the editor. |
| class CompletionList implements ToJsonable { |
| static const jsonHandler = |
| const LspJsonHandler(CompletionList.canParse, CompletionList.fromJson); |
| |
| CompletionList(this.isIncomplete, this.items) { |
| if (isIncomplete == null) { |
| throw 'isIncomplete is required but was not provided'; |
| } |
| if (items == null) { |
| throw 'items is required but was not provided'; |
| } |
| } |
| static CompletionList fromJson(Map<String, dynamic> json) { |
| final isIncomplete = json['isIncomplete']; |
| final items = json['items'] |
| ?.map((item) => item != null ? CompletionItem.fromJson(item) : null) |
| ?.cast<CompletionItem>() |
| ?.toList(); |
| return new CompletionList(isIncomplete, items); |
| } |
| |
| /// This list it not complete. Further typing should result in recomputing |
| /// this list. |
| final bool isIncomplete; |
| |
| /// The completion items. |
| final List<CompletionItem> items; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| __result['isIncomplete'] = |
| isIncomplete ?? (throw 'isIncomplete is required but was not set'); |
| __result['items'] = items ?? (throw 'items is required but was not set'); |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| obj.containsKey('isIncomplete') && |
| obj['isIncomplete'] is bool && |
| obj.containsKey('items') && |
| (obj['items'] is List && |
| (obj['items'].every((item) => CompletionItem.canParse(item)))); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is CompletionList) { |
| return isIncomplete == other.isIncomplete && |
| listEqual(items, other.items, |
| (CompletionItem a, CompletionItem b) => a == b) && |
| true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, isIncomplete.hashCode); |
| hash = JenkinsSmiHash.combine(hash, items.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| /// Completion options. |
| class CompletionOptions implements ToJsonable { |
| static const jsonHandler = const LspJsonHandler( |
| CompletionOptions.canParse, CompletionOptions.fromJson); |
| |
| CompletionOptions(this.resolveProvider, this.triggerCharacters); |
| static CompletionOptions fromJson(Map<String, dynamic> json) { |
| final resolveProvider = json['resolveProvider']; |
| final triggerCharacters = json['triggerCharacters'] |
| ?.map((item) => item) |
| ?.cast<String>() |
| ?.toList(); |
| return new CompletionOptions(resolveProvider, triggerCharacters); |
| } |
| |
| /// The server provides support to resolve additional information for a |
| /// completion item. |
| final bool resolveProvider; |
| |
| /// The characters that trigger completion automatically. |
| final List<String> triggerCharacters; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| if (resolveProvider != null) { |
| __result['resolveProvider'] = resolveProvider; |
| } |
| if (triggerCharacters != null) { |
| __result['triggerCharacters'] = triggerCharacters; |
| } |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| (obj['resolveProvider'] == null || obj['resolveProvider'] is bool) && |
| (obj['triggerCharacters'] == null || |
| (obj['triggerCharacters'] is List && |
| (obj['triggerCharacters'].every((item) => item is String)))); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is CompletionOptions) { |
| return resolveProvider == other.resolveProvider && |
| listEqual(triggerCharacters, other.triggerCharacters, |
| (String a, String b) => a == b) && |
| true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, resolveProvider.hashCode); |
| hash = JenkinsSmiHash.combine(hash, triggerCharacters.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| class CompletionParams implements TextDocumentPositionParams, ToJsonable { |
| static const jsonHandler = const LspJsonHandler( |
| CompletionParams.canParse, CompletionParams.fromJson); |
| |
| CompletionParams(this.context, 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 CompletionParams fromJson(Map<String, dynamic> json) { |
| final context = json['context'] != null |
| ? CompletionContext.fromJson(json['context']) |
| : null; |
| final textDocument = json['textDocument'] != null |
| ? TextDocumentIdentifier.fromJson(json['textDocument']) |
| : null; |
| final position = |
| json['position'] != null ? Position.fromJson(json['position']) : null; |
| return new CompletionParams(context, textDocument, position); |
| } |
| |
| /// The completion context. This is only available if the client specifies to |
| /// send this using `ClientCapabilities.textDocument.completion.contextSupport |
| /// === true` |
| final CompletionContext context; |
| |
| /// The position inside the text document. |
| final Position position; |
| |
| /// The text document. |
| final TextDocumentIdentifier textDocument; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __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'); |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| (obj['context'] == null || |
| CompletionContext.canParse(obj['context'])) && |
| obj.containsKey('textDocument') && |
| TextDocumentIdentifier.canParse(obj['textDocument']) && |
| obj.containsKey('position') && |
| Position.canParse(obj['position']); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is CompletionParams) { |
| return context == other.context && |
| textDocument == other.textDocument && |
| position == other.position && |
| true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, context.hashCode); |
| hash = JenkinsSmiHash.combine(hash, textDocument.hashCode); |
| hash = JenkinsSmiHash.combine(hash, position.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| class CompletionRegistrationOptions |
| implements TextDocumentRegistrationOptions, ToJsonable { |
| static const jsonHandler = const LspJsonHandler( |
| CompletionRegistrationOptions.canParse, |
| CompletionRegistrationOptions.fromJson); |
| |
| CompletionRegistrationOptions( |
| this.triggerCharacters, this.resolveProvider, this.documentSelector); |
| static CompletionRegistrationOptions fromJson(Map<String, dynamic> json) { |
| final triggerCharacters = json['triggerCharacters'] |
| ?.map((item) => item) |
| ?.cast<String>() |
| ?.toList(); |
| final resolveProvider = json['resolveProvider']; |
| final documentSelector = json['documentSelector'] |
| ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null) |
| ?.cast<DocumentFilter>() |
| ?.toList(); |
| return new CompletionRegistrationOptions( |
| triggerCharacters, resolveProvider, documentSelector); |
| } |
| |
| /// 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<DocumentFilter> documentSelector; |
| |
| /// The server provides support to resolve additional information for a |
| /// completion item. |
| final bool resolveProvider; |
| |
| /// 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<String> triggerCharacters; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| if (triggerCharacters != null) { |
| __result['triggerCharacters'] = triggerCharacters; |
| } |
| if (resolveProvider != null) { |
| __result['resolveProvider'] = resolveProvider; |
| } |
| __result['documentSelector'] = documentSelector; |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| (obj['triggerCharacters'] == null || |
| (obj['triggerCharacters'] is List && |
| (obj['triggerCharacters'].every((item) => item is String)))) && |
| (obj['resolveProvider'] == null || obj['resolveProvider'] is bool) && |
| obj.containsKey('documentSelector') && |
| (obj['documentSelector'] == null || |
| (obj['documentSelector'] is List && |
| (obj['documentSelector'] |
| .every((item) => DocumentFilter.canParse(item))))); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is CompletionRegistrationOptions) { |
| return listEqual(triggerCharacters, other.triggerCharacters, |
| (String a, String b) => a == b) && |
| resolveProvider == other.resolveProvider && |
| documentSelector == other.documentSelector && |
| true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, triggerCharacters.hashCode); |
| hash = JenkinsSmiHash.combine(hash, resolveProvider.hashCode); |
| hash = JenkinsSmiHash.combine(hash, documentSelector.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| /// How a completion was triggered |
| class CompletionTriggerKind { |
| const CompletionTriggerKind._(this._value); |
| const CompletionTriggerKind.fromJson(this._value); |
| |
| final num _value; |
| |
| static bool canParse(Object obj) { |
| switch (obj) { |
| case 1: |
| case 2: |
| case 3: |
| return true; |
| } |
| return false; |
| } |
| |
| /// Completion was triggered by typing an identifier (24x7 code complete), |
| /// manual invocation (e.g Ctrl+Space) or via API. |
| static const Invoked = const CompletionTriggerKind._(1); |
| |
| /// Completion was triggered by a trigger character specified by the |
| /// `triggerCharacters` properties of the `CompletionRegistrationOptions`. |
| static const TriggerCharacter = const CompletionTriggerKind._(2); |
| |
| /// Completion was re-triggered as the current completion list is incomplete. |
| static const TriggerForIncompleteCompletions = |
| const CompletionTriggerKind._(3); |
| |
| Object toJson() => _value; |
| |
| @override |
| String toString() => _value.toString(); |
| |
| @override |
| get hashCode => _value.hashCode; |
| |
| bool operator ==(o) => o is CompletionTriggerKind && o._value == _value; |
| } |
| |
| class ConfigurationItem implements ToJsonable { |
| static const jsonHandler = const LspJsonHandler( |
| ConfigurationItem.canParse, ConfigurationItem.fromJson); |
| |
| ConfigurationItem(this.scopeUri, this.section); |
| static ConfigurationItem fromJson(Map<String, dynamic> json) { |
| final scopeUri = json['scopeUri']; |
| final section = json['section']; |
| return new ConfigurationItem(scopeUri, section); |
| } |
| |
| /// The scope to get the configuration section for. |
| final String scopeUri; |
| |
| /// The configuration section asked for. |
| final String section; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| if (scopeUri != null) { |
| __result['scopeUri'] = scopeUri; |
| } |
| if (section != null) { |
| __result['section'] = section; |
| } |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| (obj['scopeUri'] == null || obj['scopeUri'] is String) && |
| (obj['section'] == null || obj['section'] is String); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is ConfigurationItem) { |
| return scopeUri == other.scopeUri && section == other.section && true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, scopeUri.hashCode); |
| hash = JenkinsSmiHash.combine(hash, section.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| class ConfigurationParams implements ToJsonable { |
| static const jsonHandler = const LspJsonHandler( |
| ConfigurationParams.canParse, ConfigurationParams.fromJson); |
| |
| ConfigurationParams(this.items) { |
| if (items == null) { |
| throw 'items is required but was not provided'; |
| } |
| } |
| static ConfigurationParams fromJson(Map<String, dynamic> json) { |
| final items = json['items'] |
| ?.map((item) => item != null ? ConfigurationItem.fromJson(item) : null) |
| ?.cast<ConfigurationItem>() |
| ?.toList(); |
| return new ConfigurationParams(items); |
| } |
| |
| final List<ConfigurationItem> items; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| __result['items'] = items ?? (throw 'items is required but was not set'); |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| obj.containsKey('items') && |
| (obj['items'] is List && |
| (obj['items'].every((item) => ConfigurationItem.canParse(item)))); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is ConfigurationParams) { |
| return listEqual(items, other.items, |
| (ConfigurationItem a, ConfigurationItem b) => a == b) && |
| true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, items.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| /// Create file operation |
| class CreateFile implements ToJsonable { |
| static const jsonHandler = |
| const LspJsonHandler(CreateFile.canParse, CreateFile.fromJson); |
| |
| CreateFile(this.kind, this.uri, this.options) { |
| if (kind == null) { |
| throw 'kind is required but was not provided'; |
| } |
| if (uri == null) { |
| throw 'uri is required but was not provided'; |
| } |
| } |
| static CreateFile fromJson(Map<String, dynamic> json) { |
| final kind = json['kind']; |
| final uri = json['uri']; |
| final options = json['options'] != null |
| ? CreateFileOptions.fromJson(json['options']) |
| : null; |
| return new CreateFile(kind, uri, options); |
| } |
| |
| /// A create |
| final String kind; |
| |
| /// Additional options |
| final CreateFileOptions options; |
| |
| /// The resource to create. |
| final String uri; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| __result['kind'] = kind ?? (throw 'kind is required but was not set'); |
| __result['uri'] = uri ?? (throw 'uri is required but was not set'); |
| if (options != null) { |
| __result['options'] = options; |
| } |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| obj.containsKey('kind') && |
| obj['kind'] is String && |
| obj.containsKey('uri') && |
| obj['uri'] is String && |
| (obj['options'] == null || CreateFileOptions.canParse(obj['options'])); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is CreateFile) { |
| return kind == other.kind && |
| uri == other.uri && |
| options == other.options && |
| true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, kind.hashCode); |
| hash = JenkinsSmiHash.combine(hash, uri.hashCode); |
| hash = JenkinsSmiHash.combine(hash, options.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| /// Options to create a file. |
| class CreateFileOptions implements ToJsonable { |
| static const jsonHandler = const LspJsonHandler( |
| CreateFileOptions.canParse, CreateFileOptions.fromJson); |
| |
| CreateFileOptions(this.overwrite, this.ignoreIfExists); |
| static CreateFileOptions fromJson(Map<String, dynamic> json) { |
| final overwrite = json['overwrite']; |
| final ignoreIfExists = json['ignoreIfExists']; |
| return new CreateFileOptions(overwrite, ignoreIfExists); |
| } |
| |
| /// Ignore if exists. |
| final bool ignoreIfExists; |
| |
| /// Overwrite existing file. Overwrite wins over `ignoreIfExists` |
| final bool overwrite; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| if (overwrite != null) { |
| __result['overwrite'] = overwrite; |
| } |
| if (ignoreIfExists != null) { |
| __result['ignoreIfExists'] = ignoreIfExists; |
| } |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| (obj['overwrite'] == null || obj['overwrite'] is bool) && |
| (obj['ignoreIfExists'] == null || obj['ignoreIfExists'] is bool); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is CreateFileOptions) { |
| return overwrite == other.overwrite && |
| ignoreIfExists == other.ignoreIfExists && |
| true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, overwrite.hashCode); |
| hash = JenkinsSmiHash.combine(hash, ignoreIfExists.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| /// Delete file operation |
| class DeleteFile implements ToJsonable { |
| static const jsonHandler = |
| const LspJsonHandler(DeleteFile.canParse, DeleteFile.fromJson); |
| |
| DeleteFile(this.kind, this.uri, this.options) { |
| if (kind == null) { |
| throw 'kind is required but was not provided'; |
| } |
| if (uri == null) { |
| throw 'uri is required but was not provided'; |
| } |
| } |
| static DeleteFile fromJson(Map<String, dynamic> json) { |
| final kind = json['kind']; |
| final uri = json['uri']; |
| final options = json['options'] != null |
| ? DeleteFileOptions.fromJson(json['options']) |
| : null; |
| return new DeleteFile(kind, uri, options); |
| } |
| |
| /// A delete |
| final String kind; |
| |
| /// Delete options. |
| final DeleteFileOptions options; |
| |
| /// The file to delete. |
| final String uri; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| __result['kind'] = kind ?? (throw 'kind is required but was not set'); |
| __result['uri'] = uri ?? (throw 'uri is required but was not set'); |
| if (options != null) { |
| __result['options'] = options; |
| } |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| obj.containsKey('kind') && |
| obj['kind'] is String && |
| obj.containsKey('uri') && |
| obj['uri'] is String && |
| (obj['options'] == null || DeleteFileOptions.canParse(obj['options'])); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is DeleteFile) { |
| return kind == other.kind && |
| uri == other.uri && |
| options == other.options && |
| true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, kind.hashCode); |
| hash = JenkinsSmiHash.combine(hash, uri.hashCode); |
| hash = JenkinsSmiHash.combine(hash, options.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| /// Delete file options |
| class DeleteFileOptions implements ToJsonable { |
| static const jsonHandler = const LspJsonHandler( |
| DeleteFileOptions.canParse, DeleteFileOptions.fromJson); |
| |
| DeleteFileOptions(this.recursive, this.ignoreIfNotExists); |
| static DeleteFileOptions fromJson(Map<String, dynamic> json) { |
| final recursive = json['recursive']; |
| final ignoreIfNotExists = json['ignoreIfNotExists']; |
| return new DeleteFileOptions(recursive, ignoreIfNotExists); |
| } |
| |
| /// Ignore the operation if the file doesn't exist. |
| final bool ignoreIfNotExists; |
| |
| /// Delete the content recursively if a folder is denoted. |
| final bool recursive; |
| |
| Map<String, dynamic> toJson() { |
| Map<String, dynamic> __result = {}; |
| if (recursive != null) { |
| __result['recursive'] = recursive; |
| } |
| if (ignoreIfNotExists != null) { |
| __result['ignoreIfNotExists'] = ignoreIfNotExists; |
| } |
| return __result; |
| } |
| |
| static bool canParse(Object obj) { |
| return obj is Map<String, dynamic> && |
| (obj['recursive'] == null || obj['recursive'] is bool) && |
| (obj['ignoreIfNotExists'] == null || obj['ignoreIfNotExists'] is bool); |
| } |
| |
| @override |
| bool operator ==(other) { |
| if (other is DeleteFileOptions) { |
| return recursive == other.recursive && |
| ignoreIfNotExists == other.ignoreIfNotExists && |
| true; |
| } |
| return false; |
| } |
| |
| @override |
| int get hashCode { |
| int hash = 0; |
| hash = JenkinsSmiHash.combine(hash, recursive.hashCode); |
| hash = JenkinsSmiHash.combine(hash, ignoreIfNotExists.hashCode); |
| return JenkinsSmiHash.finish(hash); |
| } |
| |
| @override |
| String toString() => jsonEncoder.convert(toJson()); |
| } |
| |
| class Diagnostic implements ToJsonable { |
| static const jsonHandler = |
| const LspJsonHandler(Diagnostic.canParse, Diagnostic.fromJson); |
| |
| Diagnostic(this.range, this.severity, this.code, this.source, this.message, |
| this.relatedInformation) { |
| if (range == null) { |
| throw 'range is required but was not provided'; |
| } |
| if (message == null) { |
| throw 'message is required but was not provided'; |
| } |
| } |
| static Diagnostic fromJson(Map<String, dynamic> json) { |
| final range = json['range'] != null ? Range.fromJson(json['range']) : null; |
| final severity = json['severity'] != null |
| ? DiagnosticSeverity.fromJson(json['severity']) |
| : null; |
| final code = json['code']; |
| final source = json['source']; |
| final message = json['message']; |
| final relatedInformation = json['relatedInformation'] |
| ?.map((item) => |
| item != null ? DiagnosticRelatedInformation.fromJson(item) : null) |
| ?.cast<DiagnosticRelatedInformation>() |
| ?.toList(); |
| return new Diagnostic( |
| range, severity, code, source, message, relatedInformation); |
| } |
| |
| /// The diagnostic's code, which might appear in the user interface. |
|