@theia/plugin-ext 1.26.0-next.4 → 1.26.0-next.41

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 (163) hide show
  1. package/lib/common/connection.d.ts +9 -6
  2. package/lib/common/connection.d.ts.map +1 -1
  3. package/lib/common/connection.js +19 -10
  4. package/lib/common/connection.js.map +1 -1
  5. package/lib/common/paths-util.js +1 -1
  6. package/lib/common/paths-util.js.map +1 -1
  7. package/lib/common/plugin-api-rpc-model.d.ts +12 -12
  8. package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
  9. package/lib/common/plugin-api-rpc-model.js +3 -1
  10. package/lib/common/plugin-api-rpc-model.js.map +1 -1
  11. package/lib/common/plugin-api-rpc.d.ts +24 -5
  12. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  13. package/lib/common/plugin-api-rpc.js +2 -1
  14. package/lib/common/plugin-api-rpc.js.map +1 -1
  15. package/lib/common/plugin-protocol.d.ts +1 -0
  16. package/lib/common/plugin-protocol.d.ts.map +1 -1
  17. package/lib/common/plugin-protocol.js.map +1 -1
  18. package/lib/hosted/browser/worker/worker-main.js +4 -2
  19. package/lib/hosted/browser/worker/worker-main.js.map +1 -1
  20. package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts.map +1 -1
  21. package/lib/hosted/node/hosted-plugin-deployer-handler.js +2 -0
  22. package/lib/hosted/node/hosted-plugin-deployer-handler.js.map +1 -1
  23. package/lib/hosted/node/plugin-host-rpc.d.ts.map +1 -1
  24. package/lib/hosted/node/plugin-host-rpc.js +4 -2
  25. package/lib/hosted/node/plugin-host-rpc.js.map +1 -1
  26. package/lib/main/browser/debug/debug-main.d.ts +1 -0
  27. package/lib/main/browser/debug/debug-main.d.ts.map +1 -1
  28. package/lib/main/browser/debug/debug-main.js +3 -1
  29. package/lib/main/browser/debug/debug-main.js.map +1 -1
  30. package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts +1 -1
  31. package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts.map +1 -1
  32. package/lib/main/browser/debug/plugin-debug-adapter-contribution.js +2 -2
  33. package/lib/main/browser/debug/plugin-debug-adapter-contribution.js.map +1 -1
  34. package/lib/main/browser/debug/plugin-debug-service.d.ts +1 -1
  35. package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
  36. package/lib/main/browser/debug/plugin-debug-service.js +3 -3
  37. package/lib/main/browser/debug/plugin-debug-service.js.map +1 -1
  38. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts +6 -3
  39. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
  40. package/lib/main/browser/debug/plugin-debug-session-factory.js +6 -4
  41. package/lib/main/browser/debug/plugin-debug-session-factory.js.map +1 -1
  42. package/lib/main/browser/documents-main.d.ts.map +1 -1
  43. package/lib/main/browser/documents-main.js +2 -0
  44. package/lib/main/browser/documents-main.js.map +1 -1
  45. package/lib/main/browser/languages-main.d.ts +8 -2
  46. package/lib/main/browser/languages-main.d.ts.map +1 -1
  47. package/lib/main/browser/languages-main.js +36 -0
  48. package/lib/main/browser/languages-main.js.map +1 -1
  49. package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
  50. package/lib/main/browser/plugin-ext-frontend-module.js +0 -3
  51. package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
  52. package/lib/main/browser/status-bar-message-registry-main.d.ts +2 -1
  53. package/lib/main/browser/status-bar-message-registry-main.d.ts.map +1 -1
  54. package/lib/main/browser/status-bar-message-registry-main.js.map +1 -1
  55. package/lib/main/browser/terminal-main.js +1 -1
  56. package/lib/main/browser/terminal-main.js.map +1 -1
  57. package/lib/main/browser/view/tree-view-widget.js +2 -2
  58. package/lib/main/browser/view/tree-view-widget.js.map +1 -1
  59. package/lib/plugin/comments.js +1 -1
  60. package/lib/plugin/comments.js.map +1 -1
  61. package/lib/plugin/documents.d.ts.map +1 -1
  62. package/lib/plugin/documents.js +3 -1
  63. package/lib/plugin/documents.js.map +1 -1
  64. package/lib/plugin/file-system-event-service-ext-impl.d.ts +1 -1
  65. package/lib/plugin/file-system-event-service-ext-impl.d.ts.map +1 -1
  66. package/lib/plugin/file-system-event-service-ext-impl.js +1 -1
  67. package/lib/plugin/file-system-event-service-ext-impl.js.map +1 -1
  68. package/lib/plugin/languages/linked-editing-range.d.ts +12 -0
  69. package/lib/plugin/languages/linked-editing-range.d.ts.map +1 -0
  70. package/lib/plugin/languages/linked-editing-range.js +41 -0
  71. package/lib/plugin/languages/linked-editing-range.js.map +1 -0
  72. package/lib/plugin/languages-utils.d.ts +6 -0
  73. package/lib/plugin/languages-utils.d.ts.map +1 -0
  74. package/lib/plugin/languages-utils.js +52 -0
  75. package/lib/plugin/languages-utils.js.map +1 -0
  76. package/lib/plugin/languages.d.ts +7 -2
  77. package/lib/plugin/languages.d.ts.map +1 -1
  78. package/lib/plugin/languages.js +132 -33
  79. package/lib/plugin/languages.js.map +1 -1
  80. package/lib/plugin/markdown-string.d.ts +23 -9
  81. package/lib/plugin/markdown-string.d.ts.map +1 -1
  82. package/lib/plugin/markdown-string.js +97 -26
  83. package/lib/plugin/markdown-string.js.map +1 -1
  84. package/lib/plugin/node/debug/debug.d.ts +1 -1
  85. package/lib/plugin/node/debug/debug.d.ts.map +1 -1
  86. package/lib/plugin/node/debug/debug.js +2 -1
  87. package/lib/plugin/node/debug/debug.js.map +1 -1
  88. package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts +2 -1
  89. package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts.map +1 -1
  90. package/lib/plugin/node/debug/plugin-debug-adapter-session.js +1 -0
  91. package/lib/plugin/node/debug/plugin-debug-adapter-session.js.map +1 -1
  92. package/lib/plugin/plugin-context.d.ts.map +1 -1
  93. package/lib/plugin/plugin-context.js +11 -2
  94. package/lib/plugin/plugin-context.js.map +1 -1
  95. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  96. package/lib/plugin/plugin-manager.js +3 -1
  97. package/lib/plugin/plugin-manager.js.map +1 -1
  98. package/lib/plugin/prefix-sum-computer.d.ts +1 -1
  99. package/lib/plugin/prefix-sum-computer.d.ts.map +1 -1
  100. package/lib/plugin/prefix-sum-computer.js +8 -8
  101. package/lib/plugin/prefix-sum-computer.js.map +1 -1
  102. package/lib/plugin/scm.js +1 -1
  103. package/lib/plugin/scm.js.map +1 -1
  104. package/lib/plugin/status-bar/status-bar-item.d.ts +2 -2
  105. package/lib/plugin/status-bar/status-bar-item.d.ts.map +1 -1
  106. package/lib/plugin/status-bar/status-bar-item.js.map +1 -1
  107. package/lib/plugin/terminal-ext.d.ts +2 -1
  108. package/lib/plugin/terminal-ext.d.ts.map +1 -1
  109. package/lib/plugin/terminal-ext.js +2 -1
  110. package/lib/plugin/terminal-ext.js.map +1 -1
  111. package/lib/plugin/theming.d.ts +1 -1
  112. package/lib/plugin/theming.js +3 -3
  113. package/lib/plugin/type-converters.d.ts +6 -5
  114. package/lib/plugin/type-converters.d.ts.map +1 -1
  115. package/lib/plugin/type-converters.js +12 -6
  116. package/lib/plugin/type-converters.js.map +1 -1
  117. package/lib/plugin/type-converters.spec.js +16 -15
  118. package/lib/plugin/type-converters.spec.js.map +1 -1
  119. package/lib/plugin/types-impl.d.ts +21 -8
  120. package/lib/plugin/types-impl.d.ts.map +1 -1
  121. package/lib/plugin/types-impl.js +25 -7
  122. package/lib/plugin/types-impl.js.map +1 -1
  123. package/lib/plugin/workspace.js +1 -1
  124. package/lib/plugin/workspace.js.map +1 -1
  125. package/package.json +23 -23
  126. package/src/common/connection.ts +28 -16
  127. package/src/common/paths-util.ts +1 -1
  128. package/src/common/plugin-api-rpc-model.ts +13 -12
  129. package/src/common/plugin-api-rpc.ts +30 -6
  130. package/src/common/plugin-protocol.ts +1 -0
  131. package/src/hosted/browser/worker/worker-main.ts +4 -2
  132. package/src/hosted/node/hosted-plugin-deployer-handler.ts +1 -0
  133. package/src/hosted/node/plugin-host-rpc.ts +4 -2
  134. package/src/main/browser/debug/debug-main.ts +5 -1
  135. package/src/main/browser/debug/plugin-debug-adapter-contribution.ts +2 -2
  136. package/src/main/browser/debug/plugin-debug-service.ts +3 -3
  137. package/src/main/browser/debug/plugin-debug-session-factory.ts +10 -5
  138. package/src/main/browser/documents-main.ts +2 -0
  139. package/src/main/browser/languages-main.ts +43 -2
  140. package/src/main/browser/plugin-ext-frontend-module.ts +0 -4
  141. package/src/main/browser/status-bar-message-registry-main.ts +2 -1
  142. package/src/main/browser/terminal-main.ts +1 -1
  143. package/src/main/browser/view/tree-view-widget.tsx +2 -2
  144. package/src/plugin/comments.ts +1 -1
  145. package/src/plugin/documents.ts +9 -8
  146. package/src/plugin/file-system-event-service-ext-impl.ts +1 -1
  147. package/src/plugin/languages/linked-editing-range.ts +48 -0
  148. package/src/plugin/languages-utils.ts +55 -0
  149. package/src/plugin/languages.ts +139 -40
  150. package/src/plugin/markdown-string.ts +83 -26
  151. package/src/plugin/node/debug/debug.ts +2 -1
  152. package/src/plugin/node/debug/plugin-debug-adapter-session.ts +3 -1
  153. package/src/plugin/plugin-context.ts +15 -3
  154. package/src/plugin/plugin-manager.ts +3 -1
  155. package/src/plugin/prefix-sum-computer.ts +8 -8
  156. package/src/plugin/scm.ts +1 -1
  157. package/src/plugin/status-bar/status-bar-item.ts +3 -3
  158. package/src/plugin/terminal-ext.ts +5 -2
  159. package/src/plugin/theming.ts +4 -4
  160. package/src/plugin/type-converters.spec.ts +20 -17
  161. package/src/plugin/type-converters.ts +17 -12
  162. package/src/plugin/types-impl.ts +31 -11
  163. package/src/plugin/workspace.ts +1 -1
