@theia/plugin-ext 1.19.0 → 1.20.0

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 (37) hide show
  1. package/lib/common/plugin-api-rpc.d.ts +2 -1
  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/plugin-protocol.d.ts +1 -1
  5. package/lib/common/plugin-protocol.d.ts.map +1 -1
  6. package/lib/common/plugin-protocol.js.map +1 -1
  7. package/lib/hosted/node/scanners/scanner-theia.d.ts +1 -1
  8. package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
  9. package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
  10. package/lib/main/browser/tasks-main.d.ts.map +1 -1
  11. package/lib/main/browser/tasks-main.js +6 -0
  12. package/lib/main/browser/tasks-main.js.map +1 -1
  13. package/lib/main/browser/view/tree-view-widget.d.ts +0 -3
  14. package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
  15. package/lib/main/browser/view/tree-view-widget.js +1 -11
  16. package/lib/main/browser/view/tree-view-widget.js.map +1 -1
  17. package/lib/plugin/message-registry.d.ts.map +1 -1
  18. package/lib/plugin/message-registry.js +5 -5
  19. package/lib/plugin/message-registry.js.map +1 -1
  20. package/lib/plugin/quick-open.d.ts +1 -1
  21. package/lib/plugin/quick-open.d.ts.map +1 -1
  22. package/lib/plugin/quick-open.js +2 -4
  23. package/lib/plugin/quick-open.js.map +1 -1
  24. package/lib/plugin/tasks/tasks.d.ts +1 -3
  25. package/lib/plugin/tasks/tasks.d.ts.map +1 -1
  26. package/lib/plugin/tasks/tasks.js +3 -17
  27. package/lib/plugin/tasks/tasks.js.map +1 -1
  28. package/package.json +24 -24
  29. package/src/common/plugin-api-rpc.ts +2 -2
  30. package/src/common/plugin-protocol.ts +1 -2
  31. package/src/hosted/node/scanners/scanner-theia.ts +1 -2
  32. package/src/main/browser/style/tree.css +4 -0
  33. package/src/main/browser/tasks-main.ts +7 -0
  34. package/src/main/browser/view/tree-view-widget.tsx +2 -19
  35. package/src/plugin/message-registry.ts +5 -6
  36. package/src/plugin/quick-open.ts +4 -7
  37. package/src/plugin/tasks/tasks.ts +4 -18
@@ -37,7 +37,7 @@ import { MenuPath, MenuModelRegistry, ActionMenuNode } from '@theia/core/lib/com
37
37
  import * as React from '@theia/core/shared/react';
38
38
  import { PluginSharedStyle } from '../plugin-shared-style';
39
39
  import { ViewContextKeyService } from './view-context-key-service';
40
- import { Widget } from '@theia/core/lib/browser/widgets/widget';
40
+ import { ACTION_ITEM, Widget } from '@theia/core/lib/browser/widgets/widget';
41
41
  import { Emitter, Event } from '@theia/core/lib/common/event';
42
42
  import { MessageService } from '@theia/core/lib/common/message-service';
43
43
  import { View } from '../../../common/plugin-protocol';
@@ -327,9 +327,6 @@ export class TreeViewWidget extends TreeViewWelcomeWidget {
327
327
  }
328
328
 
329
329
  protected renderTailDecorations(node: TreeViewNode, props: NodeProps): React.ReactNode {
330
- if (this.model.selectedNodes.every(selected => selected.id !== node.id) && node.id !== this.hoverNodeId) {
331
- return false;
332
- }
333
330
  return this.contextKeys.with({ view: this.id, viewItem: node.contextValue }, () => {
334
331
  const menu = this.menus.getMenu(VIEW_ITEM_INLINE_MENU);
335
332
  const arg = this.toTreeViewSelection(node);
@@ -349,27 +346,13 @@ export class TreeViewWidget extends TreeViewWelcomeWidget {
349
346
  if (!icon || !this.commands.isVisible(node.action.commandId, arg) || !this.contextKeys.match(node.action.when)) {
350
347
  return false;
351
348
  }
352
- const className = [TREE_NODE_SEGMENT_CLASS, TREE_NODE_TAIL_CLASS, icon, 'theia-tree-view-inline-action'].join(' ');
349
+ const className = [TREE_NODE_SEGMENT_CLASS, TREE_NODE_TAIL_CLASS, icon, ACTION_ITEM, 'theia-tree-view-inline-action'].join(' ');
353
350
  return <div key={index} className={className} title={node.label} onClick={e => {
354
351
  e.stopPropagation();
355
352
  this.commands.executeCommand(node.action.commandId, arg);
356
353
  }} />;
357
354
  }
358
355
 
359
- protected hoverNodeId: string | undefined;
360
- protected setHoverNodeId(hoverNodeId: string | undefined): void {
361
- this.hoverNodeId = hoverNodeId;
362
- this.update();
363
- }
364
-
365
- protected createNodeAttributes(node: TreeNode, props: NodeProps): React.Attributes & React.HTMLAttributes<HTMLElement> {
366
- return {
367
- ...super.createNodeAttributes(node, props),
368
- onMouseOver: () => this.setHoverNodeId(node.id),
369
- onMouseOut: () => this.setHoverNodeId(undefined)
370
- };
371
- }
372
-
373
356
  protected toContextMenuArgs(node: SelectableTreeNode): [TreeViewSelection] {
374
357
  return [this.toTreeViewSelection(node)];
375
358
  }
@@ -55,12 +55,11 @@ export class MessageRegistryExt {
55
55
  }
56
56
  }
57
57
  }
58
- for (const item of rest) {
59
- pushItem(item);
60
- }
61
- const actionHandle = await this.proxy.$showMessage(type, message, options, actions);
62
- return actionHandle !== undefined ? items[actionHandle] : undefined;
63
58
  }
