@@ -14592,6 +14592,98 @@ class FileEvent implements ToJsonable {
1459214592 String toString() => jsonEncoder.convert(toJson());
1459314593}
1459414594
14595+ /// A filter to describe in which file operation requests or notifications the
14596+ /// server is interested in.
14597+ /// @since 3.16.0
14598+ class FileOperationFilter implements ToJsonable {
14599+ static const jsonHandler = LspJsonHandler(
14600+ FileOperationFilter.canParse, FileOperationFilter.fromJson);
14601+
14602+ FileOperationFilter({this.scheme, @required this.pattern}) {
14603+ if (pattern == null) {
14604+ throw 'pattern is required but was not provided';
14605+ }
14606+ }
14607+ static FileOperationFilter fromJson(Map<String, dynamic> json) {
14608+ final scheme = json['scheme'];
14609+ final pattern = json['pattern'] != null
14610+ ? FileOperationPattern.fromJson(json['pattern'])
14611+ : null;
14612+ return FileOperationFilter(scheme: scheme, pattern: pattern);
14613+ }
14614+
14615+ /// The actual file operation pattern.
14616+ final FileOperationPattern pattern;
14617+
14618+ /// A Uri like `file` or `untitled`.
14619+ final String scheme;
14620+
14621+ Map<String, dynamic> toJson() {
14622+ var __result = <String, dynamic>{};
14623+ if (scheme != null) {
14624+ __result['scheme'] = scheme;
14625+ }
14626+ __result['pattern'] =
14627+ pattern?.toJson() ?? (throw 'pattern is required but was not set');
14628+ return __result;
14629+ }
14630+
14631+ static bool canParse(Object obj, LspJsonReporter reporter) {
14632+ if (obj is Map<String, dynamic>) {
14633+ reporter.push('scheme');
14634+ try {
14635+ if (obj['scheme'] != null && !(obj['scheme'] is String)) {
14636+ reporter.reportError('must be of type String');
14637+ return false;
14638+ }
14639+ } finally {
14640+ reporter.pop();
14641+ }
14642+ reporter.push('pattern');
14643+ try {
14644+ if (!obj.containsKey('pattern')) {
14645+ reporter.reportError('must not be undefined');
14646+ return false;
14647+ }
14648+ if (obj['pattern'] == null) {
14649+ reporter.reportError('must not be null');
14650+ return false;
14651+ }
14652+ if (!(FileOperationPattern.canParse(obj['pattern'], reporter))) {
14653+ reporter.reportError('must be of type FileOperationPattern');
14654+ return false;
14655+ }
14656+ } finally {
14657+ reporter.pop();
14658+ }
14659+ return true;
14660+ } else {
14661+ reporter.reportError('must be of type FileOperationFilter');
14662+ return false;
14663+ }
14664+ }
14665+
14666+ @override
14667+ bool operator ==(Object other) {
14668+ if (other is FileOperationFilter &&
14669+ other.runtimeType == FileOperationFilter) {
14670+ return scheme == other.scheme && pattern == other.pattern && true;
14671+ }
14672+ return false;
14673+ }
14674+
14675+ @override
14676+ int get hashCode {
14677+ var hash = 0;
14678+ hash = JenkinsSmiHash.combine(hash, scheme.hashCode);
14679+ hash = JenkinsSmiHash.combine(hash, pattern.hashCode);
14680+ return JenkinsSmiHash.finish(hash);
14681+ }
14682+
14683+ @override
14684+ String toString() => jsonEncoder.convert(toJson());
14685+ }
14686+
1459514687/// A pattern to describe in which file operation requests or notifications the
1459614688/// server is interested in.
1459714689/// @since 3.16.0 - proposed state
@@ -14818,45 +14910,46 @@ class FileOperationRegistrationOptions implements ToJsonable {
1481814910 FileOperationRegistrationOptions.canParse,
1481914911 FileOperationRegistrationOptions.fromJson);
1482014912
14821- FileOperationRegistrationOptions({@required this.patterns }) {
14822- if (patterns == null) {
14823- throw 'patterns is required but was not provided';
14913+ FileOperationRegistrationOptions({@required this.filters }) {
14914+ if (filters == null) {
14915+ throw 'filters is required but was not provided';
1482414916 }
1482514917 }
1482614918 static FileOperationRegistrationOptions fromJson(Map<String, dynamic> json) {
14827- final patterns = json['patterns ']
14919+ final filters = json['filters ']
1482814920 ?.map(
14829- (item) => item != null ? FileOperationPattern .fromJson(item) : null)
14830- ?.cast<FileOperationPattern >()
14921+ (item) => item != null ? FileOperationFilter .fromJson(item) : null)
14922+ ?.cast<FileOperationFilter >()
1483114923 ?.toList();
14832- return FileOperationRegistrationOptions(patterns: patterns );
14924+ return FileOperationRegistrationOptions(filters: filters );
1483314925 }
1483414926
14835- final List<FileOperationPattern> patterns;
14927+ /// The actual filters.
14928+ final List<FileOperationFilter> filters;
1483614929
1483714930 Map<String, dynamic> toJson() {
1483814931 var __result = <String, dynamic>{};
14839- __result['patterns '] =
14840- patterns ?? (throw 'patterns is required but was not set');
14932+ __result['filters '] =
14933+ filters ?? (throw 'filters is required but was not set');
1484114934 return __result;
1484214935 }
1484314936
1484414937 static bool canParse(Object obj, LspJsonReporter reporter) {
1484514938 if (obj is Map<String, dynamic>) {
14846- reporter.push('patterns ');
14939+ reporter.push('filters ');
1484714940 try {
14848- if (!obj.containsKey('patterns ')) {
14941+ if (!obj.containsKey('filters ')) {
1484914942 reporter.reportError('must not be undefined');
1485014943 return false;
1485114944 }
14852- if (obj['patterns '] == null) {
14945+ if (obj['filters '] == null) {
1485314946 reporter.reportError('must not be null');
1485414947 return false;
1485514948 }
14856- if (!((obj['patterns '] is List &&
14857- (obj['patterns '].every(
14858- (item) => FileOperationPattern .canParse(item, reporter)))))) {
14859- reporter.reportError('must be of type List<FileOperationPattern >');
14949+ if (!((obj['filters '] is List &&
14950+ (obj['filters '].every(
14951+ (item) => FileOperationFilter .canParse(item, reporter)))))) {
14952+ reporter.reportError('must be of type List<FileOperationFilter >');
1486014953 return false;
1486114954 }
1486214955 } finally {
@@ -14873,8 +14966,8 @@ class FileOperationRegistrationOptions implements ToJsonable {
1487314966 bool operator ==(Object other) {
1487414967 if (other is FileOperationRegistrationOptions &&
1487514968 other.runtimeType == FileOperationRegistrationOptions) {
14876- return listEqual(patterns , other.patterns ,
14877- (FileOperationPattern a, FileOperationPattern b) => a == b) &&
14969+ return listEqual(filters , other.filters ,
14970+ (FileOperationFilter a, FileOperationFilter b) => a == b) &&
1487814971 true;
1487914972 }
1488014973 return false;
@@ -14883,7 +14976,7 @@ class FileOperationRegistrationOptions implements ToJsonable {
1488314976 @override
1488414977 int get hashCode {
1488514978 var hash = 0;
14886- hash = JenkinsSmiHash.combine(hash, lspHashCode(patterns ));
14979+ hash = JenkinsSmiHash.combine(hash, lspHashCode(filters ));
1488714980 return JenkinsSmiHash.finish(hash);
1488814981 }
1488914982
0 commit comments