@theia/plugin-ext 1.29.0-next.10 → 1.29.0-next.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/lib/common/plugin-api-rpc.d.ts +6 -6
  2. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  3. package/lib/common/plugin-api-rpc.js.map +1 -1
  4. package/lib/common/rpc-protocol.d.ts +1 -1
  5. package/lib/common/rpc-protocol.d.ts.map +1 -1
  6. package/lib/common/rpc-protocol.js +3 -3
  7. package/lib/common/rpc-protocol.js.map +1 -1
  8. package/lib/main/browser/view/tree-view-decorator-service.d.ts +1 -1
  9. package/lib/main/browser/view/tree-view-decorator-service.d.ts.map +1 -1
  10. package/lib/main/browser/view/tree-view-decorator-service.js +1 -1
  11. package/lib/main/browser/view/tree-view-decorator-service.js.map +1 -1
  12. package/lib/plugin/languages/code-action.d.ts.map +1 -1
  13. package/lib/plugin/languages/code-action.js +8 -9
  14. package/lib/plugin/languages/code-action.js.map +1 -1
  15. package/lib/plugin/languages/document-highlight.d.ts.map +1 -1
  16. package/lib/plugin/languages/document-highlight.js +0 -1
  17. package/lib/plugin/languages/document-highlight.js.map +1 -1
  18. package/lib/plugin/languages/util.d.ts +2 -2
  19. package/lib/plugin/languages/util.d.ts.map +1 -1
  20. package/lib/plugin/languages/util.js +0 -2
  21. package/lib/plugin/languages/util.js.map +1 -1
  22. package/lib/plugin/type-converters.d.ts +6 -6
  23. package/lib/plugin/type-converters.d.ts.map +1 -1
  24. package/lib/plugin/type-converters.js +45 -53
  25. package/lib/plugin/type-converters.js.map +1 -1
  26. package/lib/plugin/types-impl.d.ts +3 -3
  27. package/lib/plugin/types-impl.d.ts.map +1 -1
  28. package/lib/plugin/types-impl.js +5 -7
  29. package/lib/plugin/types-impl.js.map +1 -1
  30. package/package.json +24 -24
  31. package/src/common/plugin-api-rpc.ts +6 -6
  32. package/src/common/rpc-protocol.ts +5 -5
  33. package/src/main/browser/view/tree-view-decorator-service.ts +2 -2
  34. package/src/plugin/languages/code-action.ts +9 -12
  35. package/src/plugin/languages/document-highlight.ts +1 -2
  36. package/src/plugin/languages/util.ts +2 -4
  37. package/src/plugin/type-converters.ts +51 -59
  38. package/src/plugin/types-impl.ts +12 -14
@@ -137,9 +137,8 @@ export function toPosition(position: Position): types.Position {
137
137
  return new types.Position(position.lineNumber - 1, position.column - 1);
138
138
  }
139
139
 
