@theia/plugin-ext 1.37.0-next.22 → 1.37.0-next.29

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 (65) hide show
  1. package/lib/common/plugin-api-rpc-model.d.ts +6 -0
  2. package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
  3. package/lib/common/plugin-api-rpc-model.js +6 -1
  4. package/lib/common/plugin-api-rpc-model.js.map +1 -1
  5. package/lib/common/plugin-api-rpc.d.ts +5 -1
  6. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  7. package/lib/common/plugin-api-rpc.js.map +1 -1
  8. package/lib/hosted/browser/hosted-plugin.d.ts +6 -2
  9. package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
  10. package/lib/hosted/browser/hosted-plugin.js +25 -4
  11. package/lib/hosted/browser/hosted-plugin.js.map +1 -1
  12. package/lib/main/browser/comments/comment-thread-widget.d.ts.map +1 -1
  13. package/lib/main/browser/comments/comment-thread-widget.js +5 -1
  14. package/lib/main/browser/comments/comment-thread-widget.js.map +1 -1
  15. package/lib/main/browser/comments/comments-main.d.ts +6 -1
  16. package/lib/main/browser/comments/comments-main.d.ts.map +1 -1
  17. package/lib/main/browser/comments/comments-main.js +15 -0
  18. package/lib/main/browser/comments/comments-main.js.map +1 -1
  19. package/lib/plugin/comments.d.ts +3 -0
  20. package/lib/plugin/comments.d.ts.map +1 -1
  21. package/lib/plugin/comments.js +24 -0
  22. package/lib/plugin/comments.js.map +1 -1
  23. package/lib/plugin/output-channel/log-output-channel.d.ts +24 -0
  24. package/lib/plugin/output-channel/log-output-channel.d.ts.map +1 -0
  25. package/lib/plugin/output-channel/log-output-channel.js +92 -0
  26. package/lib/plugin/output-channel/log-output-channel.js.map +1 -0
  27. package/lib/plugin/output-channel/output-channel-item.d.ts +3 -3
  28. package/lib/plugin/output-channel/output-channel-item.d.ts.map +1 -1
  29. package/lib/plugin/output-channel/output-channel-item.js.map +1 -1
  30. package/lib/plugin/output-channel-registry.d.ts +7 -2
  31. package/lib/plugin/output-channel-registry.d.ts.map +1 -1
  32. package/lib/plugin/output-channel-registry.js +15 -6
  33. package/lib/plugin/output-channel-registry.js.map +1 -1
  34. package/lib/plugin/plugin-context.d.ts.map +1 -1
  35. package/lib/plugin/plugin-context.js +5 -2
  36. package/lib/plugin/plugin-context.js.map +1 -1
  37. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  38. package/lib/plugin/plugin-manager.js +1 -0
  39. package/lib/plugin/plugin-manager.js.map +1 -1
  40. package/lib/plugin/stubs/tests-api.d.ts +2 -1
  41. package/lib/plugin/stubs/tests-api.d.ts.map +1 -1
  42. package/lib/plugin/stubs/tests-api.js +2 -1
  43. package/lib/plugin/stubs/tests-api.js.map +1 -1
  44. package/lib/plugin/type-converters.d.ts.map +1 -1
  45. package/lib/plugin/type-converters.js +6 -3
  46. package/lib/plugin/type-converters.js.map +1 -1
  47. package/lib/plugin/types-impl.d.ts +8 -4
  48. package/lib/plugin/types-impl.d.ts.map +1 -1
  49. package/lib/plugin/types-impl.js +12 -7
  50. package/lib/plugin/types-impl.js.map +1 -1
  51. package/package.json +26 -26
  52. package/src/common/plugin-api-rpc-model.ts +7 -0
  53. package/src/common/plugin-api-rpc.ts +4 -1
  54. package/src/hosted/browser/hosted-plugin.ts +26 -5
  55. package/src/main/browser/comments/comment-thread-widget.tsx +6 -1
  56. package/src/main/browser/comments/comments-main.ts +18 -1
  57. package/src/plugin/comments.ts +32 -1
  58. package/src/plugin/output-channel/log-output-channel.ts +108 -0
  59. package/src/plugin/output-channel/output-channel-item.ts +2 -2
  60. package/src/plugin/output-channel-registry.ts +20 -7
  61. package/src/plugin/plugin-context.ts +6 -2
  62. package/src/plugin/plugin-manager.ts +1 -0
  63. package/src/plugin/stubs/tests-api.ts +3 -1
  64. package/src/plugin/type-converters.ts +5 -3
  65. package/src/plugin/types-impl.ts +8 -3
