blob: e1e4b90ff78bc945ddcea10cb6012f491f4015d4 [file] [log] [blame]
// 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".
import 'dart:core' hide deprecated;
import 'dart:core' as core show deprecated;
import 'package:analysis_server/lsp_protocol/protocol_special.dart';
class ApplyWorkspaceEditParams implements ToJsonable {
ApplyWorkspaceEditParams(this.label, this.edit) {
if (edit == null) {
throw 'edit is required but was not provided';
}
}
factory ApplyWorkspaceEditParams.fromJson(Map<String, dynamic> json) {
final label = json['label'];
final edit =
json['edit'] != null ? new 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.containsKey('edit') &&
WorkspaceEdit.canParse(obj['edit']);
}
}
class ApplyWorkspaceEditResponse implements ToJsonable {
ApplyWorkspaceEditResponse(this.applied) {
if (applied == null) {
throw 'applied is required but was not provided';
}
}
factory 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;
}
}
class CancelParams implements ToJsonable {
CancelParams(this.id) {
if (id == null) {
throw 'id is required but was not provided';
}
}
factory 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 (number, 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);
}
}
class ClientCapabilities implements ToJsonable {
ClientCapabilities(this.workspace, this.textDocument, this.experimental);
factory ClientCapabilities.fromJson(Map<String, dynamic> json) {
final workspace = json['workspace'] != null
? new WorkspaceClientCapabilities.fromJson(json['workspace'])
: null;
final textDocument = json['textDocument'] != null
? new 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>;
}
}
/// 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 {
CodeAction(this.title, this.kind, this.diagnostics, this.edit, this.command) {
if (title == null) {
throw 'title is required but was not provided';
}
}
factory CodeAction.fromJson(Map<String, dynamic> json) {
final title = json['title'];
final kind = json['kind'];
final diagnostics = json['diagnostics']
?.map((item) => item != null ? new Diagnostic.fromJson(item) : null)
?.cast<Diagnostic>()
?.toList();
final edit =
json['edit'] != null ? new WorkspaceEdit.fromJson(json['edit']) : null;
final command =
json['command'] != null ? new 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 String 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;
}
}
/// Contains additional diagnostic information about the context in which a code
/// action is run.
class CodeActionContext implements ToJsonable {
CodeActionContext(this.diagnostics, this.only) {
if (diagnostics == null) {
throw 'diagnostics is required but was not provided';
}
}
factory CodeActionContext.fromJson(Map<String, dynamic> json) {
final diagnostics = json['diagnostics']
?.map((item) => item != null ? new Diagnostic.fromJson(item) : null)
?.cast<Diagnostic>()
?.toList();
final only = json['only']?.map((item) => item)?.cast<String>()?.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<String> 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'].length == 0 ||
obj['diagnostics'].every((item) => Diagnostic.canParse(item))));
}
}
/// A set of predefined code action kinds
abstract class CodeActionKind {
/// Base kind for quickfix actions: 'quickfix'
static const QuickFix = 'quickfix';
/// Base kind for refactoring actions: 'refactor'
static const Refactor = '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 = 'refactor.extract';
/// Base kind for refactoring inline actions: 'refactor.inline'
///
/// Example inline actions:
///
/// - Inline function
/// - Inline variable
/// - Inline constant
/// - ...
static const RefactorInline = '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 = 'refactor.rewrite';
/// Base kind for source actions: `source`
///
/// Source code actions apply to the entire file.
static const Source = 'source';
/// Base kind for an organize imports source action: `source.organizeImports`
static const SourceOrganizeImports = 'source.organizeImports';
}
/// Code Action options.
class CodeActionOptions implements ToJsonable {
CodeActionOptions(this.codeActionKinds);
factory CodeActionOptions.fromJson(Map<String, dynamic> json) {
final codeActionKinds =
json['codeActionKinds']?.map((item) => item)?.cast<String>()?.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<String> 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>;
}
}
/// Params for the CodeActionRequest
class CodeActionParams implements ToJsonable {
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';
}
}
factory CodeActionParams.fromJson(Map<String, dynamic> json) {
final textDocument = json['textDocument'] != null
? new TextDocumentIdentifier.fromJson(json['textDocument'])
: null;
final range =
json['range'] != null ? new Range.fromJson(json['range']) : null;
final context = json['context'] != null
? new 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']);
}
}
class CodeActionRegistrationOptions
implements TextDocumentRegistrationOptions, CodeActionOptions, ToJsonable {
CodeActionRegistrationOptions(this.documentSelector, this.codeActionKinds);
factory CodeActionRegistrationOptions.fromJson(Map<String, dynamic> json) {
final documentSelector = json['documentSelector']
?.map((item) => item != null ? new DocumentFilter.fromJson(item) : null)
?.cast<DocumentFilter>()
?.toList();
final codeActionKinds =
json['codeActionKinds']?.map((item) => item)?.cast<String>()?.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<String> 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'] is List &&
(obj['documentSelector'].length == 0 ||
obj['documentSelector']
.every((item) => DocumentFilter.canParse(item))));
}
}
/// 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 {
CodeLens(this.range, this.command, this.data) {
if (range == null) {
throw 'range is required but was not provided';
}
}
factory CodeLens.fromJson(Map<String, dynamic> json) {
final range =
json['range'] != null ? new Range.fromJson(json['range']) : null;
final command =
json['command'] != null ? new 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']);
}
}
/// Code Lens options.
class CodeLensOptions implements ToJsonable {
CodeLensOptions(this.resolveProvider);
factory 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>;
}
}
class CodeLensParams implements ToJsonable {
CodeLensParams(this.textDocument) {
if (textDocument == null) {
throw 'textDocument is required but was not provided';
}
}
factory CodeLensParams.fromJson(Map<String, dynamic> json) {
final textDocument = json['textDocument'] != null
? new 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']);
}
}
class CodeLensRegistrationOptions
implements TextDocumentRegistrationOptions, ToJsonable {
CodeLensRegistrationOptions(this.resolveProvider, this.documentSelector);
factory CodeLensRegistrationOptions.fromJson(Map<String, dynamic> json) {
final resolveProvider = json['resolveProvider'];
final documentSelector = json['documentSelector']
?.map((item) => item != null ? new 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.containsKey('documentSelector') &&
(obj['documentSelector'] is List &&
(obj['documentSelector'].length == 0 ||
obj['documentSelector']
.every((item) => DocumentFilter.canParse(item))));
}
}
/// Represents a color in RGBA space.
class Color implements ToJsonable {
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';
}
}
factory 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);
}
final num alpha;
final num blue;
final num green;
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;
}
}
class ColorInformation implements ToJsonable {
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';
}
}
factory ColorInformation.fromJson(Map<String, dynamic> json) {
final range =
json['range'] != null ? new Range.fromJson(json['range']) : null;
final color =
json['color'] != null ? new 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']);
}
}
class ColorPresentation implements ToJsonable {
ColorPresentation(this.label, this.textEdit, this.additionalTextEdits) {
if (label == null) {
throw 'label is required but was not provided';
}
}
factory ColorPresentation.fromJson(Map<String, dynamic> json) {
final label = json['label'];
final textEdit = json['textEdit'] != null
? new TextEdit.fromJson(json['textEdit'])
: null;
final additionalTextEdits = json['additionalTextEdits']
?.map((item) => item != null ? new 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;
}
}
class ColorPresentationParams implements ToJsonable {
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';
}
}
factory ColorPresentationParams.fromJson(Map<String, dynamic> json) {
final textDocument = json['textDocument'] != null
? new TextDocumentIdentifier.fromJson(json['textDocument'])
: null;
final color =
json['color'] != null ? new Color.fromJson(json['color']) : null;
final range =
json['range'] != null ? new 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']);
}
}
/// Color provider options.
class ColorProviderOptions implements ToJsonable {
Map<String, dynamic> toJson() {
Map<String, dynamic> __result = {};
return __result;
}
static bool canParse(Object obj) {
return obj is Map<String, dynamic>;
}
}
class Command implements ToJsonable {
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';
}
}
factory 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;
}
}
/// Contains additional information about the context in which a completion
/// request is triggered.
class CompletionContext implements ToJsonable {
CompletionContext(this.triggerKind, this.triggerCharacter) {
if (triggerKind == null) {
throw 'triggerKind is required but was not provided';
}
}
factory CompletionContext.fromJson(Map<String, dynamic> json) {
final triggerKind = json['triggerKind'] != null
? new 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']);
}
}
class CompletionItem implements ToJsonable {
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';
}
}
factory CompletionItem.fromJson(Map<String, dynamic> json) {
final label = json['label'];
final kind = json['kind'] != null
? new 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
? new MarkupContent.fromJson(json['documentation'])
: 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
? new InsertTextFormat.fromJson(json['insertTextFormat'])
: null;
final textEdit = json['textEdit'] != null
? new TextEdit.fromJson(json['textEdit'])
: null;
final additionalTextEdits = json['additionalTextEdits']
?.map((item) => item != null ? new TextEdit.fromJson(item) : null)
?.cast<TextEdit>()
?.toList();
final commitCharacters =
json['commitCharacters']?.map((item) => item)?.cast<String>()?.toList();
final command =
json['command'] != null ? new 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;
}
// ignore: deprecated_member_use
if (insertText != null) {
// ignore: deprecated_member_use
__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;
}
}
/// The kind of a completion entry.
class CompletionItemKind {
const CompletionItemKind._(this._value);
const CompletionItemKind.fromJson(this._value);
final Object _value;
static bool canParse(Object obj) {
switch (obj) {
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
case 19:
case 20:
case 21:
case 22:
case 23:
case 24:
case 25:
return true;
}
return false;
}
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 {
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';
}
}
factory CompletionList.fromJson(Map<String, dynamic> json) {
final isIncomplete = json['isIncomplete'];
final items = json['items']
?.map((item) => item != null ? new 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'].length == 0 ||
obj['items'].every((item) => CompletionItem.canParse(item))));
}
}
/// Completion options.
class CompletionOptions implements ToJsonable {
CompletionOptions(this.resolveProvider, this.triggerCharacters);
factory 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>;
}
}
class CompletionParams implements TextDocumentPositionParams, ToJsonable {
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';
}
}
factory CompletionParams.fromJson(Map<String, dynamic> json) {
final context = json['context'] != null
? new CompletionContext.fromJson(json['context'])
: null;
final textDocument = json['textDocument'] != null
? new TextDocumentIdentifier.fromJson(json['textDocument'])
: null;
final position = json['position'] != null
? new 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.containsKey('textDocument') &&
TextDocumentIdentifier.canParse(obj['textDocument']) &&
obj.containsKey('position') &&
Position.canParse(obj['position']);
}
}
class CompletionRegistrationOptions
implements TextDocumentRegistrationOptions, ToJsonable {
CompletionRegistrationOptions(
this.triggerCharacters, this.resolveProvider, this.documentSelector);
factory 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 ? new 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.containsKey('documentSelector') &&
(obj['documentSelector'] is List &&
(obj['documentSelector'].length == 0 ||
obj['documentSelector']
.every((item) => DocumentFilter.canParse(item))));
}
}
/// How a completion was triggered
class CompletionTriggerKind {
const CompletionTriggerKind._(this._value);
const CompletionTriggerKind.fromJson(this._value);
final Object _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 {
ConfigurationItem(this.scopeUri, this.section);
factory 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>;
}
}
class ConfigurationParams implements ToJsonable {
ConfigurationParams(this.items) {
if (items == null) {
throw 'items is required but was not provided';
}
}
factory ConfigurationParams.fromJson(Map<String, dynamic> json) {
final items = json['items']
?.map((item) =>
item != null ? new 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'].length == 0 ||
obj['items']
.every((item) => ConfigurationItem.canParse(item))));
}
}
/// Create file operation
class CreateFile implements FileOperation, ToJsonable {
CreateFile(this.uri, this.options) {
if (uri == null) {
throw 'uri is required but was not provided';
}
}
factory CreateFile.fromJson(Map<String, dynamic> json) {
final uri = json['uri'];
final options = json['options'] != null
? new CreateFileOptions.fromJson(json['options'])
: null;
return new CreateFile(uri, options);
}
/// Additional options
final CreateFileOptions options;
/// The resource to create.
final String uri;
Map<String, dynamic> toJson() {
Map<String, dynamic> __result = {};
__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('uri') &&
obj['uri'] is String;
}
}
/// Options to create a file.
class CreateFileOptions implements ToJsonable {
CreateFileOptions(this.overwrite, this.ignoreIfExists);
factory 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>;
}
}
/// Delete file operation
class DeleteFile implements FileOperation, ToJsonable {
DeleteFile(this.uri, this.options) {
if (uri == null) {
throw 'uri is required but was not provided';
}
}
factory DeleteFile.fromJson(Map<String, dynamic> json) {
final uri = json['uri'];
final options = json['options'] != null
? new DeleteFileOptions.fromJson(json['options'])
: null;
return new DeleteFile(uri, options);
}
/// Delete options.
final DeleteFileOptions options;
/// The file to delete.
final String uri;
Map<String, dynamic> toJson() {
Map<String, dynamic> __result = {};
__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('uri') &&
obj['uri'] is String;
}
}
/// Delete file options
class DeleteFileOptions implements ToJsonable {
DeleteFileOptions(this.recursive, this.ignoreIfNotExists);
factory 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>;
}
}
class Diagnostic implements ToJsonable {
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';
}
}
factory Diagnostic.fromJson(Map<String, dynamic> json) {
final range =
json['range'] != null ? new Range.fromJson(json['range']) : null;
final severity = json['severity'] != null
? new DiagnosticSeverity.fromJson(json['severity'])
: null;
final code = json['code'] is num
? new Either2<num, String>.t1(json['code'])
: (json['code'] is String
? new Either2<num, String>.t2(json['code'])
: (throw '''${json['code']} was not one of (number, string)'''));
final source = json['source'];
final message = json['message'];
final relatedInformation = json['relatedInformation']
?.map((item) => item != null
? new 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.
final Either2<num, String> code;
/// The diagnostic's message.
final String message;
/// The range at which the message applies.
final Range range;
/// An array of related diagnostic information, e.g. when symbol-names
/// within a scope collide all definitions can be marked via this
/// property.
final List<DiagnosticRelatedInformation> relatedInformation;
/// The diagnostic's severity. Can be omitted. If omitted it is up to the
/// client to interpret diagnostics as error, warning, info or hint.
final DiagnosticSeverity severity;
/// A human-readable string describing the source of this diagnostic, e.g.
/// 'typescript' or 'super lint'.
final String source;
Map<String, dynamic> toJson() {
Map<String, dynamic> __result = {};
__result['range'] = range ?? (throw 'range is required but was not set');
if (severity != null) {
__result['severity'] = severity;
}
if (code != null) {
__result['code'] = code;
}
if (source != null) {
__result['source'] = source;
}
__result['message'] =
message ?? (throw 'message is required but was not set');
if (relatedInformation != null) {
__result['relatedInformation'] = relatedInformation;
}
return __result;
}
static bool canParse(Object obj) {
return obj is Map<String, dynamic> &&
obj.containsKey('range') &&
Range.canParse(obj['range']) &&
obj.containsKey('message') &&
obj['message'] is String;
}
}
/// 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 a symbol in a scope.
class DiagnosticRelatedInformation implements ToJsonable {
DiagnosticRelatedInformation(this.location, this.message) {
if (location == null) {
throw 'location is required but was not provided';
}
if (message == null) {
throw 'message is required but was not provided';
}
}
factory DiagnosticRelatedInformation.fromJson(Map<String, dynamic> json) {
final location = json['location'] != null
? new Location.fromJson(json['location'])
: null;
final message = json['message'];
return new DiagnosticRelatedInformation(location, message);
}
/// The location of this related diagnostic information.
final Location location;
/// The message of this related diagnostic information.
final String message;
Map<String, dynamic> toJson() {
Map<String, dynamic> __result = {};
__result['location'] =
location ?? (throw 'location is required but was not set');
__result['message'] =
message ?? (throw 'message is required but was not set');
return __result;
}
static bool canParse(Object obj) {
return obj is Map<String, dynamic> &&
obj.containsKey('location') &&
Location.canParse(obj['location']) &&
obj.containsKey('message') &&
obj['message'] is String;
}
}
class DiagnosticSeverity {
const DiagnosticSeverity._(this._value);
const DiagnosticSeverity.fromJson(this._value);
final Object _value;
static bool canParse(Object obj) {
switch (obj) {
case 1:
case 2:
case 3:
case 4:
return true;
}
return false;
}
/// Reports an error.
static const Error = const DiagnosticSeverity._(1);
/// Reports a warning.
static const Warning = const DiagnosticSeverity._(2);
/// Reports an information.
static const Information = const DiagnosticSeverity._(3);
/// Reports a hint.
static const Hint = const DiagnosticSeverity._(4);
Object toJson() => _value;
@override
String toString() => _value.toString();
@override
get hashCode => _value.hashCode;
bool operator ==(o) => o is DiagnosticSeverity && o._value == _value;
}
class DidChangeConfigurationParams implements ToJsonable {
DidChangeConfigurationParams(this.settings) {
if (settings == null) {
throw 'settings is required but was not provided';
}
}
factory DidChangeConfigurationParams.fromJson(Map<String, dynamic> json) {
final settings = json['settings'];
return new DidChangeConfigurationParams(settings);
}
/// The actual changed settings
final dynamic settings;
Map<String, dynamic> toJson() {
Map<String, dynamic> __result = {};
__result['settings'] =
settings ?? (throw 'settings is required but was not set');
return __result;
}
static bool canParse(Object obj) {
return obj is Map<String, dynamic> && obj.containsKey('settings') && true;
}
}
class DidChangeTextDocumentParams implements ToJsonable {
DidChangeTextDocumentParams(this.textDocument, this.contentChanges) {
if (textDocument == null) {
throw 'textDocument is required but was not provided';
}
if (contentChanges == null) {
throw 'contentChanges is required but was not provided';
}
}
factory DidChangeTextDocumentParams.fromJson(Map<String, dynamic> json) {
final textDocument = json['textDocument'] != null
? new VersionedTextDocumentIdentifier.fromJson(json['textDocument'])
: null;
final contentChanges = json['contentChanges']
?.map((item) => item != null
? new TextDocumentContentChangeEvent.fromJson(item)
: null)
?.cast<TextDocumentContentChangeEvent>()
?.toList();
return new 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<TextDocumentContentChangeEvent> contentChanges;
/// The document that did change. The version number points to the
/// version after all provided content changes have been applied.
final VersionedTextDocumentIdentifier textDocument;
Map<String, dynamic> toJson() {
Map<String, dynamic> __result = {};
__result['textDocument'] =
textDocument ?? (throw 'textDocument is required but was not set');
__result['contentChanges'] =
contentChanges ?? (throw 'contentChanges is required but was not set');
return __result;
}
static bool canParse(Object obj) {
return obj is Map<String, dynamic> &&
obj.containsKey('textDocument') &&
VersionedTextDocumentIdentifier.canParse(obj['textDocument']) &&
obj.containsKey('contentChanges') &&
(obj['contentChanges'] is List &&
(obj['contentChanges'].length == 0 ||
obj['contentChanges'].every(
(item) => TextDocumentContentChangeEvent.canParse(item))));
}
}
class DidChangeWatchedFilesParams implements ToJsonable {
DidChangeWatchedFilesParams(this.changes) {
if (changes == null) {
throw 'changes is required but was not provided';
}
}
factory DidChangeWatchedFilesParams.fromJson(Map<String, dynamic> json) {
final changes = json['changes']
?.map((item) => item != null ? new FileEvent.fromJson(item) : null)
?.cast<FileEvent>()
?.toList();
return new DidChangeWatchedFilesParams(changes);
}
/// The actual file events.
final List<FileEvent> changes;
Map<String, dynamic> toJson() {
Map<String, dynamic> __result = {};
__result['changes'] =
changes ?? (throw 'changes is required but was not set');
return __result;
}
static bool canParse(Object obj) {
return obj is Map<String, dynamic> &&
obj.containsKey('changes') &&
(obj['changes'] is List &&
(obj['changes'].length == 0 ||
obj['changes'].every((item) => FileEvent.canParse(item))));
}
}
/// Describe options to be used when registering for text document change
/// events.
class DidChangeWatchedFilesRegistrationOptions implements ToJsonable {
DidChangeWatchedFilesRegistrationOptions(this.watchers) {
if (watchers == null) {
throw 'watchers is required but was not provided';
}
}
factory DidChangeWatchedFilesRegistrationOptions.fromJson(
Map<String, dynamic> json) {
final watchers = json['watchers']
?.map((item) =>
item != null ? new FileSystemWatcher.fromJson(item) : null)
?.cast<FileSystemWatcher>()
?.toList();
return new DidChangeWatchedFilesRegistrationOptions(watchers);
}
/// The watchers to register.
final List<FileSystemWatcher> watchers;
Map<String, dynamic> toJson() {
Map<String, dynamic> __result = {};
__result['watchers'] =
watchers ?? (throw 'watchers is required but was not set');
return __result;
}
static bool canParse(Object obj) {
return obj is Map<String, dynamic> &&
obj.containsKey('watchers') &&
(obj['watchers'] is List &&
(obj['watchers'].length == 0 ||
obj['watchers']
.every((item) => FileSystemWatcher.canParse(item))));
}
}
class DidChangeWorkspaceFoldersParams implements ToJsonable {
DidChangeWorkspaceFoldersParams(this.event) {
if (event == null) {
throw 'event is required but was not provided';
}
}
factory DidChangeWorkspaceFoldersParams.fromJson(Map<String, dynamic> json) {
final event = json['event'] != null
? new WorkspaceFoldersChangeEvent.fromJson(json['event'])
: null;
return new DidChangeWorkspaceFoldersParams(event);
}
/// The actual workspace folder change event.
final WorkspaceFoldersChangeEvent event;
Map<String, dynamic> toJson() {
Map<String, dynamic> __result = {};
__result['event'] = event ?? (throw 'event is required but was not set');
return __result;
}
static bool canParse(Object obj) {
return obj is Map<String, dynamic> &&
obj.containsKey('event') &&
WorkspaceFoldersChangeEvent.canParse(obj['event']);
}
}
class DidCloseTextDocumentParams implements ToJsonable {
DidCloseTextDocumentParams(this.textDocument) {
if (textDocument == null) {
throw 'textDocument is required but was not provided';
}
}
factory DidCloseTextDocumentParams.fromJson(Map<String, dynamic> json) {
final textDocument = json['textDocument'] != null
? new TextDocumentIdentifier.fromJson(json['textDocument'])
: null;
return new DidCloseTextDocumentParams(textDocument);
}
/// The document that was closed.
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']);
}
}
class DidOpenTextDocumentParams implements ToJsonable {
DidOpenTextDocumentParams(this.textDocument) {
if (textDocument == null) {
throw 'textDocument is required but was not provided';
}
}
factory DidOpenTextDocumentParams.fromJson(Map<String, dynamic> json) {
final textDocument = json['textDocument'] != null
? new TextDocumentItem.fromJson(json['textDocument'])
: null;
return new DidOpenTextDocumentParams(textDocument);
}
/// The document that was opened.
final TextDocumentItem 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') &&
TextDocumentItem.canParse(obj['textDocument']);
}
}
class DidSaveTextDocumentParams implements ToJsonable {
DidSaveTextDocumentParams(this.textDocument, this.text) {
if (textDocument == null) {
throw 'textDocument is required but was not provided';
}
}
factory DidSaveTextDocumentParams.fromJson(Map<String, dynamic> json) {
final textDocument = json['textDocument'] != null
? new TextDocumentIdentifier.fromJson(json['textDocument'])
: null;
final text = json['text'];
return new DidSaveTextDocumentParams(textDocument, text);
}
/// Optional the content when saved. Depends on the includeText value
/// when the save notification was requested.
final String text;
/// The document that was saved.
final TextDocumentIdentifier textDocument;
Map<String, dynamic> toJson() {
Map<String, dynamic> __result = {};
__result['textDocument'] =
textDocument ?? (throw 'textDocument is required but was not set');
if (text != null) {
__result['text'] = text;
}
return __result;
}
static bool canParse(Object obj) {
return obj is Map<String, dynamic> &&
obj.containsKey('textDocument') &&
TextDocumentIdentifier.canParse(obj['textDocument']);
}
}
class DocumentFilter implements ToJsonable {
DocumentFilter(this.language, this.scheme, this.pattern);
factory DocumentFilter.fromJson(Map<String, dynamic> json) {
final language = json['language'];
final scheme = json['scheme'];
final pattern = json['pattern'];
return new DocumentFilter(language, scheme, pattern);
}
/// A language id, like `typescript`.
final String language;
/// A glob pattern, like `*.{ts,js}`.
final String pattern;
/// A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
final String scheme;
Map<String, dynamic> toJson() {
Map<String, dynamic> __result = {};
if (language != null) {
__result['language'] = language;
}
if (scheme != null) {
__result['scheme'] = scheme;
}
if (pattern != null) {
__result['pattern'] = pattern;
}
return __result;
}
static bool canParse(Object obj) {
return obj is Map<String, dynamic>;
}
}
class DocumentFormattingParams implements ToJsonable {
DocumentFormattingParams(this.textDocument, this.options) {
if (textDocument == null) {
throw 'textDocument is required but was not provided';
}
if (options == null) {
throw 'options is required but was not provided';
}
}
factory DocumentFormattingParams.fromJson(Map<String, dynamic> json) {
final textDocument = json['textDocument'] != null
? new TextDocumentIdentifier.fromJson(json['textDocument'])
: null;
final options = json['options'] != null
? new FormattingOptions.fromJson(json['options'])
: null;
return new DocumentFormattingParams(textDocument, options);
}
/// The format options.
final FormattingOptions options;
/// The document to format.
final TextDocumentIdentifier textDocument;
Map<String, dynamic> toJson() {
Map<String, dynamic> __result = {};
__result['textDocument'] =
textDocument ?? (throw 'textDocument is required but was not set');
__result['options'] =
options ?? (throw 'options 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('options') &&
FormattingOptions.canParse(obj['options']);
}
}
/// A document highlight is a range inside a text document which deserves
/// special attention. Usually a document highlight is visualized by
/// changing the background color of its range.
class DocumentHighlight implements ToJsonable {
DocumentHighlight(this.range, this.kind) {
if (range == null) {
throw 'range is required but was not provided';
}
}
factory DocumentHighlight.fromJson(Map<String, dynamic> json) {
final range =
json['range'] != null ? new Range.fromJson(json['range']) : null;
final kind = json['kind'] != null
? new DocumentHighlightKind.fromJson(json['kind'])
: null;
return new DocumentHighlight(range, kind);
}
/// The highlight kind, default is DocumentHighlightKind.Text.
final DocumentHighlightKind kind;
/// The range this highlight applies to.
final Range range;
Map<String, dynamic> toJson() {
Map<String, dynamic> __result = {};
__result['range'] = range ?? (throw 'range is required but was not set');
if (kind != null) {
__result['kind'] = kind;
}
return __result;
}
static bool canParse(Object obj) {
return obj is Map<String, dynamic> &&
obj.containsKey('range') &&
Range.canParse(obj['range']);
}
}
/// A document highlight kind.
class DocumentHighlightKind {
const DocumentHighlightKind._(this._value);
const DocumentHighlightKind.fromJson(this._value);
final Object _value;
static bool canParse(Object obj) {
switch (obj) {
case 1:
case 2:
case 3:
return true;
}
return false;
}
/// A textual occurrence.
static const Text = const DocumentHighlightKind._(1);
/// Read-access of a symbol, like reading a variable.
static const Read = const DocumentHighlightKind._(2);
/// Write-access of a symbol, like writing to a variable.
static const Write = const DocumentHighlightKind._(3);
Object toJson() => _value;
@override
String toString() => _value.toString();
@override
get hashCode => _value.hashCode;
bool operator ==(o) => o is DocumentHighlightKind && o._value == _value;
}
/// 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 {
DocumentLink(this.range, this.target, this.data) {
if (range == null) {
throw 'range is required but was not provided';
}
}
factory DocumentLink.fromJson(Map<String, dynamic> json) {
final range =
json['range'] != null ? new Range.fromJson(json['range']) : null;
final target = json['target'];
final data = json['data'];
return new DocumentLink(range, target, data);
}
/// A data entry field that is preserved on a document link between a
/// DocumentLinkRequest and a DocumentLinkResolveRequest.
final dynamic data;
/// The range this link applies to.
final Range range;
/// The uri this link points to. If missing a resolve request is sent
/// later.
final String target;
Map<String, dynamic> toJson() {
Map<String, dynamic> __result = {};
__result['range'] = range ?? (throw 'range is required but was not set');
if (target != null) {
__result['target'] = target;
}
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']);
}
}
/// Document link options.
class DocumentLinkOptions implements ToJsonable {
DocumentLinkOptions(this.resolveProvider);
factory DocumentLinkOptions.fromJson(Map<String, dynamic> json) {
final resolveProvider = json['resolveProvider'];
return new DocumentLinkOptions(resolveProvider);
}
/// Document links have 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>;
}
}
class DocumentLinkParams implements ToJsonable {
DocumentLinkParams(this.textDocument) {
if (textDocument == null) {
throw 'textDocument is required but was not provided';
}
}
factory DocumentLinkParams.fromJson(Map<String, dynamic> json) {
final textDocument = json['textDocument'] != null
? new TextDocumentIdentifier.fromJson(json['textDocument'])
: null;
return new DocumentLinkParams(textDocument);
}
/// The document to provide document links 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']);
}
}
class DocumentLinkRegistrationOptions
implements TextDocumentRegistrationOptions, ToJsonable {
DocumentLinkRegistrationOptions(this.resolveProvider, this.documentSelector);
factory DocumentLinkRegistrationOptions.fromJson(Map<String, dynamic> json) {
final resolveProvider = json['resolveProvider'];
final documentSelector = json['documentSelector']
?.map((item) => item != null ? new DocumentFilter.fromJson(item) : null)
?.cast<DocumentFilter>()
?.toList();
return new DocumentLinkRegistrationOptions(
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;
/// Document links have 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.containsKey('documentSelector') &&
(obj['documentSelector'] is List &&
(obj['documentSelector'].length == 0 ||
obj['documentSelector']
.every((item) => DocumentFilter.canParse(item))));
}
}
/// Format document on type options.
class DocumentOnTypeFormattingOptions implements ToJsonable {
DocumentOnTypeFormattingOptions(
this.firstTriggerCharacter, this.moreTriggerCharacter) {
if (firstTriggerCharacter == null) {
throw 'firstTriggerCharacter is required but was not provided';
}
}
factory DocumentOnTypeFormattingOptions.fromJson(Map<String, dynamic> json) {
final firstTriggerCharacter = json['firstTriggerCharacter'];
final moreTriggerCharacter = json['moreTriggerCharacter']
?.map((item) => item)
?.cast<String>()
?.toList();
return new DocumentOnTypeFormattingOptions(
firstTriggerCharacter, moreTriggerCharacter);
}
/// A character on which formatting should be triggered, like `}`.
final String firstTriggerCharacter;
/// More trigger characters.
final List<String> moreTriggerCharacter;
Map<String, dynamic> toJson() {
Map<String, dynamic> __result = {};
__result['firstTriggerCharacter'] = firstTriggerCharacter ??
(throw 'firstTriggerCharacter is required but was not set');
if (moreTriggerCharacter != null) {
__result['moreTriggerCharacter'] = moreTriggerCharacter;
}
return __result;
}
static bool canParse(Object obj) {
return obj is Map<String, dynamic> &&
obj.containsKey('firstTriggerCharacter') &&
obj['firstTriggerCharacter'] is String;
}
}
class DocumentOnTypeFormattingParams implements ToJsonable {
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';
}
if (ch == null) {
throw 'ch is required but was not provided';
}
if (options == null) {
throw 'options is required but was not provided';
}
}
factory DocumentOnTypeFormattingParams.fromJson(Map<String, dynamic> json) {
final textDocument = json['textDocument'] != null
? new TextDocumentIdentifier.fromJson(json['textDocument'])
: null;
final position = json['position'] != null
? new Position.fromJson(json['position'])
: null;
final ch = json['ch'];
final options = json['options'] != null
? new FormattingOptions.fromJson(json['options'])
: null;
return new DocumentOnTypeFormattingParams(
textDocument, position, ch, options);
}
/// The character that has been typed.
final String ch;
/// The format options.
final FormattingOptions options;
/// The position at which this request was sent.
final Position position;
/// The document to format.
final TextDocumentIdentifier textDocument;
Map<String, dynamic> toJson() {
Map<String, dynamic> __result = {};
__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) {
return obj is Map<String, dynamic> &&
obj.containsKey('textDocument') &&
TextDocumentIdentifier.canParse(obj['textDocument']) &&
obj.containsKey('position') &&
Position.canParse(obj['position']) &&
obj.containsKey('ch') &&
obj['ch'] is String &&
obj.containsKey('options') &&
FormattingOptions.canParse(obj['options']);
}
}
class DocumentOnTypeFormattingRegistrationOptions
implements TextDocumentRegistrationOptions, ToJsonable {
DocumentOnTypeFormattingRegistrationOptions(this.firstTriggerCharacter,
this.moreTriggerCharacter, this.documentSelector) {
if (firstTriggerCharacter == null) {
throw 'firstTriggerCharacter is required but was not provided';
}
}
factory DocumentOnTypeFormattingRegistrationOptions.fromJson(
Map<String, dynamic> json) {
final firstTriggerCharacter = json['firstTriggerCharacter'];
final moreTriggerCharacter = json['moreTriggerCharacter']
?.map((item) => item)
?.cast<String>()
?.toList();
final documentSelector = json['documentSelector']
?.map((item) => item != null ? new DocumentFilter.fromJson(item) : null)
?.cast<DocumentFilter>()
?.toList();
return new DocumentOnTypeFormattingRegistrationOptions(
firstTriggerCharacter, moreTriggerCharacter, 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;
/// A character on which formatting should be triggered, like `}`.
final String firstTriggerCharacter;
/// More trigger characters.
final List<String> moreTriggerCharacter;
Map<String, dynamic> toJson() {
Map<String, dynamic> __result = {};
__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) {
return obj is Map<String, dynamic> &&
obj.containsKey('firstTriggerCharacter') &&
obj['firstTriggerCharacter'] is String &&
obj.containsKey('documentSelector') &&
(obj['documentSelector'] is List &&
(obj['documentSelector'].length == 0 ||
obj['documentSelector']
.every((item) => DocumentFilter.canParse(item))));
}
}
class DocumentRangeFormattingParams implements ToJsonable {
DocumentRangeFormattingParams(this.textDocument, this.range, this.options) {
if (textDocument == null) {
throw 'textDocument is required but was not provided';
}
if (range == null) {
throw 'range is required but was not provided';
}
if (options == null) {
throw 'options is required but was not provided';
}
}
factory DocumentRangeFormattingParams.fromJson(Map<String, dynamic> json) {
final textDocument = json['textDocument'] != null
? new TextDocumentIdentifier.fromJson(json['textDocument'])
: null;
final range =
json['range'] != null ? new Range.fromJson(json['range']) : null;
final options = json['options'] != null
? new FormattingOptions.fromJson(json['options'])
: null;
return new DocumentRangeFormattingParams(textDocument, range, options);
}
/// The format options
final FormattingOptions options;
/// The range to format
final Range range;
/// The document to format.
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');