@@ -27,7 +27,8 @@ import {
27
27
  EndOfLine,
28
28
  OverviewRulerLane,
29
29
  IndentAction,
30
- FileOperationOptions
30
+ FileOperationOptions,
31
+ TextDocumentChangeReason,
31
32
  } from '../plugin/types-impl';
32
33
  import { UriComponents } from './uri-components';
33
34
  import {
@@ -71,7 +72,8 @@ import {
71
72
  CommentThreadCollapsibleState,
72
73
  CommentThread,
73
74
  CommentThreadChangedEvent,
74
- CodeActionProviderDocumentation
75
+ CodeActionProviderDocumentation,
76
+ LinkedEditingRanges
75
77
  } from './plugin-api-rpc-model';
76
78
  import { ExtPluginApi } from './plugin-ext-api-contribution';
77
79
  import { KeysToAnyValues, KeysToKeysToAnyValue } from './types';
@@ -99,6 +101,7 @@ import { ThemeType } from '@theia/core/lib/common/theme';
99
101
  import { Disposable } from '@theia/core/lib/common/disposable';
100
102
  // eslint-disable-next-line @theia/runtime-import-check
101
103
  import { PickOptions, QuickInputButtonHandle, QuickPickItem, WidgetOpenerOptions } from '@theia/core/lib/browser';
104
+ import { Severity } from '@theia/core/lib/common/severity';
102
105
 
103
106
  export interface PreferenceData {
104
107
  [scope: number]: any;
@@ -111,6 +114,7 @@ export interface Plugin {
111
114
  model: PluginModel;
112
115
  rawModel: PluginPackage;
113
116
  lifecycle: PluginLifecycle;
117
+ isUnderDevelopment: boolean;
114
118
  }
115
119
 
116
120
  export interface ConfigStorage {
@@ -194,7 +198,8 @@ export const emptyPlugin: Plugin = {
194
198
  version: 'empty'
195
199
  },
196
200
  packagePath: 'empty'
197
- }
201
+ },
202
+ isUnderDevelopment: false
198
203
  };
