@theia/plugin-ext 1.24.0-next.45 → 1.24.0-next.48

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 (103) hide show
  1. package/lib/common/plugin-api-rpc-model.d.ts +1 -2
  2. package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
  3. package/lib/common/plugin-api-rpc-model.js.map +1 -1
  4. package/lib/common/plugin-api-rpc.d.ts +8 -4
  5. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  6. package/lib/common/plugin-api-rpc.js.map +1 -1
  7. package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
  8. package/lib/hosted/browser/hosted-plugin.js +6 -5
  9. package/lib/hosted/browser/hosted-plugin.js.map +1 -1
  10. package/lib/main/browser/comments/comment-glyph-widget.d.ts +1 -2
  11. package/lib/main/browser/comments/comment-glyph-widget.d.ts.map +1 -1
  12. package/lib/main/browser/comments/comment-glyph-widget.js.map +1 -1
  13. package/lib/main/browser/comments/comment-thread-widget.d.ts +1 -2
  14. package/lib/main/browser/comments/comment-thread-widget.d.ts.map +1 -1
  15. package/lib/main/browser/comments/comment-thread-widget.js +1 -0
  16. package/lib/main/browser/comments/comment-thread-widget.js.map +1 -1
  17. package/lib/main/browser/comments/comments-contribution.d.ts +1 -2
  18. package/lib/main/browser/comments/comments-contribution.d.ts.map +1 -1
  19. package/lib/main/browser/comments/comments-contribution.js +1 -0
  20. package/lib/main/browser/comments/comments-contribution.js.map +1 -1
  21. package/lib/main/browser/comments/comments-decorator.d.ts +1 -2
  22. package/lib/main/browser/comments/comments-decorator.d.ts.map +1 -1
  23. package/lib/main/browser/comments/comments-decorator.js.map +1 -1
  24. package/lib/main/browser/custom-editors/custom-editors-main.d.ts +2 -2
  25. package/lib/main/browser/custom-editors/custom-editors-main.d.ts.map +1 -1
  26. package/lib/main/browser/custom-editors/custom-editors-main.js +7 -7
  27. package/lib/main/browser/custom-editors/custom-editors-main.js.map +1 -1
  28. package/lib/main/browser/documents-main.d.ts.map +1 -1
  29. package/lib/main/browser/documents-main.js +1 -0
  30. package/lib/main/browser/documents-main.js.map +1 -1
  31. package/lib/main/browser/editor/untitled-resource.d.ts.map +1 -1
  32. package/lib/main/browser/editor/untitled-resource.js +1 -0
  33. package/lib/main/browser/editor/untitled-resource.js.map +1 -1
  34. package/lib/main/browser/editors-and-documents-main.d.ts +1 -1
  35. package/lib/main/browser/editors-and-documents-main.d.ts.map +1 -1
  36. package/lib/main/browser/editors-and-documents-main.js.map +1 -1
  37. package/lib/main/browser/languages-main.d.ts +3 -3
  38. package/lib/main/browser/languages-main.d.ts.map +1 -1
  39. package/lib/main/browser/languages-main.js +14 -11
  40. package/lib/main/browser/languages-main.js.map +1 -1
  41. package/lib/main/browser/plugin-contribution-handler.d.ts.map +1 -1
  42. package/lib/main/browser/plugin-contribution-handler.js +4 -2
  43. package/lib/main/browser/plugin-contribution-handler.js.map +1 -1
  44. package/lib/main/browser/plugin-icon-theme-service.d.ts.map +1 -1
  45. package/lib/main/browser/plugin-icon-theme-service.js +4 -2
  46. package/lib/main/browser/plugin-icon-theme-service.js.map +1 -1
  47. package/lib/main/browser/quick-open-main.d.ts +5 -6
  48. package/lib/main/browser/quick-open-main.d.ts.map +1 -1
  49. package/lib/main/browser/quick-open-main.js +15 -17
  50. package/lib/main/browser/quick-open-main.js.map +1 -1
  51. package/lib/main/browser/text-editor-main.d.ts +1 -1
  52. package/lib/main/browser/text-editor-main.d.ts.map +1 -1
  53. package/lib/main/browser/text-editor-main.js +11 -9
  54. package/lib/main/browser/text-editor-main.js.map +1 -1
  55. package/lib/main/browser/text-editors-main.d.ts +2 -1
  56. package/lib/main/browser/text-editors-main.d.ts.map +1 -1
  57. package/lib/main/browser/text-editors-main.js +4 -2
  58. package/lib/main/browser/text-editors-main.js.map +1 -1
  59. package/lib/main/browser/view/plugin-tree-view-node-label-provider.d.ts.map +1 -1
  60. package/lib/main/browser/view/plugin-tree-view-node-label-provider.js +2 -1
  61. package/lib/main/browser/view/plugin-tree-view-node-label-provider.js.map +1 -1
  62. package/lib/main/browser/view/plugin-view-registry.js +3 -2
  63. package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
  64. package/lib/main/browser/view/tree-view-widget.d.ts +5 -0
  65. package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
  66. package/lib/main/browser/view/tree-view-widget.js +19 -1
  67. package/lib/main/browser/view/tree-view-widget.js.map +1 -1
  68. package/lib/plugin/languages/selection-range.d.ts +2 -2
  69. package/lib/plugin/languages/selection-range.d.ts.map +1 -1
  70. package/lib/plugin/languages/selection-range.js.map +1 -1
  71. package/lib/plugin/quick-open.d.ts +6 -8
  72. package/lib/plugin/quick-open.d.ts.map +1 -1
  73. package/lib/plugin/quick-open.js +16 -11
  74. package/lib/plugin/quick-open.js.map +1 -1
  75. package/lib/plugin/type-converters.d.ts.map +1 -1
  76. package/lib/plugin/type-converters.js +16 -20
  77. package/lib/plugin/type-converters.js.map +1 -1
  78. package/package.json +24 -23
  79. package/src/common/plugin-api-rpc-model.ts +1 -0
  80. package/src/common/plugin-api-rpc.ts +10 -4
  81. package/src/hosted/browser/hosted-plugin.ts +7 -5
  82. package/src/main/browser/comments/comment-glyph-widget.ts +1 -0
  83. package/src/main/browser/comments/comment-thread-widget.tsx +1 -0
  84. package/src/main/browser/comments/comments-contribution.ts +1 -0
  85. package/src/main/browser/comments/comments-decorator.ts +1 -0
  86. package/src/main/browser/custom-editors/custom-editors-main.ts +9 -9
  87. package/src/main/browser/documents-main.ts +1 -0
  88. package/src/main/browser/editor/untitled-resource.ts +1 -0
  89. package/src/main/browser/editors-and-documents-main.ts +1 -0
  90. package/src/main/browser/languages-main.ts +59 -40
  91. package/src/main/browser/plugin-contribution-handler.ts +4 -2
  92. package/src/main/browser/plugin-icon-theme-service.ts +4 -2
  93. package/src/main/browser/quick-open-main.ts +23 -24
  94. package/src/main/browser/style/tree.css +4 -0
  95. package/src/main/browser/text-editor-main.ts +12 -14
  96. package/src/main/browser/text-editors-main.ts +6 -3
  97. package/src/main/browser/view/plugin-tree-view-node-label-provider.ts +2 -1
  98. package/src/main/browser/view/plugin-view-registry.ts +3 -3
  99. package/src/main/browser/view/tree-view-widget.tsx +21 -3
  100. package/src/plugin/languages/selection-range.ts +2 -1
  101. package/src/plugin/quick-open.ts +21 -16
  102. package/src/plugin/type-converters.ts +15 -22
  103. package/src/typings/monaco/index.d.ts +0 -20
