blob: e7923754bcff8fd2954a1cdcea57211339168095 [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".
// ignore_for_file: annotate_overrides
// ignore_for_file: unnecessary_parenthesis
import 'dart:core' hide deprecated;
import 'dart:core' as core show deprecated;
import 'dart:convert' show JsonEncoder;
import 'package:analysis_server/lsp_protocol/protocol_custom_generated.dart';
import 'package:analysis_server/lsp_protocol/protocol_special.dart';
import 'package:analysis_server/src/lsp/json_parsing.dart';
import 'package:analysis_server/src/protocol/protocol_internal.dart';
const jsonEncoder = JsonEncoder.withIndent(' ');
/// A special text edit with an additional change annotation.
/// @since 3.16.0.
class AnnotatedTextEdit implements TextEdit, ToJsonable {
static const jsonHandler =
LspJsonHandler(AnnotatedTextEdit.canParse, AnnotatedTextEdit.fromJson);
AnnotatedTextEdit(
{required this.annotationId, required this.range, required this.newText});
static AnnotatedTextEdit fromJson(Map<String, Object?> json) {
final annotationIdJson = json['annotationId'];
final annotationId = annotationIdJson as String;
final rangeJson = json['range'];
final range = Range.fromJson(rangeJson as Map<String, Object?>);
final newTextJson = json['newText'];
final newText = newTextJson as String;
return AnnotatedTextEdit(
annotationId: annotationId, range: range, newText: newText);
}
/// The actual annotation identifier.
final String annotationId;
/// The string to be inserted. For delete operations use an empty string.
final String newText;
/// The range of the text document to be manipulated. To insert text into a
/// document create a range where start === end.
final Range range;
Map<String, Object?> toJson() {
var __result = <String, Object?>{};
__result['annotationId'] = annotationId;
__result['range'] = range.toJson();
__result['newText'] = newText;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
reporter.push('annotationId');
try {
if (!obj.containsKey('annotationId')) {
reporter.reportError('must not be undefined');
return false;
}
final annotationId = obj['annotationId'];
if (annotationId == null) {
reporter.reportError('must not be null');
return false;
}
if (!(annotationId is String)) {
reporter.reportError('must be of type String');
return false;
}
} finally {
reporter.pop();
}
reporter.push('range');
try {
if (!obj.containsKey('range')) {
reporter.reportError('must not be undefined');
return false;
}
final range = obj['range'];
if (range == null) {
reporter.reportError('must not be null');
return false;
}
if (!(Range.canParse(range, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
} finally {
reporter.pop();
}
reporter.push('newText');
try {
if (!obj.containsKey('newText')) {
reporter.reportError('must not be undefined');
return false;
}
final newText = obj['newText'];
if (newText == null) {
reporter.reportError('must not be null');
return false;
}
if (!(newText is String)) {
reporter.reportError('must be of type String');
return false;
}
} finally {
reporter.pop();
}
return true;
} else {
reporter.reportError('must be of type AnnotatedTextEdit');
return false;
}
}
@override
bool operator ==(Object other) {
if (other is AnnotatedTextEdit && other.runtimeType == AnnotatedTextEdit) {
return annotationId == other.annotationId &&
range == other.range &&
newText == other.newText &&
true;
}
return false;
}
@override
int get hashCode => Object.hash(annotationId, range, newText);
@override
String toString() => jsonEncoder.convert(toJson());
}
class ApplyWorkspaceEditParams implements ToJsonable {
static const jsonHandler = LspJsonHandler(
ApplyWorkspaceEditParams.canParse, ApplyWorkspaceEditParams.fromJson);
ApplyWorkspaceEditParams({this.label, required this.edit});
static ApplyWorkspaceEditParams fromJson(Map<String, Object?> json) {
final labelJson = json['label'];
final label = labelJson as String?;
final editJson = json['edit'];
final edit = WorkspaceEdit.fromJson(editJson as Map<String, Object?>);
return ApplyWorkspaceEditParams(label: label, edit: 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, Object?> toJson() {
var __result = <String, Object?>{};
if (label != null) {
__result['label'] = label;
}
__result['edit'] = edit.toJson();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
reporter.push('label');
try {
final label = obj['label'];
if (label != null && !(label is String)) {
reporter.reportError('must be of type String');
return false;
}
} finally {
reporter.pop();
}
reporter.push('edit');
try {
if (!obj.containsKey('edit')) {
reporter.reportError('must not be undefined');
return false;
}
final edit = obj['edit'];
if (edit == null) {
reporter.reportError('must not be null');
return false;
}
if (!(WorkspaceEdit.canParse(edit, reporter))) {
reporter.reportError('must be of type WorkspaceEdit');
return false;
}
} finally {
reporter.pop();
}
return true;
} else {
reporter.reportError('must be of type ApplyWorkspaceEditParams');
return false;
}
}
@override
bool operator ==(Object other) {
if (other is ApplyWorkspaceEditParams &&
other.runtimeType == ApplyWorkspaceEditParams) {
return label == other.label && edit == other.edit && true;
}
return false;
}
@override
int get hashCode => Object.hash(label, edit);
@override
String toString() => jsonEncoder.convert(toJson());
}
class ApplyWorkspaceEditResponse implements ToJsonable {
static const jsonHandler = LspJsonHandler(
ApplyWorkspaceEditResponse.canParse, ApplyWorkspaceEditResponse.fromJson);
ApplyWorkspaceEditResponse(
{required this.applied, this.failureReason, this.failedChange});
static ApplyWorkspaceEditResponse fromJson(Map<String, Object?> json) {
final appliedJson = json['applied'];
final applied = appliedJson as bool;
final failureReasonJson = json['failureReason'];
final failureReason = failureReasonJson as String?;
final failedChangeJson = json['failedChange'];
final failedChange = failedChangeJson as int?;
return ApplyWorkspaceEditResponse(
applied: applied,
failureReason: failureReason,
failedChange: failedChange);
}
/// Indicates whether the edit was applied or not.
final bool applied;
/// Depending on the client's failure handling strategy `failedChange` might
/// contain the index of the change that failed. This property is only
/// available if the client signals a `failureHandlingStrategy` in its client
/// capabilities.
final int? failedChange;
/// An optional textual description for why the edit was not applied. This may
/// be used by the server for diagnostic logging or to provide a suitable
/// error for a request that triggered the edit.
final String? failureReason;
Map<String, Object?> toJson() {
var __result = <String, Object?>{};
__result['applied'] = applied;
if (failureReason != null) {
__result['failureReason'] = failureReason;
}
if (failedChange != null) {
__result['failedChange'] = failedChange;
}
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
reporter.push('applied');
try {
if (!obj.containsKey('applied')) {
reporter.reportError('must not be undefined');
return false;
}
final applied = obj['applied'];
if (applied == null) {
reporter.reportError('must not be null');
return false;
}
if (!(applied is bool)) {
reporter.reportError('must be of type bool');
return false;
}
} finally {
reporter.pop();
}
reporter.push('failureReason');
try {
final failureReason = obj['failureReason'];
if (failureReason != null && !(failureReason is String)) {
reporter.reportError('must be of type String');
return false;
}
} finally {
reporter.pop();
}
reporter.push('failedChange');
try {
final failedChange = obj['failedChange'];
if (failedChange != null && !(failedChange is int)) {
reporter.reportError('must be of type int');
return false;
}
} finally {
reporter.pop();
}
return true;
} else {
reporter.reportError('must be of type ApplyWorkspaceEditResponse');
return false;
}
}
@override
bool operator ==(Object other) {
if (other is ApplyWorkspaceEditResponse &&
other.runtimeType == ApplyWorkspaceEditResponse) {
return applied == other.applied &&
failureReason == other.failureReason &&
failedChange == other.failedChange &&
true;
}
return false;
}
@override
int get hashCode => Object.hash(applied, failureReason, failedChange);
@override
String toString() => jsonEncoder.convert(toJson());
}
class CallHierarchyClientCapabilities implements ToJsonable {
static const jsonHandler = LspJsonHandler(
CallHierarchyClientCapabilities.canParse,
CallHierarchyClientCapabilities.fromJson);
CallHierarchyClientCapabilities({this.dynamicRegistration});
static CallHierarchyClientCapabilities fromJson(Map<String, Object?> json) {
final dynamicRegistrationJson = json['dynamicRegistration'];
final dynamicRegistration = dynamicRegistrationJson as bool?;
return CallHierarchyClientCapabilities(
dynamicRegistration: dynamicRegistration);
}
/// Whether implementation supports dynamic registration. If this is set to
/// `true` the client supports the new `(TextDocumentRegistrationOptions &
/// StaticRegistrationOptions)` return value for the corresponding server
/// capability as well.
final bool? dynamicRegistration;
Map<String, Object?> toJson() {
var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
} finally {
reporter.pop();
}
return true;
} else {
reporter.reportError('must be of type CallHierarchyClientCapabilities');
return false;
}
}
@override
bool operator ==(Object other) {
if (other is CallHierarchyClientCapabilities &&
other.runtimeType == CallHierarchyClientCapabilities) {
return dynamicRegistration == other.dynamicRegistration && true;
}
return false;
}
@override
int get hashCode => dynamicRegistration.hashCode;
@override
String toString() => jsonEncoder.convert(toJson());
}
class CallHierarchyIncomingCall implements ToJsonable {
static const jsonHandler = LspJsonHandler(
CallHierarchyIncomingCall.canParse, CallHierarchyIncomingCall.fromJson);
CallHierarchyIncomingCall({required this.from, required this.fromRanges});
static CallHierarchyIncomingCall fromJson(Map<String, Object?> json) {
final fromJson = json['from'];
final from = CallHierarchyItem.fromJson(fromJson as Map<String, Object?>);
final fromRangesJson = json['fromRanges'];
final fromRanges = (fromRangesJson as List<Object?>)
.map((item) => Range.fromJson(item as Map<String, Object?>))
.toList();
return CallHierarchyIncomingCall(from: from, fromRanges: fromRanges);
}
/// The item that makes the call.
final CallHierarchyItem from;
/// The ranges at which the calls appear. This is relative to the caller
/// denoted by [`this.from`](#CallHierarchyIncomingCall.from).
final List<Range> fromRanges;
Map<String, Object?> toJson() {
var __result = <String, Object?>{};
__result['from'] = from.toJson();
__result['fromRanges'] = fromRanges.map((item) => item.toJson()).toList();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
reporter.push('from');
try {
if (!obj.containsKey('from')) {
reporter.reportError('must not be undefined');
return false;
}
final from = obj['from'];
if (from == null) {
reporter.reportError('must not be null');
return false;
}
if (!(CallHierarchyItem.canParse(from, reporter))) {
reporter.reportError('must be of type CallHierarchyItem');
return false;
}
} finally {
reporter.pop();
}
reporter.push('fromRanges');
try {
if (!obj.containsKey('fromRanges')) {
reporter.reportError('must not be undefined');
return false;
}
final fromRanges = obj['fromRanges'];
if (fromRanges == null) {
reporter.reportError('must not be null');
return false;
}
if (!((fromRanges is List &&
(fromRanges.every((item) => Range.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<Range>');
return false;
}
} finally {
reporter.pop();
}
return true;
} else {
reporter.reportError('must be of type CallHierarchyIncomingCall');
return false;
}
}
@override
bool operator ==(Object other) {
if (other is CallHierarchyIncomingCall &&
other.runtimeType == CallHierarchyIncomingCall) {
return from == other.from &&
listEqual(
fromRanges, other.fromRanges, (Range a, Range b) => a == b) &&
true;
}
return false;
}
@override
int get hashCode => Object.hash(from, lspHashCode(fromRanges));
@override
String toString() => jsonEncoder.convert(toJson());
}
class CallHierarchyIncomingCallsParams
implements WorkDoneProgressParams, PartialResultParams, ToJsonable {
static const jsonHandler = LspJsonHandler(
CallHierarchyIncomingCallsParams.canParse,
CallHierarchyIncomingCallsParams.fromJson);
CallHierarchyIncomingCallsParams(
{required this.item, this.workDoneToken, this.partialResultToken});
static CallHierarchyIncomingCallsParams fromJson(Map<String, Object?> json) {
final itemJson = json['item'];
final item = CallHierarchyItem.fromJson(itemJson as Map<String, Object?>);
final workDoneTokenJson = json['workDoneToken'];
final workDoneToken = workDoneTokenJson == null
? null
: (workDoneTokenJson is int
? Either2<int, String>.t1(workDoneTokenJson)
: (workDoneTokenJson is String
? Either2<int, String>.t2(workDoneTokenJson)
: (throw '''$workDoneTokenJson was not one of (int, String)''')));
final partialResultTokenJson = json['partialResultToken'];
final partialResultToken = partialResultTokenJson == null
? null
: (partialResultTokenJson is int
? Either2<int, String>.t1(partialResultTokenJson)
: (partialResultTokenJson is String
? Either2<int, String>.t2(partialResultTokenJson)
: (throw '''$partialResultTokenJson was not one of (int, String)''')));
return CallHierarchyIncomingCallsParams(
item: item,
workDoneToken: workDoneToken,
partialResultToken: partialResultToken);
}
final CallHierarchyItem item;
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
final Either2<int, String>? partialResultToken;
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
Map<String, Object?> toJson() {
var __result = <String, Object?>{};
__result['item'] = item.toJson();
if (workDoneToken != null) {
__result['workDoneToken'] = workDoneToken;
}
if (partialResultToken != null) {
__result['partialResultToken'] = partialResultToken;
}
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
reporter.push('item');
try {
if (!obj.containsKey('item')) {
reporter.reportError('must not be undefined');
return false;
}
final item = obj['item'];
if (item == null) {
reporter.reportError('must not be null');
return false;
}
if (!(CallHierarchyItem.canParse(item, reporter))) {
reporter.reportError('must be of type CallHierarchyItem');
return false;
}
} finally {
reporter.pop();
}
reporter.push('workDoneToken');
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
!((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
} finally {
reporter.pop();
}
reporter.push('partialResultToken');
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
!((partialResultToken is int || partialResultToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
} finally {
reporter.pop();
}
return true;
} else {
reporter.reportError('must be of type CallHierarchyIncomingCallsParams');
return false;
}
}
@override
bool operator ==(Object other) {
if (other is CallHierarchyIncomingCallsParams &&
other.runtimeType == CallHierarchyIncomingCallsParams) {
return item == other.item &&
workDoneToken == other.workDoneToken &&
partialResultToken == other.partialResultToken &&
true;
}
return false;
}
@override
int get hashCode => Object.hash(item, workDoneToken, partialResultToken);
@override
String toString() => jsonEncoder.convert(toJson());
}
class CallHierarchyItem implements ToJsonable {
static const jsonHandler =
LspJsonHandler(CallHierarchyItem.canParse, CallHierarchyItem.fromJson);
CallHierarchyItem(
{required this.name,
required this.kind,
this.tags,
this.detail,
required this.uri,
required this.range,
required this.selectionRange,
this.data});
static CallHierarchyItem fromJson(Map<String, Object?> json) {
final nameJson = json['name'];
final name = nameJson as String;
final kindJson = json['kind'];
final kind = SymbolKind.fromJson(kindJson as int);
final tagsJson = json['tags'];
final tags = (tagsJson as List<Object?>?)
?.map((item) => SymbolTag.fromJson(item as num))
.toList();
final detailJson = json['detail'];
final detail = detailJson as String?;
final uriJson = json['uri'];
final uri = uriJson as String;
final rangeJson = json['range'];
final range = Range.fromJson(rangeJson as Map<String, Object?>);
final selectionRangeJson = json['selectionRange'];
final selectionRange =
Range.fromJson(selectionRangeJson as Map<String, Object?>);
final dataJson = json['data'];
final data = dataJson;
return CallHierarchyItem(
name: name,
kind: kind,
tags: tags,
detail: detail,
uri: uri,
range: range,
selectionRange: selectionRange,
data: data);
}
/// A data entry field that is preserved between a call hierarchy prepare and
/// incoming calls or outgoing calls requests.
final Object? data;
/// More detail for this item, e.g. the signature of a function.
final String? detail;
/// The kind of this item.
final SymbolKind kind;
/// The name of this item.
final String name;
/// The range enclosing this symbol not including leading/trailing whitespace
/// but everything else, e.g. comments and code.
final Range range;
/// The range that should be selected and revealed when this symbol is being
/// picked, e.g. the name of a function. Must be contained by the
/// [`range`](#CallHierarchyItem.range).
final Range selectionRange;
/// Tags for this item.
final List<SymbolTag>? tags;
/// The resource identifier of this item.
final String uri;
Map<String, Object?> toJson() {
var __result = <String, Object?>{};
__result['name'] = name;
__result['kind'] = kind.toJson();
if (tags != null) {
__result['tags'] = tags?.map((item) => item.toJson()).toList();
}
if (detail != null) {
__result['detail'] = detail;
}
__result['uri'] = uri;
__result['range'] = range.toJson();
__result['selectionRange'] = selectionRange.toJson();
if (data != null) {
__result['data'] = data;
}
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
reporter.push('name');
try {
if (!obj.containsKey('name')) {
reporter.reportError('must not be undefined');
return false;
}
final name = obj['name'];
if (name == null) {
reporter.reportError('must not be null');
return false;
}
if (!(name is String)) {
reporter.reportError('must be of type String');
return false;
}
} finally {
reporter.pop();
}
reporter.push('kind');
try {
if (!obj.containsKey('kind')) {
reporter.reportError('must not be undefined');
return false;
}
final kind = obj['kind'];
if (kind == null) {
reporter.reportError('must not be null');
return false;
}
if (!(SymbolKind.canParse(kind, reporter))) {
reporter.reportError('must be of type SymbolKind');
return false;
}
} finally {
reporter.pop();
}
reporter.push('tags');
try {
final tags = obj['tags'];
if (tags != null &&
!((tags is List &&
(tags.every((item) => SymbolTag.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<SymbolTag>');
return false;
}
} finally {
reporter.pop();
}
reporter.push('detail');
try {
final detail = obj['detail'];
if (detail != null && !(detail is String)) {
reporter.reportError('must be of type String');
return false;
}
} finally {
reporter.pop();
}
reporter.push('uri');
try {
if (!obj.containsKey('uri')) {
reporter.reportError('must not be undefined');
return false;
}
final uri = obj['uri'];
if (uri == null) {
reporter.reportError('must not be null');
return false;
}
if (!(uri is String)) {
reporter.reportError('must be of type String');
return false;
}
} finally {
reporter.pop();
}
reporter.push('range');
try {
if (!obj.containsKey('range')) {
reporter.reportError('must not be undefined');
return false;
}
final range = obj['range'];
if (range == null) {
reporter.reportError('must not be null');
return false;
}
if (!(Range.canParse(range, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
} finally {
reporter.pop();
}
reporter.push('selectionRange');
try {
if (!obj.containsKey('selectionRange')) {
reporter.reportError('must not be undefined');
return false;
}
final selectionRange = obj['selectionRange'];
if (selectionRange == null) {
reporter.reportError('must not be null');
return false;
}
if (!(Range.canParse(selectionRange, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
} finally {
reporter.pop();
}
return true;
} else {
reporter.reportError('must be of type CallHierarchyItem');
return false;
}
}
@override
bool operator ==(Object other) {
if (other is CallHierarchyItem && other.runtimeType == CallHierarchyItem) {
return name == other.name &&
kind == other.kind &&
listEqual(tags, other.tags, (SymbolTag a, SymbolTag b) => a == b) &&
detail == other.detail &&
uri == other.uri &&
range == other.range &&
selectionRange == other.selectionRange &&
data == other.data &&
true;
}
return false;
}
@override
int get hashCode => Object.hash(
name, kind, lspHashCode(tags), detail, uri, range, selectionRange, data);
@override
String toString() => jsonEncoder.convert(toJson());
}
class CallHierarchyOptions implements WorkDoneProgressOptions, ToJsonable {
static const jsonHandler = LspJsonHandler(
CallHierarchyOptions.canParse, CallHierarchyOptions.fromJson);
CallHierarchyOptions({this.workDoneProgress});
static CallHierarchyOptions fromJson(Map<String, Object?> json) {
if (CallHierarchyRegistrationOptions.canParse(json, nullLspJsonReporter)) {
return CallHierarchyRegistrationOptions.fromJson(json);
}
final workDoneProgressJson = json['workDoneProgress'];
final workDoneProgress = workDoneProgressJson as bool?;
return CallHierarchyOptions(workDoneProgress: workDoneProgress);
}
final bool? workDoneProgress;
Map<String, Object?> toJson() {
var __result = <String, Object?>{};
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
}
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
} finally {
reporter.pop();
}
return true;
} else {
reporter.reportError('must be of type CallHierarchyOptions');
return false;
}
}
@override
bool operator ==(Object other) {
if (other is CallHierarchyOptions &&
other.runtimeType == CallHierarchyOptions) {
return workDoneProgress == other.workDoneProgress && true;
}
return false;
}
@override
int get hashCode => workDoneProgress.hashCode;
@override
String toString() => jsonEncoder.convert(toJson());
}
class CallHierarchyOutgoingCall implements ToJsonable {
static const jsonHandler = LspJsonHandler(
CallHierarchyOutgoingCall.canParse, CallHierarchyOutgoingCall.fromJson);
CallHierarchyOutgoingCall({required this.to, required this.fromRanges});
static CallHierarchyOutgoingCall fromJson(Map<String, Object?> json) {
final toJson = json['to'];
final to = CallHierarchyItem.fromJson(toJson as Map<String, Object?>);
final fromRangesJson = json['fromRanges'];
final fromRanges = (fromRangesJson as List<Object?>)
.map((item) => Range.fromJson(item as Map<String, Object?>))
.toList();
return CallHierarchyOutgoingCall(to: to, fromRanges: fromRanges);
}
/// The range at which this item is called. This is the range relative to the
/// caller, e.g the item passed to `callHierarchy/outgoingCalls` request.
final List<Range> fromRanges;
/// The item that is called.
final CallHierarchyItem to;
Map<String, Object?> toJson() {
var __result = <String, Object?>{};
__result['to'] = to.toJson();
__result['fromRanges'] = fromRanges.map((item) => item.toJson()).toList();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
reporter.push('to');
try {
if (!obj.containsKey('to')) {
reporter.reportError('must not be undefined');
return false;
}
final to = obj['to'];
if (to == null) {
reporter.reportError('must not be null');
return false;
}
if (!(CallHierarchyItem.canParse(to, reporter))) {
reporter.reportError('must be of type CallHierarchyItem');
return false;
}
} finally {
reporter.pop();
}
reporter.push('fromRanges');
try {
if (!obj.containsKey('fromRanges')) {
reporter.reportError('must not be undefined');
return false;
}
final fromRanges = obj['fromRanges'];
if (fromRanges == null) {
reporter.reportError('must not be null');
return false;
}
if (!((fromRanges is List &&
(fromRanges.every((item) => Range.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<Range>');
return false;
}
} finally {
reporter.pop();
}
return true;
} else {
reporter.reportError('must be of type CallHierarchyOutgoingCall');
return false;
}
}
@override
bool operator ==(Object other) {
if (other is CallHierarchyOutgoingCall &&
other.runtimeType == CallHierarchyOutgoingCall) {
return to == other.to &&
listEqual(
fromRanges, other.fromRanges, (Range a, Range b) => a == b) &&
true;
}
return false;
}
@override
int get hashCode => Object.hash(to, lspHashCode(fromRanges));
@override
String toString() => jsonEncoder.convert(toJson());
}
class CallHierarchyOutgoingCallsParams
implements WorkDoneProgressParams, PartialResultParams, ToJsonable {
static const jsonHandler = LspJsonHandler(
CallHierarchyOutgoingCallsParams.canParse,
CallHierarchyOutgoingCallsParams.fromJson);
CallHierarchyOutgoingCallsParams(
{required this.item, this.workDoneToken, this.partialResultToken});
static CallHierarchyOutgoingCallsParams fromJson(Map<String, Object?> json) {
final itemJson = json['item'];
final item = CallHierarchyItem.fromJson(itemJson as Map<String, Object?>);
final workDoneTokenJson = json['workDoneToken'];
final workDoneToken = workDoneTokenJson == null
? null
: (workDoneTokenJson is int
? Either2<int, String>.t1(workDoneTokenJson)
: (workDoneTokenJson is String
? Either2<int, String>.t2(workDoneTokenJson)
: (throw '''$workDoneTokenJson was not one of (int, String)''')));
final partialResultTokenJson = json['partialResultToken'];
final partialResultToken = partialResultTokenJson == null
? null
: (partialResultTokenJson is int
? Either2<int, String>.t1(partialResultTokenJson)
: (partialResultTokenJson is String
? Either2<int, String>.t2(partialResultTokenJson)
: (throw '''$partialResultTokenJson was not one of (int, String)''')));
return CallHierarchyOutgoingCallsParams(
item: item,
workDoneToken: workDoneToken,
partialResultToken: partialResultToken);
}
final CallHierarchyItem item;
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
final Either2<int, String>? partialResultToken;
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
Map<String, Object?> toJson() {
var __result = <String, Object?>{};
__result['item'] = item.toJson();
if (workDoneToken != null) {
__result['workDoneToken'] = workDoneToken;
}
if (partialResultToken != null) {
__result['partialResultToken'] = partialResultToken;
}
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
reporter.push('item');
try {
if (!obj.containsKey('item')) {
reporter.reportError('must not be undefined');
return false;
}
final item = obj['item'];
if (item == null) {
reporter.reportError('must not be null');
return false;
}
if (!(CallHierarchyItem.canParse(item, reporter))) {
reporter.reportError('must be of type CallHierarchyItem');
return false;
}
} finally {
reporter.pop();
}
reporter.push('workDoneToken');
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
!((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
} finally {
reporter.pop();
}
reporter.push('partialResultToken');
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
!((partialResultToken is int || partialResultToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
} finally {
reporter.pop();
}
return true;
} else {
reporter.reportError('must be of type CallHierarchyOutgoingCallsParams');
return false;
}
}
@override
bool operator ==(Object other) {
if (other is CallHierarchyOutgoingCallsParams &&
other.runtimeType == CallHierarchyOutgoingCallsParams) {
return item == other.item &&
workDoneToken == other.workDoneToken &&
partialResultToken == other.partialResultToken &&
true;
}
return false;
}
@override
int get hashCode => Object.hash(item, workDoneToken, partialResultToken);
@override
String toString() => jsonEncoder.convert(toJson());
}
class CallHierarchyPrepareParams
implements TextDocumentPositionParams, WorkDoneProgressParams, ToJsonable {
static const jsonHandler = LspJsonHandler(
CallHierarchyPrepareParams.canParse, CallHierarchyPrepareParams.fromJson);
CallHierarchyPrepareParams(
{required this.textDocument, required this.position, this.workDoneToken});
static CallHierarchyPrepareParams fromJson(Map<String, Object?> json) {
final textDocumentJson = json['textDocument'];
final textDocument = TextDocumentIdentifier.fromJson(
textDocumentJson as Map<String, Object?>);
final positionJson = json['position'];
final position = Position.fromJson(positionJson as Map<String, Object?>);
final workDoneTokenJson = json['workDoneToken'];
final workDoneToken = workDoneTokenJson == null
? null
: (workDoneTokenJson is int
? Either2<int, String>.t1(workDoneTokenJson)
: (workDoneTokenJson is String
? Either2<int, String>.t2(workDoneTokenJson)
: (throw '''$workDoneTokenJson was not one of (int, String)''')));
return CallHierarchyPrepareParams(
textDocument: textDocument,
position: position,
workDoneToken: workDoneToken);
}
/// The position inside the text document.
final Position position;
/// The text document.
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
Map<String, Object?> toJson() {
var __result = <String, Object?>{};
__result['textDocument'] = textDocument.toJson();
__result['position'] = position.toJson();
if (workDoneToken != null) {
__result['workDoneToken'] = workDoneToken;
}
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
reporter.push('textDocument');
try {
if (!obj.containsKey('textDocument')) {
reporter.reportError('must not be undefined');
return false;
}
final textDocument = obj['textDocument'];
if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
} finally {
reporter.pop();
}
reporter.push('position');
try {
if (!obj.containsKey('position')) {
reporter.reportError('must not be undefined');
return false;
}
final position = obj['position'];
if (position == null) {
reporter.reportError('must not be null');
return false;
}
if (!(Position.canParse(position, reporter))) {
reporter.reportError('must be of type Position');
return false;
}
} finally {
reporter.pop();
}
reporter.push('workDoneToken');
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
!((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
} finally {
reporter.pop();
}
return true;
} else {
reporter.reportError('must be of type CallHierarchyPrepareParams');
return false;
}
}
@override
bool operator ==(Object other) {
if (other is CallHierarchyPrepareParams &&
other.runtimeType == CallHierarchyPrepareParams) {
return textDocument == other.textDocument &&
position == other.position &&
workDoneToken == other.workDoneToken &&
true;
}
return false;
}
@override
int get hashCode => Object.hash(textDocument, position, workDoneToken);
@override
String toString() => jsonEncoder.convert(toJson());
}
class CallHierarchyRegistrationOptions
implements
TextDocumentRegistrationOptions,
CallHierarchyOptions,
StaticRegistrationOptions,
ToJsonable {
static const jsonHandler = LspJsonHandler(
CallHierarchyRegistrationOptions.canParse,
CallHierarchyRegistrationOptions.fromJson);
CallHierarchyRegistrationOptions(
{this.documentSelector, this.workDoneProgress, this.id});
static CallHierarchyRegistrationOptions fromJson(Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
?.map((item) => DocumentFilter.fromJson(item as Map<String, Object?>))
.toList();
final workDoneProgressJson = json['workDoneProgress'];
final workDoneProgress = workDoneProgressJson as bool?;
final idJson = json['id'];
final id = idJson as String?;
return CallHierarchyRegistrationOptions(
documentSelector: documentSelector,
workDoneProgress: workDoneProgress,
id: id);
}
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
final List<DocumentFilter>? documentSelector;
/// The id used to register the request. The id can be used to deregister the
/// request again. See also Registration#id.
final String? id;
final bool? workDoneProgress;
Map<String, Object?> toJson() {
var __result = <String, Object?>{};
__result['documentSelector'] = documentSelector;
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
}
if (id != null) {
__result['id'] = id;
}
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
reporter.push('documentSelector');
try {
if (!obj.containsKey('documentSelector')) {
reporter.reportError('must not be undefined');
return false;
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
!((documentSelector is List &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
return false;
}
} finally {
reporter.pop();
}
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
} finally {
reporter.pop();
}
reporter.push('id');
try {
final id = obj['id'];
if (id != null && !(id is String)) {
reporter.reportError('must be of type String');
return false;
}
} finally {
reporter.pop();
}
return true;
} else {
reporter.reportError('must be of type CallHierarchyRegistrationOptions');
return false;
}
}
@override
bool operator ==(Object other) {
if (other is CallHierarchyRegistrationOptions &&
other.runtimeType == CallHierarchyRegistrationOptions) {
return listEqual(documentSelector, other.documentSelector,
(DocumentFilter a, DocumentFilter b) => a == b) &&
workDoneProgress == other.workDoneProgress &&
id == other.id &&
true;
}
return false;
}
@override
int get hashCode =>
Object.hash(lspHashCode(documentSelector), workDoneProgress, id);
@override
String toString() => jsonEncoder.convert(toJson());
}
class CancelParams implements ToJsonable {
static const jsonHandler =
LspJsonHandler(CancelParams.canParse, CancelParams.fromJson);
CancelParams({required this.id});
static CancelParams fromJson(Map<String, Object?> json) {
final idJson = json['id'];
final id = idJson is int
? Either2<int, String>.t1(idJson)
: (idJson is String
? Either2<int, String>.t2(idJson)
: (throw '''$idJson was not one of (int, String)'''));
return CancelParams(id: id);
}
/// The request id to cancel.
final Either2<int, String> id;
Map<String, Object?> toJson() {
var __result = <String, Object?>{};
__result['id'] = id;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
reporter.push('id');
try {
if (!obj.containsKey('id')) {
reporter.reportError('must not be undefined');
return false;
}
final id = obj['id'];
if (id == null) {
reporter.reportError('must not be null');
return false;
}
if (!((id is int || id is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
} finally {
reporter.pop();
}
return true;
} else {
reporter.reportError('must be of type CancelParams');
return false;
}
}
@override
bool operator ==(Object other) {
if (other is CancelParams && other.runtimeType == CancelParams) {
return id == other.id && true;
}
return false;
}
@override
int get hashCode => id.hashCode;
@override
String toString() => jsonEncoder.convert(toJson());
}
/// Additional information that describes document changes.
/// @since 3.16.0
class ChangeAnnotation implements ToJsonable {
static const jsonHandler =
LspJsonHandler(ChangeAnnotation.canParse, ChangeAnnotation.fromJson);
ChangeAnnotation(
{required this.label, this.needsConfirmation, this.description});
static ChangeAnnotation fromJson(Map<String, Object?> json) {
final labelJson = json['label'];
final label = labelJson as String;
final needsConfirmationJson = json['needsConfirmation'];
final needsConfirmation = needsConfirmationJson as bool?;
final descriptionJson = json['description'];
final description = descriptionJson as String?;
return ChangeAnnotation(
label: label,
needsConfirmation: needsConfirmation,
description: description);
}
/// A human-readable string which is rendered less prominent in the user
/// interface.
final String? description;
/// A human-readable string describing the actual change. The string is
/// rendered prominent in the user interface.
final String label;
/// A flag which indicates that user confirmation is needed before applying
/// the change.
final bool? needsConfirmation;
Map<String, Object?> toJson() {
var __result = <String, Object?>{};
__result['label'] = label;
if (needsConfirmation != null) {
__result['needsConfirmation'] = needsConfirmation;
}
if (description != null) {
__result['description'] = description;
}
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
reporter.push('label');
try {
if (!obj.containsKey('label')) {
reporter.reportError('must not be undefined');
return false;
}
final label = obj['label'];
if (label == null) {
reporter.reportError('must not be null');
return false;
}
if (!(label is String)) {
reporter.reportError('must be of type String');
return false;
}
} finally {
reporter.pop();
}
reporter.push('needsConfirmation');
try {
final needsConfirmation = obj['needsConfirmation'];
if (needsConfirmation != null && !(needsConfirmation is bool)) {
reporter.reportError('must be of type bool');
return false;
}
} finally {
reporter.pop();
}
reporter.push('description');
try {
final description = obj['description'];
if (description != null && !(description is String)) {
reporter.reportError('must be of type String');
return false;
}
} finally {
reporter.pop();
}
return true;
} else {
reporter.reportError('must be of type ChangeAnnotation');
return false;
}
}
@override
bool operator ==(Object other) {
if (other is ChangeAnnotation && other.runtimeType == ChangeAnnotation) {
return label == other.label &&
needsConfirmation == other.needsConfirmation &&
description == other.description &&
true;
}
return false;
}
@override
int get hashCode => Object.hash(label, needsConfirmation, description);
@override
String toString() => jsonEncoder.convert(toJson());
}
class ClientCapabilities implements ToJsonable {
static const jsonHandler =
LspJsonHandler(ClientCapabilities.canParse, ClientCapabilities.fromJson);
ClientCapabilities(
{this.workspace,
this.textDocument,
this.window,
this.general,
this.experimental});
static ClientCapabilities fromJson(Map<String, Object?> json) {
final workspaceJson = json['workspace'];
final workspace = workspaceJson != null
? ClientCapabilitiesWorkspace.fromJson(
workspaceJson as Map<String, Object?>)
: null;
final textDocumentJson = json['textDocument'];
final textDocument = textDocumentJson != null
? TextDocumentClientCapabilities.fromJson(
textDocumentJson as Map<String, Object?>)
: null;
final windowJson = json['window'];
final window = windowJson != null
? ClientCapabilitiesWindow.fromJson(windowJson as Map<String, Object?>)
: null;
final generalJson = json['general'];
final general = generalJson != null
? ClientCapabilitiesGeneral.fromJson(
generalJson as Map<String, Object?>)
: null;
final experimentalJson = json['experimental'];
final experimental = experimentalJson;
return ClientCapabilities(
workspace: workspace,
textDocument: textDocument,
window: window,
general: general,
experimental: experimental);
}
/// Experimental client capabilities.
final Object? experimental;
/// General client capabilities.
/// @since 3.16.0
final ClientCapabilitiesGeneral? general;
/// Text document specific client capabilities.
final TextDocumentClientCapabilities? textDocument;
/// Window specific client capabilities.
final ClientCapabilitiesWindow? window;
/// Workspace specific client capabilities.
final ClientCapabilitiesWorkspace? workspace;
Map<String, Object?> toJson() {
var __result = <String, Object?>{};
if (workspace != null) {
__result['workspace'] = workspace?.toJson();
}
if (textDocument != null) {
__result['textDocument'] = textDocument?.toJson();
}
if (window != null) {
__result['window'] = window?.toJson();
}
if (general != null) {
__result['general'] = general?.toJson();
}
if (experimental != null) {
__result['experimental'] = experimental;
}
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
reporter.push('workspace');
try {
final workspace = obj['workspace'];
if (workspace != null &&
!(ClientCapabilitiesWorkspace.canParse(workspace, reporter))) {
reporter.reportError('must be of type ClientCapabilitiesWorkspace');
return false;
}
} finally {
reporter.pop();
}
reporter.push('textDocument');
try {
final textDocument = obj['textDocument'];
if (textDocument != null &&
!(TextDocumentClientCapabilities.canParse(
textDocument, reporter))) {
reporter
.reportError('must be of type TextDocumentClientCapabilities');
return false;
}
} finally {
reporter.pop();
}
reporter.push('window');
try {
final window = obj['window'];
if (window != null &&
!(ClientCapabilitiesWindow.canParse(window, reporter))) {
reporter.reportError('must be of type ClientCapabilitiesWindow');
return false;
}
} finally {
reporter.pop();
}
reporter.push('general');
try {
final general = obj['general'];
if (general != null &&
!(ClientCapabilitiesGeneral.canParse(general, reporter))) {
reporter.reportError('must be of type ClientCapabilitiesGeneral');
return false;
}
} finally {
reporter.pop();
}
return true;
} else {
reporter.reportError('must be of type ClientCapabilities');
return false;
}
}
@override
bool operator ==(Object other) {
if (other is ClientCapabilities &&
other.runtimeType == ClientCapabilities) {
return workspace == other.workspace &&
textDocument == other.textDocument &&
window == other.window &&
general == other.general &&
experimental == other.experimental &&
true;
}
return false;
}
@override
int get hashCode =>
Object.hash(workspace, textDocument, window, general, experimental);
@override
String toString() => jsonEncoder.convert(toJson());
}
class ClientCapabilitiesFileOperations implements ToJsonable {
static const jsonHandler = LspJsonHandler(
ClientCapabilitiesFileOperations.canParse,
ClientCapabilitiesFileOperations.fromJson);
ClientCapabilitiesFileOperations(
{this.dynamicRegistration,
this.didCreate,
this.willCreate,
this.didRename,
this.willRename,
this.didDelete,
this.willDelete});
static ClientCapabilitiesFileOperations fromJson(Map<String, Object?> json) {
final dynamicRegistrationJson = json['dynamicRegistration'];
final dynamicRegistration = dynamicRegistrationJson as bool?;
final didCreateJson = json['didCreate'];
final didCreate = didCreateJson as bool?;
final willCreateJson = json['willCreate'];
final willCreate = willCreateJson as bool?;
final didRenameJson = json['didRename'];
final didRename = didRenameJson as bool?;
final willRenameJson = json['willRename'];
final willRename = willRenameJson as bool?;
final didDeleteJson = json['didDelete'];
final didDelete = didDeleteJson as bool?;
final willDeleteJson = json['willDelete'];
final willDelete = willDeleteJson as bool?;
return ClientCapabilitiesFileOperations(
dynamicRegistration: dynamicRegistration,
didCreate: didCreate,
willCreate: willCreate,
didRename: didRename,
willRename: willRename,
didDelete: didDelete,
willDelete: willDelete);
}
/// The client has support for sending didCreateFiles notifications.
final bool? didCreate;
/// The client has support for sending didDeleteFiles notifications.
final bool? didDelete;
/// The client has support for sending didRenameFiles notifications.
final bool? didRename;
/// Whether the client supports dynamic registration for file
/// requests/notifications.
final bool? dynamicRegistration;
/// The client has support for sending willCreateFiles requests.
final bool? willCreate;
/// The client has support for sending willDeleteFiles requests.
final bool? willDelete;
/// The client has support for sending willRenameFiles requests.
final bool? willRename;
Map<String, Object?> toJson() {
var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
if (didCreate != null) {
__result['didCreate'] = didCreate;
}
if (willCreate != null) {
__result['willCreate'] = willCreate;
}
if (didRename != null) {
__result['didRename'] = didRename;
}
if (willRename != null) {
__result['willRename'] = willRename;
}
if (didDelete != null) {
__result['didDelete'] = didDelete;
}
if (willDelete != null) {
__result['willDelete'] = willDelete;
}
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
} finally {
reporter.pop();
}
reporter.push('didCreate');
try {
final didCreate = obj['didCreate'];
if (didCreate != null && !(didCreate is bool)) {
reporter.reportError('must be of type bool');
return false;
}
} finally {
reporter.pop();
}
reporter.push('willCreate');
try {
final willCreate = obj['willCreate'];
if (willCreate != null && !(willCreate is bool)) {
reporter.reportError('must be of type bool');
return false;
}
} finally {
reporter.pop();
}
reporter.push('didRename');
try {
final didRename = obj['didRename'];
if (didRename != null && !(didRename is bool)) {
reporter.reportError('must be of type bool');
return false;
}
} finally {
reporter.pop();
}
reporter.push('willRename');
try {
final willRename = obj['willRename'];
if (willRename != null && !(willRename is bool)) {
reporter.reportError('must be of type bool');
return false;
}
} finally {
reporter.pop();
}
reporter.push('didDelete');
try {
final didDelete = obj['didDelete'];
if (didDelete != null && !(didDelete is bool)) {
reporter.reportError('must be of type bool');
return false;
}
} finally {
reporter.pop();
}
reporter.push('willDelete');
try {
final willDelete = obj['willDelete'];
if (willDelete != null && !(willDelete is bool)) {
reporter.reportError('must be of type bool');
return false;
}
} finally {
reporter.pop();
}
return true;
} else {
reporter.reportError('must be of type ClientCapabilitiesFileOperations');
return false;
}
}
@override
bool operator ==(Object other) {
if (other is ClientCapabilitiesFileOperations &&
other.runtimeType == ClientCapabilitiesFileOperations) {
return dynamicRegistration == other.dynamicRegistration &&
didCreate == other.didCreate &&
willCreate == other.willCreate &&
didRename == other.didRename &&
willRename == other.willRename &&
didDelete == other.didDelete &&
willDelete == other.willDelete &&
true;
}
return false;
}
@override
int get hashCode => Object.hash(dynamicRegistration, didCreate, willCreate,
didRename, willRename, didDelete, willDelete);
@override
String toString() => jsonEncoder.convert(toJson());
}
class ClientCapabilitiesGeneral implements ToJsonable {
static const jsonHandler = LspJsonHandler(
ClientCapabilitiesGeneral.canParse, ClientCapabilitiesGeneral.fromJson);
ClientCapabilitiesGeneral({this.regularExpressions, this.markdown});
static ClientCapabilitiesGeneral fromJson(Map<String, Object?> json) {
final regularExpressionsJson = json['regularExpressions'];
final regularExpressions = regularExpressionsJson != null
? RegularExpressionsClientCapabilities.fromJson(
regularExpressionsJson as Map<String, Object?>)
: null;
final markdownJson = json['markdown'];
final markdown = markdownJson != null
? MarkdownClientCapabilities.fromJson(
markdownJson as Map<String, Object?>)
: null;
return ClientCapabilitiesGeneral(
regularExpressions: regularExpressions, markdown: markdown);
}
/// Client capabilities specific to the client's markdown parser.
/// @since 3.16.0
final MarkdownClientCapabilities? markdown;
/// Client capabilities specific to regular expressions.
/// @since 3.16.0
final RegularExpressionsClientCapabilities? regularExpressions;
Map<String, Object?> toJson() {
var __result = <String, Object?>{};
if (regularExpressions != null) {
__result['regularExpressions'] = regularExpressions?.toJson();
}
if (markdown != null) {
__result['markdown'] = markdown?.toJson();
}
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
reporter.push('regularExpressions');
try {
final regularExpressions = obj['regularExpressions'];
if (regularExpressions != null &&
!(RegularExpressionsClientCapabilities.canParse(
regularExpressions, reporter))) {
reporter.reportError(
'must be of type RegularExpressionsClientCapabilities');
return false;
}
} finally {
reporter.pop();
}
reporter.push('markdown');
try {
final markdown = obj['markdown'];
if (markdown != null &&
!(MarkdownClientCapabilities.canParse(markdown, reporter))) {
reporter.reportError('must be of type MarkdownClientCapabilities');
return false;
}
} finally {
reporter.pop();
}
return true;
} else {
reporter.reportError('must be of type ClientCapabilitiesGeneral');
return false;
}
}
@override
bool operator ==(Object other) {
if (other is ClientCapabilitiesGeneral &&
other.runtimeType == ClientCapabilitiesGeneral) {
return regularExpressions == other.regularExpressions &&
markdown == other.markdown &&
true;
}
return false;
}
@override
int get hashCode => Object.hash(regularExpressions, markdown);
@override
String toString() => jsonEncoder.convert(toJson());
}
class ClientCapabilitiesWindow implements ToJsonable {
static const jsonHandler = LspJsonHandler(
ClientCapabilitiesWindow.canParse, ClientCapabilitiesWindow.fromJson);
ClientCapabilitiesWindow(
{this.workDoneProgress, this.showMessage, this.showDocument});
static ClientCapabilitiesWindow fromJson(Map<String, Object?> json) {
final workDoneProgressJson = json['workDoneProgress'];
final workDoneProgress = workDoneProgressJson as bool?;
final showMessageJson = json['showMessage'];
final showMessage = showMessageJson != null
? ShowMessageRequestClientCapabilities.fromJson(
showMessageJson as Map<String, Object?>)
: null;
final showDocumentJson = json['showDocument'];
final showDocument = showDocumentJson != null
? ShowDocumentClientCapabilities.fromJson(
showDocumentJson as Map<String, Object?>)
: null;
return ClientCapabilitiesWindow(
workDoneProgress: workDoneProgress,
showMessage: showMessage,
showDocument: showDocument);
}
/// Client capabilities for the show document request.
/// @since 3.16.0
final ShowDocumentClientCapabilities? showDocument;
/// Capabilities specific to the showMessage request
/// @since 3.16.0
final ShowMessageRequestClientCapabilities? showMessage;
/// Whether client supports handling progress notifications. If set servers
/// are allowed to report in `workDoneProgress` property in the request
/// specific server capabilities.
/// @since 3.15.0
final bool? workDoneProgress;
Map<String, Object?> toJson() {
var __result = <String, Object?>{};
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
}
if (showMessage != null) {
__result['showMessage'] = showMessage?.toJson();
}
if (showDocument != null) {
__result['showDocument'] = showDocument?.toJson();
}
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
} finally {
reporter.pop();
}
reporter.push('showMessage');
try {
final showMessage = obj['showMessage'];
if (showMessage != null &&
!(ShowMessageRequestClientCapabilities.canParse(
showMessage, reporter))) {
reporter.reportError(
'must be of type ShowMessageRequestClientCapabilities');
return false;
}
} finally {
reporter.pop();
}
reporter.push('showDocument');
try {
final showDocument = obj['showDocument'];
if (showDocument != null &&
!(ShowDocumentClientCapabilities.canParse(
showDocument, reporter))) {
reporter
.reportError('must be of type ShowDocumentClientCapabilities');
return false;
}
} finally {
reporter.pop();
}
return true;
} else {
reporter.reportError('must be of type ClientCapabilitiesWindow');
return false;
}
}
@override
bool operator ==(Object other) {
if (other is ClientCapabilitiesWindow &&
other.runtimeType == ClientCapabilitiesWindow) {
return workDoneProgress == other.workDoneProgress &&
showMessage == other.showMessage &&
showDocument == other.showDocument &&
true;
}
return false;
}
@override
int get hashCode => Object.hash(workDoneProgress, showMessage, showDocument);
@override
String toString() => jsonEncoder.convert(toJson());
}
class ClientCapabilitiesWorkspace implements ToJsonable {
static const jsonHandler = LspJsonHandler(
ClientCapabilitiesWorkspace.canParse,
ClientCapabilitiesWorkspace.fromJson);
ClientCapabilitiesWorkspace(
{this.applyEdit,
this.workspaceEdit,
this.didChangeConfiguration,
this.didChangeWatchedFiles,
this.symbol,
this.executeCommand,
this.workspaceFolders,
this.configuration,
this.semanticTokens,
this.codeLens,
this.fileOperations});
static ClientCapabilitiesWorkspace fromJson(Map<String, Object?> json) {
final applyEditJson = json['applyEdit'];
final applyEdit = applyEditJson as bool?;
final workspaceEditJson = json['workspaceEdit'];
final workspaceEdit = workspaceEditJson != null
? WorkspaceEditClientCapabilities.fromJson(
workspaceEditJson as Map<String, Object?>)
: null;
final didChangeConfigurationJson = json['didChangeConfiguration'];
final didChangeConfiguration = didChangeConfigurationJson != null
? DidChangeConfigurationClientCapabilities.fromJson(
didChangeConfigurationJson as Map<String, Object?>)
: null;
final didChangeWatchedFilesJson = json['didChangeWatchedFiles'];
final didChangeWatchedFiles = didChangeWatchedFilesJson != null
? DidChangeWatchedFilesClientCapabilities.fromJson(
didChangeWatchedFilesJson as Map<String, Object?>)
: null;
final symbolJson = json['symbol'];
final symbol = symbolJson != null
? WorkspaceSymbolClientCapabilities.fromJson(
symbolJson as Map<String, Object?>)
: null;
final executeCommandJson = json['executeCommand'];
final executeCommand = executeCommandJson != null
? ExecuteCommandClientCapabilities.fromJson(
executeCommandJson as Map<String, Object?>)
: null;
final workspaceFoldersJson = json['workspaceFolders'];
final workspaceFolders = workspaceFoldersJson as bool?;
final configurationJson = json['configuration'];
final configuration = configurationJson as bool?;
final semanticTokensJson = json['semanticTokens'];
final semanticTokens = semanticTokensJson != null
? SemanticTokensWorkspaceClientCapabilities.fromJson(
semanticTokensJson as Map<String, Object?>)
: null;
final codeLensJson = json['codeLens'];
final codeLens = codeLensJson != null
? CodeLensWorkspaceClientCapabilities.fromJson(
codeLensJson as Map<String, Object?>)
: null;
final fileOperationsJson = json['fileOperations'];
final fileOperations = fileOperationsJson != null
? ClientCapabilitiesFileOperations.fromJson(
fileOperationsJson as Map<String, Object?>)
: null;
return ClientCapabilitiesWorkspace(
applyEdit: applyEdit,
workspaceEdit: workspaceEdit,
didChangeConfiguration: didChangeConfiguration,
didChangeWatchedFiles: didChangeWatchedFiles,
symbol: symbol,
executeCommand: executeCommand,
workspaceFolders: workspaceFolders,
configuration: configuration,
semanticTokens: semanticTokens,
codeLens: codeLens,
fileOperations: fileOperations);
}
/// The client supports applying batch edits to the workspace by supporting
/// the request 'workspace/applyEdit'
final bool? applyEdit;
/// Capabilities specific to the code lens requests scoped to the workspace.
/// @since 3.16.0
final CodeLensWorkspaceClientCapabilities? codeLens;
/// The client supports `workspace/configuration` requests.
/// @since 3.6.0
final bool? configuration;
/// Capabilities specific to the `workspace/didChangeConfiguration`
/// notification.
final DidChangeConfigurationClientCapabilities? didChangeConfiguration;
/// Capabilities specific to the `workspace/didChangeWatchedFiles`
/// notification.
final DidChangeWatchedFilesClientCapabilities? didChangeWatchedFiles;
/// Capabilities specific to the `workspace/executeCommand` request.
final ExecuteCommandClientCapabilities? executeCommand;
/// The client has support for file requests/notifications.
/// @since 3.16.0
final ClientCapabilitiesFileOperations? fileOperations;
/// Capabilities specific to the semantic token requests scoped to the
/// workspace.
/// @since 3.16.0
final SemanticTokensWorkspaceClientCapabilities? semanticTokens;
/// Capabilities specific to the `workspace/symbol` request.
final WorkspaceSymbolClientCapabilities? symbol;
/// Capabilities specific to `WorkspaceEdit`s
final WorkspaceEditClientCapabilities? workspaceEdit;
/// The client has support for workspace folders.
/// @since 3.6.0
final bool? workspaceFolders;
Map<String, Object?> toJson() {
var __result = <String, Object?>{};
if (applyEdit != null) {
__result['applyEdit'] = applyEdit;
}
if (workspaceEdit != null) {
__result['workspaceEdit'] = workspaceEdit?.toJson();
}
if (didChangeConfiguration != null) {
__result['didChangeConfiguration'] = didChangeConfiguration?.toJson();
}
if (didChangeWatchedFiles != null) {
__result['didChangeWatchedFiles'] = didChangeWatchedFiles?.toJson();
}
if (symbol != null) {
__result['symbol'] = symbol?.toJson();
}
if (executeCommand != null) {
__result['executeCommand'] = executeCommand?.toJson();
}
if (workspaceFolders != null) {
__result['workspaceFolders'] = workspaceFolders;
}
if (configuration != null) {
__result['configuration'] = configuration;
}
if (semanticTokens != null) {
__result['semanticTokens'] = semanticTokens?.toJson();
}
if (codeLens != null) {
__result['codeLens'] = codeLens?.toJson();
}
if (fileOperations != null) {
__result['fileOperations'] = fileOperations?.toJson();
}
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
reporter.push('applyEdit');
try {
final applyEdit = obj['applyEdit'];
if (applyEdit != null && !(applyEdit is bool)) {
reporter.reportError('must be of type bool');
return false;
}
} finally {
reporter.pop();
}
reporter.push('workspaceEdit');
try {
final workspaceEdit = obj['workspaceEdit'];
if (workspaceEdit != null &&
!(WorkspaceEditClientCapabilities.canParse(
workspaceEdit, reporter))) {
reporter
.reportError('must be of type WorkspaceEditClientCapabilities');
return false;
}
} finally {
reporter.pop();
}
reporter.push('didChangeConfiguration');
try {
final didChangeConfiguration = obj['didChangeConfiguration'];
if (didChangeConfiguration != null &&
!(DidChangeConfigurationClientCapabilities.canParse(
didChangeConfiguration, reporter))) {
reporter.reportError(
'must be of type DidChangeConfigurationClientCapabilities');
return false;
}
} finally {
reporter.pop();
}
reporter.push('didChangeWatchedFiles');
try {
final didChangeWatchedFiles = obj['didChangeWatchedFiles'];
if (didChangeWatchedFiles != null &&
!(DidChangeWatchedFilesClientCapabilities.canParse(
didChangeWatchedFiles, reporter))) {
reporter.reportError(
'must be of type DidChangeWatchedFilesClientCapabilities');
return false;
}
} finally {
reporter.pop();
}
reporter.push('symbol');
try {
final symbol = obj['symbol'];
if (symbol != null &&
!(WorkspaceSymbolClientCapabilities.canParse(symbol, reporter))) {
reporter
.reportError('must be of type WorkspaceSymbolClientCapabilities');
return false;
}
} finally {
reporter.pop();
}
reporter.push('executeCommand');
try {
final executeCommand = obj['executeCommand'];
if (executeCommand != null &&
!(ExecuteCommandClientCapabilities.canParse(
executeCommand, reporter))) {
reporter
.reportError('must be of type ExecuteCommandClientCapabilities');
return false;
}
} finally {
reporter.pop();
}
reporter.push('workspaceFolders');
try {
final workspaceFolders = obj['workspaceFolders'];
if (workspaceFolders != null && !(workspaceFolders is bool)) {
reporter.reportError('must be of type bool');
return false;
}
} finally {
reporter.pop();
}
reporter.push('configuration');
try {
final configuration = obj['configuration'];
if (configuration != null && !(configuration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
} finally {
reporter.pop();
}
reporter.push('semanticTokens');
try {
final semanticTokens = obj['semanticTokens'];
if (semanticTokens != null &&
!(SemanticTokensWorkspaceClientCapabilities.canParse(
semanticTokens, reporter))) {
reporter.reportError(
'must be of type SemanticTokensWorkspaceClientCapabilities');
return false;
}
} finally {
reporter.pop();
}
reporter.push('codeLens');
try {
final codeLens = obj['codeLens'];
if (codeLens != null &&
!(CodeLensWorkspaceClientCapabilities.canParse(
codeLens, reporter))) {
reporter.reportError(
'must be of type CodeLensWorkspaceClientCapabilities');
return false;
}
} finally {
reporter.pop();
}
reporter.push('fileOperations');
try {
final fileOperations = obj['fileOperations'];
if (fileOperations != null &&
!(ClientCapabilitiesFileOperations.canParse(
fileOperations, reporter))) {
reporter
.reportError('must be of type ClientCapabilitiesFileOperations');
return false;
}
} finally {
reporter.pop();
}
return true;
} else {
reporter.reportError('must be of type ClientCapabilitiesWorkspace');
return false;
}
}
@override
bool operator ==(Object other) {
if (other is ClientCapabilitiesWorkspace &&
other.runtimeType == ClientCapabilitiesWorkspace) {
return applyEdit == other.applyEdit &&
workspaceEdit == other.workspaceEdit &&
didChangeConfiguration == other.didChangeConfiguration &&
didChangeWatchedFiles == other.didChangeWatchedFiles &&
symbol == other.symbol &&
executeCommand == other.executeCommand &&
workspaceFolders == other.workspaceFolders &&
configuration == other.configuration &&
semanticTokens == other.semanticTokens &&
codeLens == other.codeLens &&
fileOperations == other.fileOperations &&
true;
}
return false;
}
@override
int get hashCode => Object.hash(
applyEdit,
workspaceEdit,
didChangeConfiguration,
didChangeWatchedFiles,
symbol,
executeCommand,
workspaceFolders,
configuration,
semanticTokens,
codeLens,
fileOperations);
@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 =
LspJsonHandler(CodeAction.canParse, CodeAction.fromJson);
CodeAction(
{required this.title,
this.kind,
this.diagnostics,
this.isPreferred,
this.disabled,
this.edit,
this.command,
this.data});
static CodeAction fromJson(Map<String, Object?> json) {
final titleJson = json['title'];
final title = titleJson as String;
final kindJson = json['kind'];
final kind =
kindJson != null ? CodeActionKind.fromJson(kindJson as String) : null;
final diagnosticsJson = json['diagnostics'];
final diagnostics = (diagnosticsJson as List<Object?>?)
?.map((item) => Diagnostic.fromJson(item as Map<String, Object?>))
.toList();
final isPreferredJson = json['isPreferred'];
final isPreferred = isPreferredJson as bool?;
final disabledJson = json['disabled'];
final disabled = disabledJson != null
? CodeActionDisabled.fromJson(disabledJson as Map<String, Object?>)
: null;
final editJson = json['edit'];
final edit = editJson != null
? WorkspaceEdit.fromJson(editJson as Map<String, Object?>)
: null;
final commandJson = json['command'];
final command = commandJson != null
? Command.fromJson(commandJson as Map<String, Object?>)
: null;
final dataJson = json['data'];
final data = dataJson;
return CodeAction(
title: title,
kind: kind,
diagnostics: diagnostics,
isPreferred: isPreferred,
disabled: disabled,
edit: edit,
command: command,
data: data);
}
/// 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;
/// A data entry field that is preserved on a code action between a
/// `textDocument/codeAction` and a `codeAction/resolve` request.
/// @since 3.16.0
final Object? data;
/// The diagnostics that this code action resolves.
final List<Diagnostic>? diagnostics;
/// Marks that the code action cannot currently be applied.
///
/// Clients should follow the following guidelines regarding disabled code
/// actions:
///
/// - Disabled code actions are not shown in automatic lightbulbs code
/// action menus.
///
/// - Disabled actions are shown as faded out in the code action menu when
/// the user request a more specific type of code action, such as
/// refactorings.
///
/// - If the user has a keybinding that auto applies a code action and only
/// a disabled code actions are returned, the client should show the user
/// an error message with `reason` in the editor.
/// @since 3.16.0
final CodeActionDisabled? disabled;
/// The workspace edit this code action performs.
final WorkspaceEdit? edit;
/// Marks this as a preferred action. Preferred actions are used by the `auto
/// fix` command and can be targeted by keybindings.
///
/// A quick fix should be marked preferred if it properly addresses the
/// underlying error. A refactoring should be marked preferred if it is the
/// most reasonable choice of actions to take.
/// @since 3.15.0
final bool? isPreferred;
/// The kind of the code action.
///
/// Used to filter code actions.
final CodeActionKind? kind;
/// A short, human-readable, title for this code action.
final String title;
Map<String, Object?> toJson() {
var __result = <String, Object?>{};
__result['title'] = title;
if (kind != null) {
__result['kind'] = kind?.toJson();
}
if (diagnostics != null) {
__result['diagnostics'] =
diagnostics?.map((item) => item.toJson()).toList();
}
if (isPreferred != null) {
__result['isPreferred'] = isPreferred;
}
if (disabled != null) {
__result['disabled'] = disabled?.toJson();
}
if (edit != null) {
__result['edit'] = edit?.toJson();
}
if (command != null) {
__result['command'] = command?.toJson();
}
if (data != null) {
__result['data'] = data;
}
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
reporter.push('title');
try {
if (!obj.containsKey('title')) {
reporter.reportError('must not be undefined');
return false;
}
final title = obj['title'];
if (title == null) {
reporter.reportError('must not be null');
return false;
}
if (!(title is String)) {
reporter.reportError('must be of type String');
return false;
}
} finally {
reporter.pop();
}
reporter.push('kind');
try {
final kind = obj['kind'];
if (kind != null && !(CodeActionKind.canParse(kind, reporter))) {
reporter.reportError('must be of type CodeActionKind');
return false;
}
} finally {
reporter.pop();
}
reporter.push('diagnostics');
try {
final diagnostics = obj['diagnostics'];
if (diagnostics != null &&
!((diagnostics is List &&
(diagnostics
.every((item) => Diagnostic.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<Diagnostic>');
return false;
}
} finally {
reporter.pop();
}
reporter.push('isPreferred');
try {
final isPreferred = obj['isPreferred'];
if (isPreferred != null && !(isPreferred is bool)) {
reporter.reportError('must be of type bool');
return false;
}
} finally {
reporter.pop();
}
reporter.push('disabled');
try {
final disabled = obj['disabled'];
if (disabled != null &&
!(CodeActionDisabled.canParse(disabled, reporter))) {
reporter.reportError('must be of type CodeActionDisabled');
return false;
}
} finally {
reporter.pop();
}
reporter.push('edit');
try {
final edit = obj['edit'];
if (edit != null && !(WorkspaceEdit.canParse(edit, reporter))) {
reporter.reportError('must be of type WorkspaceEdit');
return false;
}
} finally {
reporter.pop();
}
reporter.push('command');
try {
final command = obj['command'];
if (command != null && !(Command.canParse(command, reporter))) {
reporter.reportError('must be of type Command');
return false;
}
} finally {
reporter.pop();
}
return true;
} else {
reporter.reportError('must be of type CodeAction');
return false;
}
}
@override
bool operator ==(Object other) {
if (other is CodeAction && other.runtimeType == CodeAction) {
return title == other.title &&
kind == other.kind &&
listEqual(diagnostics, other.diagnostics,
(Diagnostic a, Diagnostic b) => a == b) &&
isPreferred == other.isPreferred &&
disabled == other.disabled &&
edit == other.edit &&
command == other.command &&
data == other.data &&
true;
}
return false;
}
@override
int get hashCode => Object.hash(title, kind, lspHashCode(diagnostics),
isPreferred, disabled, edit, command, data);
@override
String toString() => jsonEncoder.convert(toJson());
}
class CodeActionClientCapabilities implements ToJsonable {
static const jsonHandler = LspJsonHandler(
CodeActionClientCapabilities.canParse,
CodeActionClientCapabilities.fromJson);
CodeActionClientCapabilities(
{this.dynamicRegistration,
this.codeActionLiteralSupport,
this.isPreferredSupport,
this.disabledSupport,
this.dataSupport,
this.resolveSupport,
this.honorsChangeAnnotations});
static CodeActionClientCapabilities fromJson(Map<String, Object?> json) {
final dynamicRegistrationJson = json['dynamicRegistration'];
final dynamicRegistration = dynamicRegistrationJson as bool?;
final codeActionLiteralSupportJson = json['codeActionLiteralSupport'];
final codeActionLiteralSupport = codeActionLiteralSupportJson != null
? CodeActionClientCapabilitiesCodeActionLiteralSupport.fromJson(
codeActionLiteralSupportJson as Map<String, Object?>)
: null;
final isPreferredSupportJson = json['isPreferredSupport'];
final isPreferredSupport = isPreferredSupportJson as bool?;
final disabledSupportJson = json['disabledSupport'];
final disabledSupport = disabledSupportJson as bool?;
final dataSupportJson = json['dataSupport'];
final dataSupport = dataSupportJson as bool?;
final resolveSupportJson = json['resolveSupport'];
final resolveSupport = resolveSupportJson != null
? CodeActionClientCapabilitiesResolveSupport.fromJson(
resolveSupportJson as Map<String, Object?>)
: null;
final honorsChangeAnnotationsJson = json['honorsChangeAnnotations'];
final honorsChangeAnnotations = honorsChangeAnnotationsJson as bool?;
return CodeActionClientCapabilities(
dynamicRegistration: dynamicRegistration,
codeActionLiteralSupport: codeActionLiteralSupport,
isPreferredSupport: isPreferredSupport,
disabledSupport: disabledSupport,
dataSupport: dataSupport,
resolveSupport: resolveSupport,
honorsChangeAnnotations: honorsChangeAnnotations);
}
/// The client supports code action literals as a valid response of the
/// `textDocument/codeAction` request.
/// @since 3.8.0
final CodeActionClientCapabilitiesCodeActionLiteralSupport?
codeActionLiteralSupport;
/// Whether code action supports the `data` property which is preserved
/// between a `textDocument/codeAction` and a `codeAction/resolve` request.
/// @since 3.16.0
final bool? dataSupport;
/// Whether code action supports the `disabled` property.
/// @since 3.16.0
final bool? disabledSupport;
/// Whether code action supports dynamic registration.
final bool? dynamicRegistration;
/// Whether th client honors the change annotations in text edits and resource
/// operations returned via the `CodeAction#edit` property by for example
/// presenting the workspace edit in the user interface and asking for
/// confirmation.
/// @since 3.16.0
final bool? honorsChangeAnnotations;
/// Whether code action supports the `isPreferred` property.
/// @since 3.15.0
final bool? isPreferredSupport;
/// Whether the client supports resolving additional code action properties
/// via a separate `codeAction/resolve` request.
/// @since 3.16.0
final CodeActionClientCapabilitiesResolveSupport? resolveSupport;
Map<String, Object?> toJson() {
var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
if (codeActionLiteralSupport != null) {
__result['codeActionLiteralSupport'] = codeActionLiteralSupport?.toJson();
}
if (isPreferredSupport != null) {
__result['isPreferredSupport'] = isPreferredSupport;
}
if (disabledSupport != null) {
__result['disabledSupport'] = disabledSupport;
}
if (dataSupport != null) {
__result['dataSupport'] = dataSupport;
}
if (resolveSupport != null) {
__result['resolveSupport'] = resolveSupport?.toJson();
}
if (honorsChangeAnnotations != null) {
__result['honorsChangeAnnotations'] = honorsChangeAnnotations;
}
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
} finally {
reporter.pop();
}
reporter.push('codeActionLiteralSupport');
try {
final codeActionLiteralSupport = obj['codeActionLiteralSupport'];
if (codeActionLiteralSupport != null &&
!(CodeActionClientCapabilitiesCodeActionLiteralSupport.canParse(
codeActionLiteralSupport, reporter))) {
reporter.reportError(
'must be of type CodeActionClientCapabilitiesCodeActionLiteralSupport');
return false;
}
} finally {
reporter.pop();
}
reporter.push('isPreferredSupport');
try {
final isPreferredSupport = obj['isPreferredSupport'];
if (isPreferredSupport != null && !(isPreferredSupport is bool)) {
reporter.reportError('must be of type bool');
return false;
}
} finally {
reporter.pop();
}
reporter.push('disabledSupport');
try {
final disabledSupport = obj['disabledSupport'];
if (disabledSupport != null && !(disabledSupport is bool)) {
reporter.reportError('must be of type bool');
return false;
}
} finally {
reporter.pop();
}
reporter.push('dataSupport');
try {
final dataSupport = obj['dataSupport'];
if (dataSupport != null && !(dataSupport is bool)) {
reporter.reportError('must be of type bool');
return false;
}
} finally {
reporter.pop();
}
reporter.push('resolveSupport');
try {
final resolveSupport = obj['resolveSupport'];
if (resolveSupport != null &&
!(CodeActionClientCapabilitiesResolveSupport.canParse(
resolveSupport, reporter))) {
reporter.reportError(
'must be of type CodeActionClientCapabilitiesResolveSupport');
return false;
}
} finally {
reporter.pop();
}
reporter.push('honorsChangeAnnotations');
try {
final honorsChangeAnnotations = obj['honorsChangeAnnotations'];
if (honorsChangeAnnotations != null &&
!(honorsChangeAnnotations is bool)) {
reporter.reportError('must be of type bool');
return false;
}
} finally {
reporter.pop();
}
return true;
} else {
reporter.reportError('must be of type CodeActionClientCapabilities');
return false;
}
}
@override
bool operator ==(Object other) {
if (other is CodeActionClientCapabilities &&
other.runtimeType == CodeActionClientCapabilities) {
return dynamicRegistration == other.dynamicRegistration &&
codeActionLiteralSupport == other.codeActionLiteralSupport &&
isPreferredSupport == other.isPreferredSupport &&
disabledSupport == other.disabledSupport &&
dataSupport == other.dataSupport &&
resolveSupport == other.resolveSupport &&
honorsChangeAnnotations == other.honorsChangeAnnotations &&
true;
}
return false;
}
@override
int get hashCode => Object.