199
204
 
200
205
  export interface PluginManagerInitializeParams {
@@ -255,7 +260,7 @@ export interface TerminalServiceExt {
255
260
  $terminalCreated(id: string, name: string): void;
256
261
  $terminalNameChanged(id: string, name: string): void;
257
262
  $terminalOpened(id: string, processId: number, terminalId: number, cols: number, rows: number): void;
258
- $terminalClosed(id: string): void;
263
+ $terminalClosed(id: string, exitStatus: theia.TerminalExitStatus | undefined): void;
259
264
  $terminalOnInput(id: string, data: string): void;
260
265
  $terminalSizeChanged(id: string, cols: number, rows: number): void;
261
266
  $currentTerminalChanged(id: string | undefined): void;
@@ -408,7 +413,7 @@ export interface StatusBarMessageRegistryMain {
408
413
  alignment: theia.StatusBarAlignment,
409
414
  color: string | undefined,
410
415
  backgroundColor: string | undefined,
411
- tooltip: string | undefined,
416
+ tooltip: string | theia.MarkdownString | undefined,
412
417
  command: string | undefined,
413
418
  accessibilityInformation: theia.AccessibilityInformation,
414
419
  args: any[] | undefined): PromiseLike<void>;
@@ -1221,6 +1226,8 @@ export interface ModelChangedEvent {
1221
1226
  readonly eol: string;
1222
1227
 
1223
1228
  readonly versionId: number;
1229
+
1230
+ readonly reason: TextDocumentChangeReason | undefined;
1224
1231
  }
1225
1232
 
1226
1233
  export interface DocumentsExt {
@@ -1420,6 +1427,19 @@ export interface PluginInfo {
1420
1427
  displayName?: string;
1421
1428
  }
1422
1429
 
1430
+ export interface LanguageStatus {
1431
+ readonly id: string;
1432
+ readonly name: string;
1433
+ readonly selector: SerializedDocumentFilter[];
1434
+ readonly severity: Severity;
1435
+ readonly label: string;
1436
+ readonly detail: string;
1437
+ readonly busy: boolean;
1438
+ readonly source: string;
1439
+ readonly command: Command | undefined;
1440
+ readonly accessibilityInfo: theia.AccessibilityInformation | undefined;
1441
+ }
1442
+
1423
1443
  export interface LanguagesExt {
1424
1444
  $provideCompletionItems(handle: number, resource: UriComponents, position: Position,
1425
1445
  context: CompletionContext, token: CancellationToken): Promise<CompletionResultDto | undefined>;
@@ -1483,6 +1503,7 @@ export interface LanguagesExt {
1483
1503
  $provideRootDefinition(handle: number, resource: UriComponents, location: Position, token: CancellationToken): Promise<CallHierarchyItem[] | undefined>;
1484
1504
  $provideCallers(handle: number, definition: CallHierarchyItem, token: CancellationToken): Promise<CallHierarchyIncomingCall[] | undefined>;
1485
1505
  $provideCallees(handle: number, definition: CallHierarchyItem, token: CancellationToken): Promise<CallHierarchyOutgoingCall[] | undefined>;
1506
+ $provideLinkedEditingRanges(handle: number, resource: UriComponents, position: Position, token: CancellationToken): Promise<LinkedEditingRanges | undefined>;
1486
1507
  $releaseCallHierarchy(handle: number, session?: string): Promise<boolean>;
1487
1508
  }
1488
1509
 
@@ -1531,6 +1552,9 @@ export interface LanguagesMain {
1531
1552
  $emitDocumentSemanticTokensEvent(eventHandle: number): void;
1532
1553
  $registerDocumentRangeSemanticTokensProvider(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[], legend: theia.SemanticTokensLegend): void;
1533
1554
  $registerCallHierarchyProvider(handle: number, selector: SerializedDocumentFilter[]): void;
1555
+ $registerLinkedEditingRangeProvider(handle: number, selector: SerializedDocumentFilter[]): void;
1556
+ $setLanguageStatus(handle: number, status: LanguageStatus): void;
1557
+ $removeLanguageStatus(handle: number): void;
1534
1558
  }
1535
1559
 
1536
1560
  export interface WebviewInitData {
@@ -1701,7 +1725,7 @@ export interface DebugExt {
1701
1725
  debugConfiguration: theia.DebugConfiguration
1702
1726
  ): Promise<theia.DebugConfiguration | undefined | null>;
1703
1727
 
1704
- $createDebugSession(debugConfiguration: theia.DebugConfiguration): Promise<string>;
1728
+ $createDebugSession(debugConfiguration: theia.DebugConfiguration, workspaceFolder: string | undefined): Promise<string>;
1705
1729
  $terminateDebugSession(sessionId: string): Promise<void>;
1706
1730
  $getTerminalCreationOptions(debugType: string): Promise<TerminalOptionsExt | undefined>;
1707
1731
  }
@@ -795,6 +795,7 @@ export interface PluginMetadata {
795
795
  host: string;
796
796
  model: PluginModel;
797
797
  lifecycle: PluginLifecycle;
798
+ isUnderDevelopment?: boolean;
798
799
  }
799
800
 
800
801
  export const MetadataProcessor = Symbol('MetadataProcessor');
@@ -129,7 +129,8 @@ const pluginManager = new PluginManagerExtImpl({
129
129
  pluginUri: pluginModel.packageUri,
130
130
  model: pluginModel,
131
131
  lifecycle: pluginLifecycle,
132
- rawModel
132
+ rawModel,
133
+ isUnderDevelopment: !!plg.isUnderDevelopment
133
134
  };
134
135
  const apiImpl = apiFactory(plugin);
135
136
  pluginsApiImpl.set(plugin.model.id, apiImpl);
@@ -146,7 +147,8 @@ const pluginManager = new PluginManagerExtImpl({
146
147
  lifecycle: pluginLifecycle,
147
148
  get rawModel(): never {
148
149
  throw new Error('not supported');
149
- }
150
+ },
151
+ isUnderDevelopment: !!plg.isUnderDevelopment
150
152
  }
151
153
  };
152
154
  }
@@ -131,6 +131,7 @@ export class HostedPluginDeployerHandler implements PluginDeployerHandler {
131
131
  }
132
132
 
133
133
  const metadata = this.reader.readMetadata(manifest);
134
+ metadata.isUnderDevelopment = entry.getValue('isUnderDevelopment') ?? false;
134
135
 
135
136
  const deployedLocations = this.deployedLocations.get(metadata.model.id) || new Set<string>();
136
137
  deployedLocations.add(entry.rootPath);
@@ -167,7 +167,8 @@ export class PluginHostRPC {
167
167
  pluginUri: pluginModel.packageUri,
168
168
  model: pluginModel,
169
169
  lifecycle: pluginLifecycle,
170
- rawModel
170
+ rawModel,
171
+ isUnderDevelopment: !!plg.isUnderDevelopment
171
172
  });
172
173
  } else {
173
174
  let backendInitPath = pluginLifecycle.backendInitPath;
@@ -182,7 +183,8 @@ export class PluginHostRPC {
182
183
  pluginUri: pluginModel.packageUri,
183
184
  model: pluginModel,
184
185
  lifecycle: pluginLifecycle,
185
- rawModel
186
+ rawModel,
187
+ isUnderDevelopment: !!plg.isUnderDevelopment
186
188
  };
187
189
 
188
190
  self.initContext(backendInitPath, plugin);
@@ -54,6 +54,7 @@ import { DebugConsoleSession } from '@theia/debug/lib/browser/console/debug-cons
54
54
  import { ContributionProvider } from '@theia/core/lib/common';
55
55
  import { DebugContribution } from '@theia/debug/lib/browser/debug-contribution';
56
56
  import { ConnectionImpl } from '../../../common/connection';
57
+ import { WorkspaceService } from '@theia/workspace/lib/browser';
57
58
 
58
59
  export class DebugMainImpl implements DebugMain, Disposable {
59
60
  private readonly debugExt: DebugExt;
@@ -73,6 +74,7 @@ export class DebugMainImpl implements DebugMain, Disposable {
73
74
  private readonly fileService: FileService;
74
75
  private readonly pluginService: HostedPluginSupport;
75
76
  private readonly debugContributionProvider: ContributionProvider<DebugContribution>;
77
+ private readonly workspaceService: WorkspaceService;
76
78
 
77
79
  private readonly debuggerContributions = new Map<string, DisposableCollection>();
78
80
  private readonly configurationProviders = new Map<number, DisposableCollection>();
@@ -95,6 +97,7 @@ export class DebugMainImpl implements DebugMain, Disposable {
95
97
  this.debugContributionProvider = container.getNamed(ContributionProvider, DebugContribution);
96
98
  this.fileService = container.get(FileService);
97
99
  this.pluginService = container.get(HostedPluginSupport);
100
+ this.workspaceService = container.get(WorkspaceService);
98
101
 
99
102
  const fireDidChangeBreakpoints = ({ added, removed, changed }: BreakpointsChangeEvent<SourceBreakpoint | FunctionBreakpoint>) => {
100
103
  this.debugExt.$breakpointsDidChange(
@@ -155,7 +158,8 @@ export class DebugMainImpl implements DebugMain, Disposable {
155
158
  },
156
159
  this.fileService,
157
160
  terminalOptionsExt,
158
- this.debugContributionProvider
161
+ this.debugContributionProvider,
162
+ this.workspaceService,
159
163
  );
160
164
 
161
165
  const toDispose = new DisposableCollection(
@@ -37,9 +37,9 @@ export class PluginDebugAdapterContribution {
37
37
  return this.description.label;
38
38
  }
39
39
 
40
- async createDebugSession(config: DebugConfiguration): Promise<string> {
40
+ async createDebugSession(config: DebugConfiguration, workspaceFolder: string | undefined): Promise<string> {
41
41
  await this.pluginService.activateByDebug('onDebugAdapterProtocolTracker', config.type);
42
- return this.debugExt.$createDebugSession(config);
42
+ return this.debugExt.$createDebugSession(config, workspaceFolder);
43
43
  }
44
44
 
45
45
  async terminateDebugSession(sessionId: string): Promise<void> {
@@ -264,14 +264,14 @@ export class PluginDebugService implements DebugService {
264
264
  return snippets;
265
265
  }
266
266
 
267
- async createDebugSession(config: DebugConfiguration): Promise<string> {
267
+ async createDebugSession(config: DebugConfiguration, workspaceFolder: string | undefined): Promise<string> {
268
268
  const contributor = this.contributors.get(config.type);
269
269
  if (contributor) {
270
- const sessionId = await contributor.createDebugSession(config);
270
+ const sessionId = await contributor.createDebugSession(config, workspaceFolder);
271
271
  this.sessionId2contrib.set(sessionId, contributor);
272
272
  return sessionId;
273
273
  } else {
274
- return this.delegated.createDebugSession(config);
274
+ return this.delegated.createDebugSession(config, workspaceFolder);
275
275
  }
276
276
  }
277
277
 
@@ -30,7 +30,8 @@ import { TerminalOptionsExt } from '../../../common/plugin-api-rpc';
30
30
  import { FileService } from '@theia/filesystem/lib/browser/file-service';
31
31
  import { DebugContribution } from '@theia/debug/lib/browser/debug-contribution';
32
32
  import { ContributionProvider } from '@theia/core/lib/common/contribution-provider';
33
- import { Channel } from '@theia/debug/lib/common/debug-service';
33
+ import { Channel } from '@theia/core/lib/common/message-rpc/channel';
34
+ import { WorkspaceService } from '@theia/workspace/lib/browser';
34
35
 
35
36
  export class PluginDebugSession extends DebugSession {
36
37
  constructor(
@@ -45,8 +46,10 @@ export class PluginDebugSession extends DebugSession {
45
46
  protected override readonly messages: MessageClient,
46
47
  protected override readonly fileService: FileService,
47
48
  protected readonly terminalOptionsExt: TerminalOptionsExt | undefined,
48
- protected override readonly debugContributionProvider: ContributionProvider<DebugContribution>) {
49
- super(id, options, parentSession, connection, terminalServer, editorManager, breakpoints, labelProvider, messages, fileService, debugContributionProvider);
49
+ protected override readonly debugContributionProvider: ContributionProvider<DebugContribution>,
50
+ protected override readonly workspaceService: WorkspaceService) {
51
+ super(id, options, parentSession, connection, terminalServer, editorManager, breakpoints, labelProvider, messages, fileService, debugContributionProvider,
52
+ workspaceService);
50
53
  }
51
54
 
52
55
  protected override async doCreateTerminal(terminalWidgetOptions: TerminalWidgetOptions): Promise<TerminalWidget> {
@@ -71,7 +74,8 @@ export class PluginDebugSessionFactory extends DefaultDebugSessionFactory {
71
74
  protected readonly connectionFactory: (sessionId: string) => Promise<Channel>,
72
75
  protected override readonly fileService: FileService,
73
76
  protected readonly terminalOptionsExt: TerminalOptionsExt | undefined,
74
- protected override readonly debugContributionProvider: ContributionProvider<DebugContribution>
77
+ protected override readonly debugContributionProvider: ContributionProvider<DebugContribution>,
78
+ protected override readonly workspaceService: WorkspaceService,
75
79
  ) {
76
80
  super();
77
81
  }
@@ -94,7 +98,8 @@ export class PluginDebugSessionFactory extends DefaultDebugSessionFactory {
94
98
  this.messages,
95
99
  this.fileService,
96
100
  this.terminalOptionsExt,
97
- this.debugContributionProvider
101
+ this.debugContributionProvider,
102
+ this.workspaceService,
98
103
  );
99
104
  }
100
105
  }
@@ -32,6 +32,7 @@ import { Reference } from '@theia/core/lib/common/reference';
32
32
  import { dispose } from '../../common/disposable-util';
33
33
  import { MonacoLanguages } from '@theia/monaco/lib/browser/monaco-languages';
34
34
  import * as monaco from '@theia/monaco-editor-core';
35
+ import { TextDocumentChangeReason } from '../../plugin/types-impl';
35
36
 
36
37
  /*---------------------------------------------------------------------------------------------
37
38
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -157,6 +158,7 @@ export class DocumentsMainImpl implements DocumentsMain, Disposable {
157
158
  this.proxy.$acceptModelChanged(modelUri, {
158
159
  eol: e.eol,
159
160
  versionId: e.versionId,
161
+ reason: e.isRedoing ? TextDocumentChangeReason.Redo : e.isUndoing ? TextDocumentChangeReason.Undo : undefined,
160
162
  changes: e.changes.map(c =>
161
163
  ({
162
164
  text: c.text,
@@ -32,7 +32,8 @@ import {
32
32
  LanguagesExt,
33
33
  WorkspaceEditDto,
34
34
  WorkspaceTextEditDto,
35
- PluginInfo
35
+ PluginInfo,
36
+ LanguageStatus as LanguageStatusDTO
36
37
  } from '../../common/plugin-api-rpc';
37
38
  import { injectable, inject } from '@theia/core/shared/inversify';
38
39
  import {
@@ -49,7 +50,6 @@ import * as vst from '@theia/core/shared/vscode-languageserver-protocol';
49
50
  import * as theia from '@theia/plugin';
50
51
  import { UriComponents } from '../../common/uri-components';
51
52
  import { CancellationToken } from '@theia/core/lib/common';
52
- import { LanguageSelector, RelativePattern } from '@theia/callhierarchy/lib/common/language-selector';
53
53
  import { CallHierarchyService, CallHierarchyServiceProvider, CallHierarchyItem } from '@theia/callhierarchy/lib/browser';
54
54
  import { toDefinition, toUriComponents, fromDefinition, fromPosition, toCaller, toCallee } from './callhierarchy/callhierarchy-type-converters';
55
55
  import { Position, DocumentUri, DiagnosticTag } from '@theia/core/shared/vscode-languageserver-protocol';
@@ -64,6 +64,8 @@ import { IMarkerService } from '@theia/monaco-editor-core/esm/vs/platform/marker
64
64
  import * as MonacoLanguageSelector from '@theia/monaco-editor-core/esm/vs/editor/common/languageSelector';
65
65
  import * as MonacoPath from '@theia/monaco-editor-core/esm/vs/base/common/path';
66
66
  import { IRelativePattern } from '@theia/monaco-editor-core/esm/vs/base/common/glob';
67
+ import { EditorLanguageStatusService, LanguageStatus as EditorLanguageStatus } from '@theia/editor/lib/browser/language-status/editor-language-status-service';
68
+ import { LanguageSelector, RelativePattern } from '@theia/editor/lib/common/language-selector';
67
69
 
68
70
  interface RegistrationFunction<T> {
69
71
  (languageId: MonacoLanguageSelector.LanguageSelector, service: T): Disposable;
@@ -81,6 +83,9 @@ export class LanguagesMainImpl implements LanguagesMain, Disposable {
81
83
  @inject(CallHierarchyServiceProvider)
82
84
  private readonly callHierarchyServiceContributionRegistry: CallHierarchyServiceProvider;
83
85
 
86
+ @inject(EditorLanguageStatusService)
87
+ protected readonly languageStatusService: EditorLanguageStatusService;
88
+
84
89
  private readonly proxy: LanguagesExt;
85
90
  private readonly services = new Map<number, Disposable>();
86
91
  private readonly toDispose = new DisposableCollection();
@@ -948,6 +953,42 @@ export class LanguagesMainImpl implements LanguagesMain, Disposable {
948
953
  });
949
954
  }
950
955
 
956
+ // --- linked editing range
957
+
958
+ $registerLinkedEditingRangeProvider(handle: number, selector: SerializedDocumentFilter[]): void {
959
+ const languageSelector = this.toLanguageSelector(selector);
960
+ const linkedEditingRangeProvider = this.createLinkedEditingRangeProvider(handle);
961
+ this.register(handle,
962
+ (monaco.languages.registerLinkedEditingRangeProvider as RegistrationFunction<monaco.languages.LinkedEditingRangeProvider>)(languageSelector, linkedEditingRangeProvider)
963
+ );
964
+ }
965
+
966
+ protected createLinkedEditingRangeProvider(handle: number): monaco.languages.LinkedEditingRangeProvider {
967
+ return {
968
+ provideLinkedEditingRanges: async (model: monaco.editor.ITextModel, position: monaco.Position, token: CancellationToken):
969
+ Promise<monaco.languages.LinkedEditingRanges | undefined> => {
970
+ const res = await this.proxy.$provideLinkedEditingRanges(handle, model.uri, position, token);
971
+ if (res) {
972
+ return {
973
+ ranges: res.ranges,
974
+ wordPattern: reviveRegExp(res.wordPattern)
975
+ };
976
+ }
977
+ return undefined;
978
+ }
979
+ };
980
+ };
981
+
982
+ // -- Language status
983
+
984
+ $setLanguageStatus(handle: number, status: LanguageStatusDTO): void {
985
+ const internal: EditorLanguageStatus = { ...status, selector: this.toLanguageSelector(status.selector) };
986
+ this.languageStatusService.setLanguageStatusItem(handle, internal);
987
+ };
988
+
989
+ $removeLanguageStatus(handle: number): void {
990
+ this.languageStatusService.removeLanguageStatusItem(handle);
991
+ };
951
992
  }
952
993
 
953
994
  function reviveMarker(marker: MarkerData): vst.Diagnostic {
@@ -35,7 +35,6 @@ import { PluginWidget } from './plugin-ext-widget';
35
35
  import { PluginFrontendViewContribution } from './plugin-frontend-view-contribution';
36
36
  import { PluginExtDeployCommandService } from './plugin-ext-deploy-command';
37
37
  import { EditorModelService } from './text-editor-model-service';
38
- import { UntitledResourceResolver } from './editor/untitled-resource';
39
38
  import { CodeEditorWidgetUtil, MenusContributionPointHandler } from './menus/menus-contribution-handler';
40
39
  import { PluginContributionHandler } from './plugin-contribution-handler';
41
40
  import { PluginViewRegistry, PLUGIN_VIEW_CONTAINER_FACTORY_ID, PLUGIN_VIEW_FACTORY_ID, PLUGIN_VIEW_DATA_FACTORY_ID } from './view/plugin-view-registry';
@@ -108,9 +107,6 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
108
107
 
109
108
  bind(EditorModelService).toSelf().inSingletonScope();
110
109
 
111
- bind(UntitledResourceResolver).toSelf().inSingletonScope();
112
- bind(ResourceResolver).toService(UntitledResourceResolver);
113
-
114
110
  bind(FrontendApplicationContribution).toDynamicValue(ctx => ({
115
111
  onStart(): MaybePromise<void> {
116
112
  ctx.container.get(HostedPluginSupport).onStart(ctx.container);
@@ -19,6 +19,7 @@ import * as types from '../../plugin/types-impl';
19
19
  import { StatusBarMessageRegistryMain } from '../../common/plugin-api-rpc';
20
20
  import { StatusBar, StatusBarAlignment, StatusBarEntry } from '@theia/core/lib/browser/status-bar/status-bar';
21
21
  import { ColorRegistry } from '@theia/core/lib/browser/color-registry';
22
+ import { MarkdownString } from '@theia/core/lib/common/markdown-rendering';
22
23
 
23
24
  export class StatusBarMessageRegistryMainImpl implements StatusBarMessageRegistryMain, Disposable {
24
25
  private readonly delegate: StatusBar;
@@ -45,7 +46,7 @@ export class StatusBarMessageRegistryMainImpl implements StatusBarMessageRegistr
45
46
  alignment: number,
46
47
  color: string | undefined,
47
48
  backgroundColor: string | undefined,
48
- tooltip: string | undefined,
49
+ tooltip: string | MarkdownString | undefined,
49
50
  command: string | undefined,
50
51
  accessibilityInformation: types.AccessibilityInformation,
51
52
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -90,7 +90,7 @@ export class TerminalServiceMainImpl implements TerminalServiceMain, Disposable
90
90
  );
91
91
  updateProcessId();
92
92
  this.toDispose.push(terminal.onDidOpen(() => updateProcessId()));
93
- this.toDispose.push(terminal.onTerminalDidClose(() => this.extProxy.$terminalClosed(terminal.id)));
93
+ this.toDispose.push(terminal.onTerminalDidClose(term => this.extProxy.$terminalClosed(term.id, term.exitStatus)));
94
94
  this.toDispose.push(terminal.onSizeChanged(({ cols, rows }) => {
95
95
  this.extProxy.$terminalSizeChanged(terminal.id, cols, rows);
96
96
  }));
@@ -43,7 +43,7 @@ import { View } from '../../../common/plugin-protocol';
43
43
  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
- import { isMarkdownString } from '../../../plugin/markdown-string';
46
+ import { MarkdownString } from '@theia/core/lib/common/markdown-rendering';
47
47
  import { LabelParser } from '@theia/core/lib/browser/label-parser';
48
48
  import { AccessibilityInformation } from '@theia/plugin';
49
49
 
@@ -312,7 +312,7 @@ export class TreeViewWidget extends TreeViewWelcomeWidget {
312
312
  };
313
313
  }
314
314
 
315
- if (node.tooltip && isMarkdownString(node.tooltip)) {
315
+ if (node.tooltip && MarkdownString.is(node.tooltip)) {
316
316
  // Render markdown in custom tooltip
317
317
  const tooltip = this.markdownIt.render(node.tooltip.value);
318
318
 
@@ -352,7 +352,7 @@ export class ExtHostCommentThread implements theia.CommentThread, theia.Disposab
352
352
  }
353
353
  if (modified('comments')) {
354
354
  formattedModifications.comments =
355
- this._comments.map(cmt => convertToModeComment(this, this.commentController, cmt, this.commentsMap));
355
+ this._comments.map(comment => convertToModeComment(this, this.commentController, comment, this.commentsMap));
356
356
  }
357
357
  if (modified('collapsibleState')) {
358
358
  formattedModifications.collapseState = convertToCollapsibleState(this.collapseState);
@@ -163,7 +163,8 @@ export class DocumentsExtImpl implements DocumentsExt {
163
163
  data.acceptIsDirty(isDirty);
164
164
  this._onDidChangeDocument.fire({
165
165
  document: data.document,
166
- contentChanges: []
166
+ contentChanges: [],
167
+ reason: undefined,
167
168
  });
168
169
  }
169
170
  $acceptModelChanged(strUrl: UriComponents, e: ModelChangedEvent, isDirty: boolean): void {
@@ -177,13 +178,13 @@ export class DocumentsExtImpl implements DocumentsExt {
177
178
  data.onEvents(e);
178
179
  this._onDidChangeDocument.fire({
179
180
  document: data.document,
180
- contentChanges: e.changes.map(change =>
181
- ({
182
- range: Converter.toRange(change.range),
183
- rangeOffset: change.rangeOffset,
184
- rangeLength: change.rangeLength,
185
- text: change.text
186
- }))
181
+ reason: e.reason,
182
+ contentChanges: e.changes.map(change => ({
183
+ range: Converter.toRange(change.range),
184
+ rangeOffset: change.rangeOffset,
185
+ rangeLength: change.rangeLength,
186
+ text: change.text
187
+ }))
187
188
  });
188
189
  }
189
190
  getAllDocumentData(): DocumentDataExt[] {
@@ -29,7 +29,7 @@
29
29
  /* eslint-disable @typescript-eslint/tslint/config */
30
30
 
31
31
  import { Emitter, WaitUntilEvent, AsyncEmitter } from '@theia/core/lib/common/event';
32
- import { IRelativePattern, parse } from '@theia/callhierarchy/lib/common/glob';
32
+ import { IRelativePattern, parse } from '@theia/core/lib/common/glob';
33
33
  import { UriComponents } from '@theia/core/shared/vscode-uri';
34
34
  import { Disposable, URI, WorkspaceEdit } from './types-impl';
35
35
  import { EditorsAndDocumentsExtImpl as ExtHostDocumentsAndEditors } from './editors-and-documents';
@@ -0,0 +1,48 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2022 Ericsson 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
+ import * as theia from '@theia/plugin';
18
+ import * as rpc from '../../common/plugin-api-rpc';
19
+ import { DocumentsExtImpl } from '../documents';
20
+ import { LinkedEditingRanges } from '../../common/plugin-api-rpc-model';
21
+ import { URI } from '@theia/core/shared/vscode-uri';
22
+ import { coalesce } from '../../common/arrays';
23
+ import { fromRange, toPosition } from '../type-converters';
24
+ import { serializeRegExp } from '../languages-utils';
25
+
26
+ export class LinkedEditingRangeAdapter {
27
+
28
+ constructor(
29
+ private readonly documents: DocumentsExtImpl,
30
+ private readonly provider: theia.LinkedEditingRangeProvider
31
+ ) { }
32
+
33
+ async provideRanges(resource: URI, position: rpc.Position, token: theia.CancellationToken): Promise<LinkedEditingRanges | undefined> {
34
+
35
+ const doc = this.documents.getDocument(resource);
36
+ const pos = toPosition(position);
37
+
38
+ const value = await this.provider.provideLinkedEditingRanges(doc, pos, token);
39
+ if (value && Array.isArray(value.ranges)) {
40
+ return {
41
+ ranges: coalesce(value.ranges.map(r => fromRange(r))),
42
+ wordPattern: serializeRegExp(value.wordPattern)
43
+ };
44
+ }
45
+ return undefined;
46
+ }
47
+
48
+ }
@@ -0,0 +1,55 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2022 Ericsson 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
+ import * as theia from '@theia/plugin';
18
+ import { SerializedIndentationRule, SerializedOnEnterRule, SerializedRegExp } from '../common';
19
+
20
+ export function serializeEnterRules(rules?: theia.OnEnterRule[]): SerializedOnEnterRule[] | undefined {
21
+ if (typeof rules === 'undefined' || rules === null) {
22
+ return undefined;
23
+ }
24
+
25
+ return rules.map(r =>
26
+ ({
27
+ action: r.action,
28
+ beforeText: serializeRegExp(r.beforeText),
29
+ afterText: serializeRegExp(r.afterText)
30
+ } as SerializedOnEnterRule));
31
+ }
32
+
33
+ export function serializeRegExp(regexp?: RegExp): SerializedRegExp | undefined {
34
+ if (typeof regexp === 'undefined' || regexp === null) {
35
+ return undefined;
36
+ }
37
+
38
+ return {
39
+ pattern: regexp.source,
40
+ flags: (regexp.global ? 'g' : '') + (regexp.ignoreCase ? 'i' : '') + (regexp.multiline ? 'm' : '')
41
+ };
42
+ }
43
+
44
+ export function serializeIndentation(indentationRules?: theia.IndentationRule): SerializedIndentationRule | undefined {
45
+ if (typeof indentationRules === 'undefined' || indentationRules === null) {
46
+ return undefined;
47
+ }
48
+
49
+ return {
50
+ increaseIndentPattern: serializeRegExp(indentationRules.increaseIndentPattern),
51
+ decreaseIndentPattern: serializeRegExp(indentationRules.decreaseIndentPattern),
52
+ indentNextLinePattern: serializeRegExp(indentationRules.indentNextLinePattern),
53
+ unIndentedLinePattern: serializeRegExp(indentationRules.unIndentedLinePattern)
54
+ };
55
+ }