64
-
59
+ for (const item of rest) {
60
+ pushItem(item);
61
+ }
62
+ const actionHandle = await this.proxy.$showMessage(type, message, options, actions);
63
+ return actionHandle !== undefined ? items[actionHandle] : undefined;
65
64
  }
66
65
  }
@@ -30,6 +30,7 @@ import * as path from 'path';
30
30
  import { convertToTransferQuickPickItems } from './type-converters';
31
31
  import { PluginPackage } from '../common/plugin-protocol';
32
32
  import { QuickInputButtonHandle } from '@theia/core/lib/browser';
33
+ import { MaybePromise } from '@theia/core/lib/common/types';
33
34
 
34
35
  const canceledName = 'Canceled';
35
36
  /**
@@ -64,7 +65,7 @@ export function getDarkIconUri(iconPath: URI | { light: URI; dark: URI; }): URI
64
65
  export class QuickOpenExtImpl implements QuickOpenExt {
65
66
  private proxy: QuickOpenMain;
66
67
  private onDidSelectItem: undefined | ((handle: number) => void);
67
- private validateInputHandler: (input: string) => Promise<string | null | undefined> | undefined;
68
+ private validateInputHandler?: (input: string) => MaybePromise<string | null | undefined>;
68
69
  private _sessions = new Map<number, QuickInputExt>(); // Each quickinput will have a number so that we know where to fire events
69
70
  private _instances = 0;
70
71
 
@@ -143,17 +144,13 @@ export class QuickOpenExtImpl implements QuickOpenExt {
143
144
  // ---- input
144
145
 
145
146
  showInput(options?: InputBoxOptions, token: theia.CancellationToken = CancellationToken.None): PromiseLike<string | undefined> {
146
- if (options?.validateInput) {
147
- this.validateInputHandler = options.validateInput;
148
- }
149
-
147
+ this.validateInputHandler = options?.validateInput;
150
148
  if (!options) { options = { placeHolder: '' }; }
151
149
  return this.proxy.$input(options, typeof this.validateInputHandler === 'function', token);
152
150
  }
153
151
 
154
152
  async showInputBox(options: TransferInputBox): Promise<string | undefined> {
155
- this.validateInputHandler = options && options.validateInput;
156
-
153
+ this.validateInputHandler = typeof options.validateInput === 'function' ? options.validateInput : undefined;
157
154
  return this.proxy.$showInputBox(options, typeof this.validateInputHandler === 'function');
158
155
  }
159
156
 
@@ -24,7 +24,7 @@ import {
24
24
  import * as theia from '@theia/plugin';
25
25
  import * as converter from '../type-converters';
26
26
  import { CustomExecution, Disposable } from '../types-impl';
27
- import { RPCProtocol, ConnectionClosedError } from '../../common/rpc-protocol';
27
+ import { RPCProtocol } from '../../common/rpc-protocol';
28
28
  import { TaskProviderAdapter } from './task-provider';
29
29
  import { Emitter, Event } from '@theia/core/lib/common/event';
30
30
  import { TerminalServiceExtImpl } from '../terminal-ext';
@@ -49,15 +49,8 @@ export class TasksExtImpl implements TasksExt {
49
49
  private readonly onDidExecuteTaskProcess: Emitter<theia.TaskProcessStartEvent> = new Emitter<theia.TaskProcessStartEvent>();
50
50
  private readonly onDidTerminateTaskProcess: Emitter<theia.TaskProcessEndEvent> = new Emitter<theia.TaskProcessEndEvent>();
51
51
 
52
- private disposed = false;
53
-
54
52
  constructor(rpc: RPCProtocol, readonly terminalExt: TerminalServiceExtImpl) {
55
53
  this.proxy = rpc.getProxy(PLUGIN_RPC_CONTEXT.TASKS_MAIN);
56
- this.fetchTaskExecutions();
57
- }
58
-
59
- dispose(): void {
60
- this.disposed = true;
61
54
  }
62
55
 
63
56
  get taskExecutions(): ReadonlyArray<theia.TaskExecution> {
@@ -216,16 +209,9 @@ export class TasksExtImpl implements TasksExt {
216
209
  });
217
210
  }
218
211
 
219
- private async fetchTaskExecutions(): Promise<void> {
220
- try {
221
- const taskExecutions = await this.proxy.$taskExecutions();
222
- taskExecutions.forEach(execution => this.getTaskExecution(execution));
223
- } catch (error) {
224
- if (this.disposed && ConnectionClosedError.is(error)) {
225
- return;
226
- }
227
- console.error(`Can not fetch running tasks: ${error}`);
228
- }
212
+ // Initial `this.executions` map with the running tasks from the previous session
213
+ async $initLoadedTasks(taskExecutions: TaskExecutionDto[]): Promise<void> {
214
+ taskExecutions.forEach(execution => this.getTaskExecution(execution));
229
215
  }
230
216
 
231
217
  private getTaskExecution(execution: TaskExecutionDto): theia.TaskExecution {