140
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
141
- function isDecorationOptions(something: any): something is theia.DecorationOptions {
142
- return (typeof something.range !== 'undefined');
140
+ function isDecorationOptions(arg: unknown): arg is theia.DecorationOptions {
141
+ return !!arg && typeof arg === 'object' && typeof (arg as theia.DecorationOptions).range !== 'undefined';
143
142
  }
144
143
 
145
144
  export function isDecorationOptionsArr(something: theia.Range[] | theia.DecorationOptions[]): something is theia.DecorationOptions[] {
@@ -182,11 +181,10 @@ interface Codeblock {
182
181
  value: string;
183
182
  }
184
183
 
185
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
186
- function isCodeblock(thing: any): thing is Codeblock {
187
- return thing && typeof thing === 'object'
188
- && typeof (<Codeblock>thing).language === 'string'
189
- && typeof (<Codeblock>thing).value === 'string';
184
+ function isCodeblock(arg: unknown): arg is Codeblock {
185
+ return !!arg && typeof arg === 'object'
186
+ && typeof (arg as Codeblock).language === 'string'
187
+ && typeof (arg as Codeblock).value === 'string';
190
188
  }
191
189
 
192
190
  export function fromMarkdown(markup: theia.MarkdownString | theia.MarkedString): MarkdownStringDTO {
@@ -625,64 +623,58 @@ export function toSymbolTag(kind: model.SymbolTag): types.SymbolTag {
625
623
  }
626
624
  }
627
625
 
628
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
629
- export function isModelLocation(thing: any): thing is model.Location {
630
- if (!thing) {
631
- return false;
632
- }
633
- return isModelRange((<model.Location>thing).range) &&
634
- isUriComponents((<model.Location>thing).uri);
635
- }
636
-
637
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
638
- export function isModelRange(thing: any): thing is model.Range {
639
- if (!thing) {
626
+ export function isModelLocation(arg: unknown): arg is model.Location {
627
+ if (!arg) {
640
628
  return false;
641
629
  }
642
- return (('startLineNumber' in thing) && typeof thing.startLineNumber === 'number') &&
643
- (('startColumn' in thing) && typeof thing.startColumn === 'number') &&
644
- (('endLineNumber' in thing) && typeof thing.endLineNumber === 'number') &&
645
- (('endColumn' in thing) && typeof thing.endColumn === 'number');
630
+ return !!arg &&
631
+ typeof arg === 'object' &&
632
+ isModelRange((arg as model.Location).range) &&
633
+ isUriComponents((arg as model.Location).uri);
646
634
  }
647
635
 
648
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
649
- export function isUriComponents(thing: any): thing is UriComponents {
650
- if (!thing) {
651
- return false;
652
- }
653
- return (('scheme' in thing) && typeof thing.scheme === 'string') &&
654
- (('path' in thing) && typeof thing.path === 'string') &&
655
- (('query' in thing) && typeof thing.query === 'string') &&
656
- (('fragment' in thing) && typeof thing.fragment === 'string');
636
+ export function isModelRange(arg: unknown): arg is model.Range {
637
+ const range = arg as model.Range;
638
+ return !!arg && typeof arg === 'object' &&
639
+ typeof range.startLineNumber === 'number' &&
640
+ typeof range.startColumn === 'number' &&
641
+ typeof range.endLineNumber === 'number' &&
642
+ typeof range.endColumn === 'number';
657
643
  }
658
644
 
659
645
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
660
- export function isModelCallHierarchyItem(thing: any): thing is model.CallHierarchyItem {
661
- if (!thing) {
662
- return false;
663
- }
664
- return isModelRange(thing.range)
665
- && isModelRange(thing.selectionRange)
666
- && isUriComponents(thing.uri)
667
- && !!thing.name;
668
- }
669
-
670
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
671
- export function isModelCallHierarchyIncomingCall(thing: any): thing is model.CallHierarchyIncomingCall {
672
- if (!thing) {
673
- return false;
674
- }
675
- const maybeIncomingCall = thing as model.CallHierarchyIncomingCall;
676
- return 'from' in maybeIncomingCall && 'fromRanges' in maybeIncomingCall && isModelCallHierarchyItem(maybeIncomingCall.from);
677
- }
678
-
679
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
680
- export function isModelCallHierarchyOutgoingCall(thing: any): thing is model.CallHierarchyOutgoingCall {
681
- if (!thing) {
682
- return false;
683
- }
684
- const maybeOutgoingCall = thing as model.CallHierarchyOutgoingCall;
685
- return 'to' in maybeOutgoingCall && 'fromRanges' in maybeOutgoingCall && isModelCallHierarchyItem(maybeOutgoingCall.to);
646
+ export function isUriComponents(arg: unknown): arg is UriComponents {
647
+ const uriComponents = arg as UriComponents;
648
+ return !!arg && typeof arg === 'object' &&
649
+ typeof uriComponents.scheme === 'string' &&
650
+ typeof uriComponents.path === 'string' &&
651
+ typeof uriComponents.query === 'string' &&
652
+ typeof uriComponents.fragment === 'string';
653
+ }
654
+
655
+ export function isModelCallHierarchyItem(arg: unknown): arg is model.CallHierarchyItem {
656
+ const item = arg as model.CallHierarchyItem;
657
+ return !!item && typeof item === 'object'
658
+ && isModelRange(item.range)
659
+ && isModelRange(item.selectionRange)
660
+ && isUriComponents(item.uri)
661
+ && !!item.name;
662
+ }
663
+
664
+ export function isModelCallHierarchyIncomingCall(arg: unknown): arg is model.CallHierarchyIncomingCall {
665
+ const maybeIncomingCall = arg as model.CallHierarchyIncomingCall;
666
+ return !!arg && typeof arg === 'object' &&
667
+ 'from' in maybeIncomingCall &&
668
+ 'fromRanges' in maybeIncomingCall &&
669
+ isModelCallHierarchyItem(maybeIncomingCall.from);
670
+ }
671
+
672
+ export function isModelCallHierarchyOutgoingCall(arg: unknown): arg is model.CallHierarchyOutgoingCall {
673
+ const maybeOutgoingCall = arg as model.CallHierarchyOutgoingCall;
674
+ return !!arg && typeof arg === 'object' &&
675
+ 'to' in maybeOutgoingCall &&
676
+ 'fromRanges' in maybeOutgoingCall &&
677
+ isModelCallHierarchyItem(maybeOutgoingCall.to);
686
678
  }
687
679
 
688
680
  export function toLocation(value: model.Location): types.Location {
@@ -20,7 +20,6 @@
20
20
  *--------------------------------------------------------------------------------------------*/
21
21
 
22
22
  /* eslint-disable no-null/no-null */
23
- /* eslint-disable @typescript-eslint/no-explicit-any */
24
23
 
25
24
  import { UUID } from '@theia/core/shared/@phosphor/coreutils';
26
25
  import { illegalArgument } from '../common/errors';
@@ -38,6 +37,7 @@ import { es5ClassCompat } from '../common/types';
38
37
  * A reviver that takes URI's transferred via JSON.stringify() and makes
39
38
  * instances of our local plugin API URI class (below)
40
39
  */
40
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
41
  export function reviver(key: string | undefined, value: any): any {
42
42
  const revived = ObjectsTransferrer.reviver(key, value);
43
43
  if (CodeURI.isUri(revived)) {
@@ -423,7 +423,7 @@ export class Position {
423
423
  return false;
424
424
  }
425
425
 
426
- toJSON(): any {
426
+ toJSON(): unknown {
427
427
  return { line: this.line, character: this.character };
428
428
  }
429
429
  }
@@ -546,19 +546,17 @@ export class Range {
546
546
  return new Range(start, end);
547
547
  }
548
548
 
549
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
550
- static isRange(thing: any): thing is theia.Range {
549
+ static isRange(thing: unknown): thing is theia.Range {
551
550
  if (thing instanceof Range) {
552
551
  return true;
553
552
  }
554
- if (!thing) {
555
- return false;
556
- }
557
- return Position.isPosition((<Range>thing).start)
558
- && Position.isPosition((<Range>thing).end);
553
+ const range = thing as theia.Range;
554
+ return !!thing && typeof thing === 'object'
555
+ && Position.isPosition(range.start)
556
+ && Position.isPosition(range.end);
559
557
  }
560
558
 
561
- toJSON(): any {
559
+ toJSON(): unknown {
562
560
  return [this.start, this.end];
563
561
  }
564
562
  }
@@ -1636,8 +1634,8 @@ export class FileSystemError extends Error {
1636
1634
 
1637
1635
  // workaround when extending builtin objects and when compiling to ES5, see:
1638
1636
  // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
1639
- if (typeof (<any>Object).setPrototypeOf === 'function') {
1640
- (<any>Object).setPrototypeOf(this, FileSystemError.prototype);
1637
+ if (typeof Object.setPrototypeOf === 'function') {
1638
+ Object.setPrototypeOf(this, FileSystemError.prototype);
1641
1639
  }
1642
1640
 
1643
1641
  if (typeof Error.captureStackTrace === 'function' && typeof terminator === 'function') {
@@ -2555,7 +2553,7 @@ export class SemanticTokensLegend {
2555
2553
  }
2556
2554
  }
2557
2555
 
2558
- function isStrArrayOrUndefined(arg: any): arg is string[] | undefined {
2556
+ function isStrArrayOrUndefined(arg: unknown): arg is string[] | undefined {
2559
2557
  return ((typeof arg === 'undefined') || (Array.isArray(arg) && arg.every(e => typeof e === 'string')));
2560
2558
  }
2561
2559
 
@@ -2593,7 +2591,7 @@ export class SemanticTokensBuilder {
2593
2591
 
2594
2592
  public push(line: number, char: number, length: number, tokenType: number, tokenModifiers?: number): void;
2595
2593
  public push(range: Range, tokenType: string, tokenModifiers?: string[]): void;
2596
- public push(arg0: any, arg1: any, arg2: any, arg3?: any, arg4?: any): void {
2594
+ public push(arg0: number | Range, arg1: number | string, arg2?: number | string[], arg3?: number, arg4?: number): void {
2597
2595
  if (typeof arg0 === 'number' && typeof arg1 === 'number' && typeof arg2 === 'number' && typeof arg3 === 'number' &&
2598
2596
  (typeof arg4 === 'number' || typeof arg4 === 'undefined')) {
2599
2597
  if (typeof arg4 === 'undefined') {