@@ -36,7 +36,7 @@ import {
36
36
  import { MenuPath, MenuModelRegistry, ActionMenuNode } from '@theia/core/lib/common/menu';
37
37
  import * as React from '@theia/core/shared/react';
38
38
  import { PluginSharedStyle } from '../plugin-shared-style';
39
- import { ACTION_ITEM, Widget } from '@theia/core/lib/browser/widgets/widget';
39
+ import { ACTION_ITEM, codicon, Widget } from '@theia/core/lib/browser/widgets/widget';
40
40
  import { Emitter, Event } from '@theia/core/lib/common/event';
41
41
  import { MessageService } from '@theia/core/lib/common/message-service';
42
42
  import { View } from '../../../common/plugin-protocol';
@@ -44,6 +44,7 @@ import CoreURI from '@theia/core/lib/common/uri';
44
44
  import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
45
45
  import * as markdownit from '@theia/core/shared/markdown-it';
46
46
  import { isMarkdownString } from '../../../plugin/markdown-string';
47
+ import { LabelParser } from '@theia/core/lib/browser/label-parser';
47
48
 
48
49
  export const TREE_NODE_HYPERLINK = 'theia-TreeNodeHyperlink';
49
50
  export const VIEW_ITEM_CONTEXT_MENU: MenuPath = ['view-item-context-menu'];
@@ -250,18 +251,35 @@ export class TreeViewWidget extends TreeViewWelcomeWidget {
250
251
  @inject(TooltipService)
251
252
  protected readonly tooltipService: TooltipService;
252
253
 
254
+ @inject(LabelParser)
255
+ protected readonly labelParser: LabelParser;
256
+
257
+ protected readonly markdownIt = markdownit();
258
+
253
259
  @postConstruct()
254
260
  protected override init(): void {
255
261
  super.init();
256
262
  this.id = this.identifier.id;
257
263
  this.addClass('theia-tree-view');
258
264
  this.node.style.height = '100%';
259
-
265
+ this.markdownItPlugin();
260
266
  this.model.onDidChangeWelcomeState(this.update, this);
261
267
  this.toDispose.push(this.model.onDidChangeWelcomeState(this.update, this));
262
268
  this.toDispose.push(this.onDidChangeVisibilityEmitter);
263
269
  }
264
270
 
271
+ protected markdownItPlugin(): void {
272
+ this.markdownIt.renderer.rules.text = (tokens, idx) => {
273
+ const content = tokens[idx].content;
274
+ return this.labelParser.parse(content).map(chunk => {
275
+ if (typeof chunk === 'string') {
276
+ return chunk;
277
+ }
278
+ return `<i class="${codicon(chunk.name)} ${chunk.animation ? `fa-${chunk.animation}` : ''} icon-inline"></i>`;
279
+ }).join('');
280
+ };
281
+ }
282
+
265
283
  protected override renderIcon(node: TreeNode, props: NodeProps): React.ReactNode {
266
284
  const icon = this.toNodeIcon(node);
267
285
  if (icon) {
@@ -285,7 +303,7 @@ export class TreeViewWidget extends TreeViewWelcomeWidget {
285
303
 
286
304
  if (node.tooltip && isMarkdownString(node.tooltip)) {
287
305
  // Render markdown in custom tooltip
288
- const tooltip = markdownit().render(node.tooltip.value);
306
+ const tooltip = this.markdownIt.render(node.tooltip.value);
289
307
 
290
308
  attrs = {
291
309
  ...attrs,
@@ -26,6 +26,7 @@ import { URI } from '@theia/core/shared/vscode-uri';
26
26
  import * as model from '../../common/plugin-api-rpc-model';
27
27
  import * as Converter from '../type-converters';
28
28
  import * as types from '../types-impl';
29
+ import { Position } from '../../common/plugin-api-rpc';
29
30
 
30
31
  export class SelectionRangeProviderAdapter {
31
32
 
@@ -34,7 +35,7 @@ export class SelectionRangeProviderAdapter {
34
35
  private readonly documents: DocumentsExtImpl
35
36
  ) { }
36
37
 
37
- provideSelectionRanges(resource: URI, position: monaco.IPosition[], token: theia.CancellationToken): Promise<model.SelectionRange[][]> {
38
+ provideSelectionRanges(resource: URI, position: Position[], token: theia.CancellationToken): Promise<model.SelectionRange[][]> {
38
39
  const documentData = this.documents.getDocumentData(resource);
39
40
 
40
41
  if (!documentData) {
@@ -19,7 +19,7 @@ import {
19
19
  Item, TransferQuickInputButton, TransferQuickPickItems, TransferQuickInput
20
20
  } from '../common/plugin-api-rpc';
21
21
  import * as theia from '@theia/plugin';
22
- import { QuickPickItem, InputBoxOptions, InputBox, QuickPick, QuickInput } from '@theia/plugin';
22
+ import { QuickPickItem, InputBoxOptions, InputBox, QuickPick, QuickInput, QuickPickItemValue } from '@theia/plugin';
23
23
  import { CancellationToken } from '@theia/core/lib/common/cancellation';
24
24
  import { RPCProtocol } from '../common/rpc-protocol';
25
25
  import { Emitter, Event } from '@theia/core/lib/common/event';
@@ -74,7 +74,7 @@ export class QuickOpenExtImpl implements QuickOpenExt {
74
74
  }
75
75
 
76
76
  /* eslint-disable max-len */
77
- showQuickPick(itemsOrItemsPromise: Array<QuickPickItem> | Promise<Array<QuickPickItem>>, options: theia.QuickPickOptions & { canPickMany: true; }, token?: theia.CancellationToken): Promise<Array<QuickPickItem> | undefined>;
77
+ showQuickPick(itemsOrItemsPromise: Array<QuickPickItem> | Promise<Array<QuickPickItem>>, options: theia.QuickPickOptions & { canPickMany: true; }, token?: theia.CancellationToken): Promise<Array<QuickPickItemValue> | undefined>;
78
78
  showQuickPick(itemsOrItemsPromise: string[] | Promise<string[]>, options?: theia.QuickPickOptions, token?: theia.CancellationToken): Promise<string | undefined>;
79
79
  showQuickPick(itemsOrItemsPromise: Array<QuickPickItem> | Promise<Array<QuickPickItem>>, options?: theia.QuickPickOptions, token?: theia.CancellationToken): Promise<QuickPickItem | undefined>;
80
80
  showQuickPick(itemsOrItemsPromise: Item[] | Promise<Item[]>, options?: theia.QuickPickOptions, token: theia.CancellationToken = CancellationToken.None): Promise<Item | Item[] | undefined> {
@@ -420,10 +420,10 @@ export class QuickInputExt implements QuickInput {
420
420
  this.dispose();
421
421
  }
422
422
 
423
- protected convertURL(iconPath: monaco.Uri | { light: string | monaco.Uri; dark: string | monaco.Uri } | monaco.theme.ThemeIcon):
423
+ protected convertURL(iconPath: URI | { light: string | URI; dark: string | URI } | ThemeIcon):
424
424
  URI | { light: string | URI; dark: string | URI } | ThemeIcon {
425
- const toUrl = (arg: string | monaco.Uri) => {
426
- arg = arg instanceof monaco.Uri && arg.scheme === 'file' ? arg.fsPath : arg;
425
+ const toUrl = (arg: string | URI) => {
426
+ arg = arg instanceof URI && arg.scheme === 'file' ? arg.fsPath : arg;
427
427
  if (typeof arg !== 'string') {
428
428
  return arg.toString(true);
429
429
  }
@@ -435,10 +435,10 @@ export class QuickInputExt implements QuickInput {
435
435
  };
436
436
  if (ThemeIcon.is(iconPath)) {
437
437
  return iconPath;
438
- } else if (typeof iconPath === 'string' || iconPath instanceof monaco.Uri) {
438
+ } else if (typeof iconPath === 'string' || iconPath instanceof URI) {
439
439
  return URI.parse(toUrl(iconPath));
440
440
  } else {
441
- const { light, dark } = iconPath as { light: string | monaco.Uri, dark: string | monaco.Uri };
441
+ const { light, dark } = iconPath as { light: string | URI, dark: string | URI };
442
442
  return {
443
443
  light: toUrl(light),
444
444
  dark: toUrl(dark)
@@ -613,15 +613,20 @@ export class QuickPickExt<T extends theia.QuickPickItem> extends QuickInputExt i
613
613
  this._itemsToHandles.set(item, i);
614
614
  });
615
615
  this.update({
616
- items: items.map((item, i) => ({
617
- type: item.type,
618
- label: item.label,
619
- description: item.description,
620
- handle: i,
621
- detail: item.detail,
622
- picked: item.picked,
623
- alwaysShow: item.alwaysShow
624
- }))
616
+ items: items.map((item, i) => {
617
+ if (item.type === 'separator') {
618
+ return { type: item.type, label: item.label };
619
+ }
620
+ return {
621
+ type: item.type,
622
+ label: item.label,
623
+ description: item.description,
624
+ handle: i,
625
+ detail: item.detail,
626
+ picked: item.picked,
627
+ alwaysShow: item.alwaysShow
628
+ };
629
+ })
625
630
  });
626
631
  }
627
632
 
@@ -1067,31 +1067,24 @@ export function fromColorPresentation(colorPresentation: theia.ColorPresentation
1067
1067
  }
1068
1068
 
1069
1069
  export function convertToTransferQuickPickItems(items: rpc.Item[]): rpc.TransferQuickPickItems[] {
1070
- const pickItems: rpc.TransferQuickPickItems[] = [];
1071
- for (let handle = 0; handle < items.length; handle++) {
1072
- const item = items[handle];
1073
- let label: string;
1074
- let description: string | undefined;
1075
- let detail: string | undefined;
1076
- let picked: boolean | undefined;
1077
- let alwaysShow: boolean | undefined;
1078
-
1070
+ return items.map<rpc.TransferQuickPickItems>((item, index) => {
1079
1071
  if (typeof item === 'string') {
1080
- label = item;
1072
+ return { type: 'item', label: item, handle: index };
1073
+ } else if (item.type === 'separator') {
1074
+ return { ...item, handle: index };
1081
1075
  } else {
1082
- ({ label, description, detail, picked, alwaysShow } = item);
1076
+ const { label, description, detail, picked, alwaysShow } = item;
1077
+ return {
1078
+ type: 'item',
1079
+ label,
1080
+ description,
1081
+ detail,
1082
+ picked,
1083
+ alwaysShow,
1084
+ handle: index,
1085
+ };
1083
1086
  }
1084
-
1085
- pickItems.push({
1086
- label,
1087
- description,
1088
- handle,
1089
- detail,
1090
- picked,
1091
- alwaysShow
1092
- });
1093
- }
1094
- return pickItems;
1087
+ });
1095
1088
  }
1096
1089
 
1097
1090
  export namespace DecorationRenderOptions {
@@ -1,20 +0,0 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2018 Red Hat, Inc. and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- // eslint-disable-next-line spaced-comment
18
- /// <reference types='@theia/monaco/src/typings/monaco'/>
19
-
20
- /* expose internal APIs in @theia/monaco/src/typings/monaco */