package/package.json CHANGED
@@ -1,35 +1,35 @@
1
1
  {
2
2
  "name": "@theia/plugin-ext",
3
- "version": "1.37.0-next.22+0e0e9ee4b",
3
+ "version": "1.37.0-next.29+53b3841a9",
4
4
  "description": "Theia - Plugin Extension",
5
5
  "main": "lib/common/index.js",
6
6
  "typings": "lib/common/index.d.ts",
7
7
  "dependencies": {
8
- "@theia/bulk-edit": "1.37.0-next.22+0e0e9ee4b",
9
- "@theia/callhierarchy": "1.37.0-next.22+0e0e9ee4b",
10
- "@theia/console": "1.37.0-next.22+0e0e9ee4b",
11
- "@theia/core": "1.37.0-next.22+0e0e9ee4b",
12
- "@theia/debug": "1.37.0-next.22+0e0e9ee4b",
13
- "@theia/editor": "1.37.0-next.22+0e0e9ee4b",
14
- "@theia/editor-preview": "1.37.0-next.22+0e0e9ee4b",
15
- "@theia/file-search": "1.37.0-next.22+0e0e9ee4b",
16
- "@theia/filesystem": "1.37.0-next.22+0e0e9ee4b",
17
- "@theia/markers": "1.37.0-next.22+0e0e9ee4b",
18
- "@theia/messages": "1.37.0-next.22+0e0e9ee4b",
19
- "@theia/monaco": "1.37.0-next.22+0e0e9ee4b",
8
+ "@theia/bulk-edit": "1.37.0-next.29+53b3841a9",
9
+ "@theia/callhierarchy": "1.37.0-next.29+53b3841a9",
10
+ "@theia/console": "1.37.0-next.29+53b3841a9",
11
+ "@theia/core": "1.37.0-next.29+53b3841a9",
12
+ "@theia/debug": "1.37.0-next.29+53b3841a9",
13
+ "@theia/editor": "1.37.0-next.29+53b3841a9",
14
+ "@theia/editor-preview": "1.37.0-next.29+53b3841a9",
15
+ "@theia/file-search": "1.37.0-next.29+53b3841a9",
16
+ "@theia/filesystem": "1.37.0-next.29+53b3841a9",
17
+ "@theia/markers": "1.37.0-next.29+53b3841a9",
18
+ "@theia/messages": "1.37.0-next.29+53b3841a9",
19
+ "@theia/monaco": "1.37.0-next.29+53b3841a9",
20
20
  "@theia/monaco-editor-core": "1.72.3",
21
- "@theia/navigator": "1.37.0-next.22+0e0e9ee4b",
22
- "@theia/output": "1.37.0-next.22+0e0e9ee4b",
23
- "@theia/plugin": "1.37.0-next.22+0e0e9ee4b",
24
- "@theia/preferences": "1.37.0-next.22+0e0e9ee4b",
25
- "@theia/scm": "1.37.0-next.22+0e0e9ee4b",
26
- "@theia/search-in-workspace": "1.37.0-next.22+0e0e9ee4b",
27
- "@theia/task": "1.37.0-next.22+0e0e9ee4b",
28
- "@theia/terminal": "1.37.0-next.22+0e0e9ee4b",
29
- "@theia/timeline": "1.37.0-next.22+0e0e9ee4b",
30
- "@theia/typehierarchy": "1.37.0-next.22+0e0e9ee4b",
31
- "@theia/variable-resolver": "1.37.0-next.22+0e0e9ee4b",
32
- "@theia/workspace": "1.37.0-next.22+0e0e9ee4b",
21
+ "@theia/navigator": "1.37.0-next.29+53b3841a9",
22
+ "@theia/output": "1.37.0-next.29+53b3841a9",
23
+ "@theia/plugin": "1.37.0-next.29+53b3841a9",
24
+ "@theia/preferences": "1.37.0-next.29+53b3841a9",
25
+ "@theia/scm": "1.37.0-next.29+53b3841a9",
26
+ "@theia/search-in-workspace": "1.37.0-next.29+53b3841a9",
27
+ "@theia/task": "1.37.0-next.29+53b3841a9",
28
+ "@theia/terminal": "1.37.0-next.29+53b3841a9",
29
+ "@theia/timeline": "1.37.0-next.29+53b3841a9",
30
+ "@theia/typehierarchy": "1.37.0-next.29+53b3841a9",
31
+ "@theia/variable-resolver": "1.37.0-next.29+53b3841a9",
32
+ "@theia/workspace": "1.37.0-next.29+53b3841a9",
33
33
  "@types/mime": "^2.0.1",
34
34
  "@vscode/debugprotocol": "^1.51.0",
35
35
  "decompress": "^4.2.1",
@@ -94,5 +94,5 @@
94
94
  "nyc": {
95
95
  "extends": "../../configs/nyc.json"
96
96
  },
97
- "gitHead": "0e0e9ee4b38b94edfee5d521b8cdacb832d72f86"
97
+ "gitHead": "53b3841a910f05937c6f18cbeb61395dd893ded4"
98
98
  }
@@ -686,6 +686,11 @@ export interface Comment {
686
686
  readonly timestamp?: string;
687
687
  }
688
688
 
689
+ export enum CommentThreadState {
690
+ Unresolved = 0,
691
+ Resolved = 1
692
+ }
693
+
689
694
  export enum CommentThreadCollapsibleState {
690
695
  /**
691
696
  * Determines an item is collapsed
@@ -714,10 +719,12 @@ export interface CommentThread {
714
719
  comments: Comment[] | undefined;
715
720
  onDidChangeComments: TheiaEvent<Comment[] | undefined>;
716
721
  collapsibleState?: CommentThreadCollapsibleState;
722
+ state?: CommentThreadState;
717
723
  input?: CommentInput;
718
724
  onDidChangeInput: TheiaEvent<CommentInput | undefined>;
719
725
  onDidChangeRange: TheiaEvent<Range>;
720
726
  onDidChangeLabel: TheiaEvent<string | undefined>;
727
+ onDidChangeState: TheiaEvent<CommentThreadState | undefined>;
721
728
  onDidChangeCollapsibleState: TheiaEvent<CommentThreadCollapsibleState | undefined>;
722
729
  isDisposed: boolean;
723
730
  canReply: boolean;
@@ -72,6 +72,7 @@ import {
72
72
  CallHierarchyOutgoingCall,
73
73
  Comment,
74
74
  CommentOptions,
75
+ CommentThreadState,
75
76
  CommentThreadCollapsibleState,
76
77
  CommentThread,
77
78
  CommentThreadChangedEvent,
@@ -287,7 +288,8 @@ export interface TerminalServiceExt {
287
288
  getEnvironmentVariableCollection(extensionIdentifier: string): theia.EnvironmentVariableCollection;
288
289
  }
289
290
  export interface OutputChannelRegistryExt {
290
- createOutputChannel(name: string, pluginInfo: PluginInfo): theia.OutputChannel
291
+ createOutputChannel(name: string, pluginInfo: PluginInfo): theia.OutputChannel,
292
+ createOutputChannel(name: string, pluginInfo: PluginInfo, options: { log: true }): theia.LogOutputChannel
291
293
  }
292
294
 
293
295
  export interface ConnectionMain {
@@ -1942,6 +1944,7 @@ export type CommentThreadChanges = Partial<{
1942
1944
  contextValue: string,
1943
1945
  comments: Comment[],
1944
1946
  collapseState: CommentThreadCollapsibleState;
1947
+ state: CommentThreadState;
1945
1948
  canReply: boolean;
1946
1949
  }>;
1947
1950
 
@@ -49,7 +49,8 @@ import { WaitUntilEvent } from '@theia/core/lib/common/event';
49
49
  import { FileSearchService } from '@theia/file-search/lib/common/file-search-service';
50
50
  import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
51
51
  import { PluginViewRegistry } from '../../main/browser/view/plugin-view-registry';
52
- import { TaskProviderRegistry, TaskResolverRegistry } from '@theia/task/lib/browser/task-contribution';
52
+ import { WillResolveTaskProvider, TaskProviderRegistry, TaskResolverRegistry } from '@theia/task/lib/browser/task-contribution';
53
+ import { TaskDefinitionRegistry } from '@theia/task/lib/browser/task-definition-registry';
53
54
  import { WebviewEnvironment } from '../../main/browser/webview/webview-environment';
54
55
  import { WebviewWidget } from '../../main/browser/webview/webview';
55
56
  import { WidgetManager } from '@theia/core/lib/browser/widget-manager';
@@ -73,6 +74,7 @@ export type PluginHost = 'frontend' | string;
73
74
  export type DebugActivationEvent = 'onDebugResolve' | 'onDebugInitialConfigurations' | 'onDebugAdapterProtocolTracker' | 'onDebugDynamicConfigurations';
74
75
 
75
76
  export const PluginProgressLocation = 'plugin';
77
+ export const ALL_ACTIVATION_EVENT = '*';
76
78
 
77
79
  @injectable()
78
80
  export class HostedPluginSupport {
@@ -139,6 +141,9 @@ export class HostedPluginSupport {
139
141
  @inject(TaskResolverRegistry)
140
142
  protected readonly taskResolverRegistry: TaskResolverRegistry;
141
143
 
144
+ @inject(TaskDefinitionRegistry)
145
+ protected readonly taskDefinitionRegistry: TaskDefinitionRegistry;
146
+
142
147
  @inject(ProgressService)
143
148
  protected readonly progressService: ProgressService;
144
149
 
@@ -205,7 +210,7 @@ export class HostedPluginSupport {
205
210
  this.debugSessionManager.onWillResolveDebugConfiguration(event => this.ensureDebugActivation(event, 'onDebugResolve', event.debugType));
206
211
  this.debugConfigurationManager.onWillProvideDebugConfiguration(event => this.ensureDebugActivation(event, 'onDebugInitialConfigurations'));
207
212
  // Activate all providers of dynamic configurations, i.e. Let the user pick a configuration from all the available ones.
208
- this.debugConfigurationManager.onWillProvideDynamicDebugConfiguration(event => this.ensureDebugActivation(event, 'onDebugDynamicConfigurations', '*'));
213
+ this.debugConfigurationManager.onWillProvideDynamicDebugConfiguration(event => this.ensureDebugActivation(event, 'onDebugDynamicConfigurations', ALL_ACTIVATION_EVENT));
209
214
  this.viewRegistry.onDidExpandView(id => this.activateByView(id));
210
215
  this.taskProviderRegistry.onWillProvideTaskProvider(event => this.ensureTaskActivation(event));
211
216
  this.taskResolverRegistry.onWillProvideTaskResolver(event => this.ensureTaskActivation(event));
@@ -610,6 +615,10 @@ export class HostedPluginSupport {
610
615
  await this.activateByEvent(`onCommand:${commandId}`);
611
616
  }
612
617
 
618
+ async activateByTaskType(taskType: string): Promise<void> {
619
+ await this.activateByEvent(`onTaskType:${taskType}`);
620
+ }
621
+
613
622
  async activateByCustomEditor(viewType: string): Promise<void> {
614
623
  await this.activateByEvent(`onCustomEditor:${viewType}`);
615
624
  }
@@ -648,8 +657,20 @@ export class HostedPluginSupport {
648
657
  event.waitUntil(p);
649
658
  }
650
659
 
651
- protected ensureTaskActivation(event: WaitUntilEvent): void {
652
- event.waitUntil(this.activateByCommand('workbench.action.tasks.runTask'));
660
+ protected ensureTaskActivation(event: WillResolveTaskProvider): void {
661
+ const promises = [this.activateByCommand('workbench.action.tasks.runTask')];
662
+ const taskType = event.taskType;
663
+ if (taskType) {
664
+ if (taskType === ALL_ACTIVATION_EVENT) {
665
+ for (const taskDefinition of this.taskDefinitionRegistry.getAll()) {
666
+ promises.push(this.activateByTaskType(taskDefinition.taskType));
667
+ }
668
+ } else {
669
+ promises.push(this.activateByTaskType(taskType));
670
+ }
671
+ }
672
+
673
+ event.waitUntil(Promise.all(promises));
653
674
  }
654
675
 
655
676
  protected ensureDebugActivation(event: WaitUntilEvent, activationEvent?: DebugActivationEvent, debugType?: string): void {
@@ -678,7 +699,7 @@ export class HostedPluginSupport {
678
699
  for (const activationEvent of activationEvents) {
679
700
  if (/^workspaceContains:/.test(activationEvent)) {
680
701
  const fileNameOrGlob = activationEvent.substr('workspaceContains:'.length);
681
- if (fileNameOrGlob.indexOf('*') >= 0 || fileNameOrGlob.indexOf('?') >= 0) {
702
+ if (fileNameOrGlob.indexOf(ALL_ACTIVATION_EVENT) >= 0 || fileNameOrGlob.indexOf('?') >= 0) {
682
703
  includePatterns.push(fileNameOrGlob);
683
704
  } else {
684
705
  paths.push(fileNameOrGlob);
@@ -18,6 +18,7 @@ import {
18
18
  Comment,
19
19
  CommentMode,
20
20
  CommentThread,
21
+ CommentThreadState,
21
22
  CommentThreadCollapsibleState
22
23
  } from '../../../common/plugin-api-rpc-model';
23
24
  import { CommentGlyphWidget } from './comment-glyph-widget';
@@ -97,6 +98,9 @@ export class CommentThreadWidget extends BaseWidget {
97
98
  commentForm.update();
98
99
  }
99
100
  }));
101
+ this.toDispose.push(this._commentThread.onDidChangeState(_state => {
102
+ this.update();
103
+ }));
100
104
  this.contextMenu = this.menus.getMenu(COMMENT_THREAD_CONTEXT);
101
105
  this.contextMenu.children.map(node => node instanceof ActionMenuNode && node.when).forEach(exp => {
102
106
  if (typeof exp === 'string') {
@@ -231,7 +235,8 @@ export class CommentThreadWidget extends BaseWidget {
231
235
  if (this._commentThread.comments && this._commentThread.comments.length) {
232
236
  const onlyUnique = (value: Comment, index: number, self: Comment[]) => self.indexOf(value) === index;
233
237
  const participantsList = this._commentThread.comments.filter(onlyUnique).map(comment => `@${comment.userName}`).join(', ');
234
- label = `Participants: ${participantsList}`;
238
+ const resolutionState = this._commentThread.state === CommentThreadState.Resolved ? '(Resolved)' : '(Unresolved)';
239
+ label = `Participants: ${participantsList} ${resolutionState}`;
235
240
  } else {
236
241
  label = 'Start discussion';
237
242
  }
@@ -23,7 +23,7 @@ import {
23
23
  CommentThreadChangedEvent
24
24
  } from '../../../common/plugin-api-rpc-model';
25
25
  import { Event, Emitter } from '@theia/core/lib/common/event';
26
- import { CommentThreadCollapsibleState } from '../../../plugin/types-impl';
26
+ import { CommentThreadCollapsibleState, CommentThreadState } from '../../../plugin/types-impl';
27
27
  import {
28
28
  CommentProviderFeatures,
29
29
  CommentsExt,
@@ -124,6 +124,21 @@ export class CommentThreadImpl implements CommentThread, Disposable {
124
124
  private readonly onDidChangeCollapsibleStateEmitter = new Emitter<CommentThreadCollapsibleState | undefined>();
125
125
  readonly onDidChangeCollapsibleState = this.onDidChangeCollapsibleStateEmitter.event;
126
126
 
127
+ private _state: CommentThreadState | undefined;
128
+ get state(): CommentThreadState | undefined {
129
+ return this._state;
130
+ }
131
+
132
+ set state(newState: CommentThreadState | undefined) {
133
+ if (this._state !== newState) {
134
+ this._state = newState;
135
+ this.onDidChangeStateEmitter.fire(this._state);
136
+ }
137
+ }
138
+
139
+ private readonly onDidChangeStateEmitter = new Emitter<CommentThreadState | undefined>();
140
+ readonly onDidChangeState = this.onDidChangeStateEmitter.event;
141
+
127
142
  private readonly onDidChangeCanReplyEmitter = new Emitter<boolean>();
128
143
  readonly onDidChangeCanReply = this.onDidChangeCanReplyEmitter.event;
129
144
 
@@ -163,12 +178,14 @@ export class CommentThreadImpl implements CommentThread, Disposable {
163
178
  if (modified('contextValue')) { this._contextValue = changes.contextValue; }
164
179
  if (modified('comments')) { this._comments = changes.comments; }
165
180
  if (modified('collapseState')) { this._collapsibleState = changes.collapseState; }
181
+ if (modified('state')) { this._state = changes.state; }
166
182
  if (modified('canReply')) { this._canReply = changes.canReply!; }
167
183
  }
168
184
 
169
185
  dispose(): void {
170
186
  this._isDisposed = true;
171
187
  this.onDidChangeCollapsibleStateEmitter.dispose();
188
+ this.onDidChangeStateEmitter.dispose();
172
189
  this.onDidChangeCommentsEmitter.dispose();
173
190
  this.onDidChangeInputEmitter.dispose();
174
191
  this.onDidChangeLabelEmitter.dispose();
@@ -18,10 +18,11 @@ import * as theia from '@theia/plugin';
18
18
  import { RPCProtocol } from '../common/rpc-protocol';
19
19
  import { CommandRegistryImpl } from './command-registry';
20
20
  import { UriComponents } from '../common/uri-components';
21
- import { CommentThreadCollapsibleState, URI } from './types-impl';
21
+ import { CommentThreadCollapsibleState, CommentThreadState, URI } from './types-impl';
22
22
  import {
23
23
  Range,
24
24
  Comment,
25
+ CommentThreadState as CommentThreadStateModel,
25
26
  CommentThreadCollapsibleState as CommentThreadCollapsibleStateModel,
26
27
  CommentOptions
27
28
  } from '../common/plugin-api-rpc-model';
@@ -185,6 +186,7 @@ type CommentThreadModification = Partial<{
185
186
  contextValue: string | undefined,
186
187
  comments: theia.Comment[],
187
188
  collapsibleState: theia.CommentThreadCollapsibleState
189
+ state: theia.CommentThreadState
188
190
  canReply: boolean;
189
191
  }>;
190
192
 
@@ -276,6 +278,20 @@ export class ExtHostCommentThread implements theia.CommentThread, theia.Disposab
276
278
  this._onDidUpdateCommentThread.fire();
277
279
  }
278
280
 
281
+ private _state?: theia.CommentThreadState;
282
+
283
+ get state(): theia.CommentThreadState {
284
+ return this._state!;
285
+ }
286
+
287
+ set state(newState: theia.CommentThreadState) {
288
+ if (this._state !== newState) {
289
+ this._state = newState;
290
+ this.modifications.state = newState;
291
+ this._onDidUpdateCommentThread.fire();
292
+ }
293
+ }
294
+
279
295
  private localDisposables: Disposable[];
280
296
 
281
297
  private _isDisposed: boolean;
@@ -357,6 +373,9 @@ export class ExtHostCommentThread implements theia.CommentThread, theia.Disposab
357
373
  if (modified('collapsibleState')) {
358
374
  formattedModifications.collapseState = convertToCollapsibleState(this.collapseState);
359
375
  }
376
+ if (modified('state')) {
377
+ formattedModifications.state = convertToState(this._state);
378
+ }
360
379
  if (modified('canReply')) {
361
380
  formattedModifications.canReply = this.canReply;
362
381
  }
@@ -516,3 +535,15 @@ function convertToCollapsibleState(kind: theia.CommentThreadCollapsibleState | u
516
535
  }
517
536
  return CommentThreadCollapsibleStateModel.Collapsed;
518
537
  }
538
+
539
+ function convertToState(kind: theia.CommentThreadState | undefined): CommentThreadStateModel {
540
+ if (kind !== undefined) {
541
+ switch (kind) {
542
+ case CommentThreadState.Resolved:
543
+ return CommentThreadStateModel.Resolved;
544
+ case CommentThreadState.Unresolved:
545
+ return CommentThreadStateModel.Unresolved;
546
+ }
547
+ }
548
+ return CommentThreadStateModel.Unresolved;
549
+ }
@@ -0,0 +1,108 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2023 STMicroelectronics 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
+ /* eslint-disable @typescript-eslint/no-explicit-any */
17
+
18
+ import { Emitter } from '@theia/core/shared/vscode-languageserver-protocol';
19
+ import * as theia from '@theia/plugin';
20
+
21
+ import { OutputChannelRegistryMain, PluginInfo } from '../../common/plugin-api-rpc';
22
+ import { OutputChannelImpl } from './output-channel-item';
23
+ import { LogLevel } from '../types-impl';
24
+ import { isArray, isObject } from '@theia/core';
25
+
26
+ export class LogOutputChannelImpl extends OutputChannelImpl implements theia.LogOutputChannel {
27
+
28
+ readonly onDidChangeLogLevelEmitter: Emitter<theia.LogLevel> = new Emitter<theia.LogLevel>();
29
+ readonly onDidChangeLogLevel: theia.Event<theia.LogLevel> = this.onDidChangeLogLevelEmitter.event;
30
+ public logLevel: theia.LogLevel;
31
+
32
+ constructor(name: string, proxy: OutputChannelRegistryMain, pluginInfo: PluginInfo) {
33
+ super(name, proxy, pluginInfo);
34
+ this.setLogLevel(LogLevel.Info);
35
+ }
36
+
37
+ setLogLevel(level: theia.LogLevel): void {
38
+ if (this.logLevel !== level) {
39
+ this.logLevel = level;
40
+ this.onDidChangeLogLevelEmitter.fire(this.logLevel);
41
+ }
42
+ }
43
+
44
+ getLogLevel(): theia.LogLevel {
45
+ return this.logLevel;
46
+ }
47
+
48
+ override append(value: string): void {
49
+ super.validate();
50
+ this.info(value);
51
+ }
52
+
53
+ override appendLine(value: string): void {
54
+ super.validate();
55
+ this.append(value + '\n');
56
+ }
57
+
58
+ override dispose(): void {
59
+ super.dispose();
60
+ this.onDidChangeLogLevelEmitter.dispose();
61
+ }
62
+
63
+ protected log(level: theia.LogLevel, message: string): void {
64
+ super.validate();
65
+ if (this.checkLogLevel(level)) {
66
+ const now = new Date();
67
+ const eol = message.endsWith('\n') ? '' : '\n';
68
+ const logMessage = `${now.toISOString()} [${LogLevel[level]}] ${message}${eol}`;
69
+ this.proxy.$append(this.name, logMessage, this.pluginInfo);
70
+ }
71
+ }
72
+
73
+ private checkLogLevel(level: theia.LogLevel): boolean {
74
+ return this.logLevel <= level;
75
+ }
76
+
77
+ trace(message: string, ...args: any[]): void {
78
+ this.log(LogLevel.Trace, this.format(message, args));
79
+ }
80
+
81
+ debug(message: string, ...args: any[]): void {
82
+ this.log(LogLevel.Debug, this.format(message, args));
83
+ }
84
+
85
+ info(message: string, ...args: any[]): void {
86
+ this.log(LogLevel.Info, this.format(message, args));
87
+ }
88
+
89
+ warn(message: string, ...args: any[]): void {
90
+ this.log(LogLevel.Warning, this.format(message, args));
91
+ }
92
+
93
+ error(errorMsg: string | Error, ...args: any[]): void {
94
+ if (errorMsg instanceof Error) {
95
+ this.log(LogLevel.Error, this.format(errorMsg.stack || errorMsg.message, args));
96
+ } else {
97
+ this.log(LogLevel.Error, this.format(errorMsg, args));
98
+ }
99
+ }
100
+
101
+ private format(message: string, args: any[]): string {
102
+ if (args.length > 0) {
103
+ return `${message} ${args.map((arg: any) => isObject(arg) || isArray(arg) ? JSON.stringify(arg) : arg).join(' ')}`;
104
+ }
105
+ return message;
106
+ }
107
+
108
+ }
@@ -20,7 +20,7 @@ export class OutputChannelImpl implements theia.OutputChannel {
20
20
 
21
21
  private disposed: boolean;
22
22
 
23
- constructor(readonly name: string, private proxy: OutputChannelRegistryMain, private readonly pluginInfo: PluginInfo) {
23
+ constructor(readonly name: string, protected readonly proxy: OutputChannelRegistryMain, protected readonly pluginInfo: PluginInfo) {
24
24
  }
25
25
 
26
26
  dispose(): void {
@@ -65,7 +65,7 @@ export class OutputChannelImpl implements theia.OutputChannel {
65
65
  this.proxy.$close(this.name);
66
66
  }
67
67
 
68
- private validate(): void {
68
+ protected validate(): void {
69
69
  if (this.disposed) {
70
70
  throw new Error('Channel has been closed');
71
71
  }
@@ -13,11 +13,12 @@
13
13
  //
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
- import {
17
- PLUGIN_RPC_CONTEXT as Ext, OutputChannelRegistryMain, PluginInfo, OutputChannelRegistryExt
18
- } from '../common/plugin-api-rpc';
19
- import { RPCProtocol } from '../common/rpc-protocol';
16
+
20
17
  import * as theia from '@theia/plugin';
18
+ import { PLUGIN_RPC_CONTEXT as Ext, OutputChannelRegistryExt, OutputChannelRegistryMain, PluginInfo } from '../common/plugin-api-rpc';
19
+ import { RPCProtocol } from '../common/rpc-protocol';
20
+ import { isObject } from '../common/types';
21
+ import { LogOutputChannelImpl } from './output-channel/log-output-channel';
21
22
  import { OutputChannelImpl } from './output-channel/output-channel-item';
22
23
 
23
24
  export class OutputChannelRegistryExtImpl implements OutputChannelRegistryExt {
@@ -28,12 +29,24 @@ export class OutputChannelRegistryExtImpl implements OutputChannelRegistryExt {
28
29
  this.proxy = rpc.getProxy(Ext.OUTPUT_CHANNEL_REGISTRY_MAIN);
29
30
  }
30
31
 
31
- createOutputChannel(name: string, pluginInfo: PluginInfo): theia.OutputChannel {
32
+ createOutputChannel(name: string, pluginInfo: PluginInfo): theia.OutputChannel;
33
+ createOutputChannel(name: string, pluginInfo: PluginInfo, options: { log: true; }): theia.LogOutputChannel;
34
+ createOutputChannel(name: string, pluginInfo: PluginInfo, options?: { log: true; }): theia.OutputChannel | theia.LogOutputChannel {
32
35
  name = name.trim();
33
36
  if (!name) {
34
37
  throw new Error('illegal argument \'name\'. must not be falsy');
35
- } else {
36
- return new OutputChannelImpl(name, this.proxy, pluginInfo);
37
38
  }
39
+ const isLogOutput = options && isObject(options);
40
+ return isLogOutput
41
+ ? this.doCreateLogOutputChannel(name, pluginInfo)
42
+ : this.doCreateOutputChannel(name, pluginInfo);
43
+ }
44
+
45
+ private doCreateOutputChannel(name: string, pluginInfo: PluginInfo): OutputChannelImpl {
46
+ return new OutputChannelImpl(name, this.proxy, pluginInfo);
47
+ }
48
+
49
+ private doCreateLogOutputChannel(name: string, pluginInfo: PluginInfo): LogOutputChannelImpl {
50
+ return new LogOutputChannelImpl(name, this.proxy, pluginInfo);
38
51
  }
39
52
  }
@@ -131,6 +131,7 @@ import {
131
131
  WebviewPanelTargetArea,
132
132
  UIKind,
133
133
  FileSystemError,
134
+ CommentThreadState,
134
135
  CommentThreadCollapsibleState,
135
136
  QuickInputButtons,
136
137
  QuickPickItemKind,
@@ -483,8 +484,10 @@ export function createAPIFactory(
483
484
 
484
485
  return statusBarMessageRegistryExt.createStatusBarItem(alignment, priority, id);
485
486
  },
486
- createOutputChannel(name: string): theia.OutputChannel {
487
- return outputChannelRegistryExt.createOutputChannel(name, pluginToPluginInfo(plugin));
487
+ createOutputChannel(name: string, options?: { log: true }): any {
488
+ return !options
489
+ ? outputChannelRegistryExt.createOutputChannel(name, pluginToPluginInfo(plugin))
490
+ : outputChannelRegistryExt.createOutputChannel(name, pluginToPluginInfo(plugin), options);
488
491
  },
489
492
  createWebviewPanel(viewType: string,
490
493
  title: string,
@@ -1276,6 +1279,7 @@ export function createAPIFactory(
1276
1279
  WebviewPanelTargetArea,
1277
1280
  UIKind,
1278
1281
  FileSystemError,
1282
+ CommentThreadState,
1279
1283
  CommentThreadCollapsibleState,
1280
1284
  QuickInputButtons,
1281
1285
  CommentMode,
@@ -87,6 +87,7 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
87
87
  'onDebugResolve',
88
88
  'onDebugAdapterProtocolTracker',
89
89
  'onDebugDynamicConfigurations',
90
+ 'onTaskType',
90
91
  'workspaceContains',
91
92
  'onView',
92
93
  'onUri',
@@ -27,12 +27,14 @@ export const createRunProfile = (
27
27
  token: CancellationToken
28
28
  ) => Thenable<void> | void,
29
29
  isDefault?: boolean,
30
- tag?: theia.TestTag
30
+ tag?: theia.TestTag,
31
+ supportsContinuousRun?: boolean
31
32
  ) => ({
32
33
  label,
33
34
  kind,
34
35
  isDefault: isDefault ?? false,
35
36
  tag,
37
+ supportsContinuousRun: supportsContinuousRun ?? false,
36
38
  runHandler,
37
39
  configureHandler: undefined,
38
40
  dispose: () => undefined,
@@ -835,10 +835,12 @@ export function fromTask(task: theia.Task): TaskDto | undefined {
835
835
  if ('detail' in task) {
836
836
  taskDto.detail = task.detail;
837
837
  }
838
- if (typeof task.scope === 'object') {
839
- taskDto.scope = task.scope.uri.toString();
840
- } else if (typeof task.scope === 'number') {
838
+ if (typeof task.scope === 'number') {
841
839
  taskDto.scope = task.scope;
840
+ } else if (task.scope !== undefined) {
841
+ taskDto.scope = task.scope.uri.toString();
842
+ } else {
843
+ taskDto.scope = types.TaskScope.Workspace;
842
844
  }
843
845
 
844
846
  if (task.presentationOptions) {
@@ -1995,6 +1995,11 @@ export class DocumentSymbol {
1995
1995
  }
1996
1996
  }
1997
1997
 
1998
+ export enum CommentThreadState {
1999
+ Unresolved = 0,
2000
+ Resolved = 1
2001
+ }
2002
+
1998
2003
  export enum CommentThreadCollapsibleState {
1999
2004
  Collapsed = 0,
2000
2005
  Expanded = 1
@@ -2734,13 +2739,12 @@ export namespace DebugAdapterInlineImplementation {
2734
2739
  export type DebugAdapterDescriptor = DebugAdapterExecutable | DebugAdapterServer | DebugAdapterNamedPipeServer | DebugAdapterInlineImplementation;
2735
2740
 
2736
2741
  export enum LogLevel {
2742
+ Off = 0,
2737
2743
  Trace = 1,
2738
2744
  Debug = 2,
2739
2745
  Info = 3,
2740
2746
  Warning = 4,
2741
- Error = 5,
2742
- Critical = 6,
2743
- Off = 7
2747
+ Error = 5
2744
2748
  }
2745
2749
 
2746
2750
  /**
@@ -3111,6 +3115,7 @@ export class TestRunRequest implements theia.TestRunRequest {
3111
3115
  public readonly include: theia.TestItem[] | undefined = undefined,
3112
3116
  public readonly exclude: theia.TestItem[] | undefined = undefined,
3113
3117
  public readonly profile: theia.TestRunProfile | undefined = undefined,
3118
+ public readonly continuous: boolean | undefined = undefined,
3114
3119
  ) { }
3115
3120
  }
3116
3121