@theia/plugin-ext 1.26.0-next.3 → 1.26.0-next.30

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 (115) hide show
  1. package/lib/common/paths-util.js +1 -1
  2. package/lib/common/paths-util.js.map +1 -1
  3. package/lib/common/plugin-api-rpc-model.d.ts +12 -12
  4. package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
  5. package/lib/common/plugin-api-rpc-model.js +3 -1
  6. package/lib/common/plugin-api-rpc-model.js.map +1 -1
  7. package/lib/common/plugin-api-rpc.d.ts +22 -4
  8. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  9. package/lib/common/plugin-api-rpc.js.map +1 -1
  10. package/lib/main/browser/debug/debug-main.d.ts +1 -0
  11. package/lib/main/browser/debug/debug-main.d.ts.map +1 -1
  12. package/lib/main/browser/debug/debug-main.js +3 -1
  13. package/lib/main/browser/debug/debug-main.js.map +1 -1
  14. package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts +1 -1
  15. package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts.map +1 -1
  16. package/lib/main/browser/debug/plugin-debug-adapter-contribution.js +2 -2
  17. package/lib/main/browser/debug/plugin-debug-adapter-contribution.js.map +1 -1
  18. package/lib/main/browser/debug/plugin-debug-service.d.ts +1 -1
  19. package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
  20. package/lib/main/browser/debug/plugin-debug-service.js +3 -3
  21. package/lib/main/browser/debug/plugin-debug-service.js.map +1 -1
  22. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts +5 -2
  23. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
  24. package/lib/main/browser/debug/plugin-debug-session-factory.js +6 -4
  25. package/lib/main/browser/debug/plugin-debug-session-factory.js.map +1 -1
  26. package/lib/main/browser/documents-main.d.ts.map +1 -1
  27. package/lib/main/browser/documents-main.js +2 -0
  28. package/lib/main/browser/documents-main.js.map +1 -1
  29. package/lib/main/browser/languages-main.d.ts +8 -2
  30. package/lib/main/browser/languages-main.d.ts.map +1 -1
  31. package/lib/main/browser/languages-main.js +36 -0
  32. package/lib/main/browser/languages-main.js.map +1 -1
  33. package/lib/main/browser/status-bar-message-registry-main.d.ts +2 -1
  34. package/lib/main/browser/status-bar-message-registry-main.d.ts.map +1 -1
  35. package/lib/main/browser/status-bar-message-registry-main.js.map +1 -1
  36. package/lib/main/browser/view/tree-view-widget.js +2 -2
  37. package/lib/main/browser/view/tree-view-widget.js.map +1 -1
  38. package/lib/plugin/documents.d.ts.map +1 -1
  39. package/lib/plugin/documents.js +3 -1
  40. package/lib/plugin/documents.js.map +1 -1
  41. package/lib/plugin/file-system-event-service-ext-impl.d.ts +1 -1
  42. package/lib/plugin/file-system-event-service-ext-impl.d.ts.map +1 -1
  43. package/lib/plugin/file-system-event-service-ext-impl.js +1 -1
  44. package/lib/plugin/file-system-event-service-ext-impl.js.map +1 -1
  45. package/lib/plugin/languages/linked-editing-range.d.ts +12 -0
  46. package/lib/plugin/languages/linked-editing-range.d.ts.map +1 -0
  47. package/lib/plugin/languages/linked-editing-range.js +41 -0
  48. package/lib/plugin/languages/linked-editing-range.js.map +1 -0
  49. package/lib/plugin/languages-utils.d.ts +6 -0
  50. package/lib/plugin/languages-utils.d.ts.map +1 -0
  51. package/lib/plugin/languages-utils.js +52 -0
  52. package/lib/plugin/languages-utils.js.map +1 -0
  53. package/lib/plugin/languages.d.ts +7 -2
  54. package/lib/plugin/languages.d.ts.map +1 -1
  55. package/lib/plugin/languages.js +132 -33
  56. package/lib/plugin/languages.js.map +1 -1
  57. package/lib/plugin/markdown-string.d.ts +23 -9
  58. package/lib/plugin/markdown-string.d.ts.map +1 -1
  59. package/lib/plugin/markdown-string.js +97 -26
  60. package/lib/plugin/markdown-string.js.map +1 -1
  61. package/lib/plugin/node/debug/debug.d.ts +1 -1
  62. package/lib/plugin/node/debug/debug.d.ts.map +1 -1
  63. package/lib/plugin/node/debug/debug.js +2 -1
  64. package/lib/plugin/node/debug/debug.js.map +1 -1
  65. package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts +1 -0
  66. package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts.map +1 -1
  67. package/lib/plugin/node/debug/plugin-debug-adapter-session.js +1 -0
  68. package/lib/plugin/node/debug/plugin-debug-adapter-session.js.map +1 -1
  69. package/lib/plugin/plugin-context.d.ts.map +1 -1
  70. package/lib/plugin/plugin-context.js +11 -2
  71. package/lib/plugin/plugin-context.js.map +1 -1
  72. package/lib/plugin/scm.js +1 -1
  73. package/lib/plugin/scm.js.map +1 -1
  74. package/lib/plugin/status-bar/status-bar-item.d.ts +2 -2
  75. package/lib/plugin/status-bar/status-bar-item.d.ts.map +1 -1
  76. package/lib/plugin/status-bar/status-bar-item.js.map +1 -1
  77. package/lib/plugin/type-converters.d.ts +6 -5
  78. package/lib/plugin/type-converters.d.ts.map +1 -1
  79. package/lib/plugin/type-converters.js +12 -6
  80. package/lib/plugin/type-converters.js.map +1 -1
  81. package/lib/plugin/type-converters.spec.js +16 -15
  82. package/lib/plugin/type-converters.spec.js.map +1 -1
  83. package/lib/plugin/types-impl.d.ts +21 -8
  84. package/lib/plugin/types-impl.d.ts.map +1 -1
  85. package/lib/plugin/types-impl.js +25 -7
  86. package/lib/plugin/types-impl.js.map +1 -1
  87. package/lib/plugin/workspace.js +1 -1
  88. package/lib/plugin/workspace.js.map +1 -1
  89. package/package.json +23 -23
  90. package/src/common/paths-util.ts +1 -1
  91. package/src/common/plugin-api-rpc-model.ts +13 -12
  92. package/src/common/plugin-api-rpc.ts +26 -4
  93. package/src/main/browser/debug/debug-main.ts +5 -1
  94. package/src/main/browser/debug/plugin-debug-adapter-contribution.ts +2 -2
  95. package/src/main/browser/debug/plugin-debug-service.ts +3 -3
  96. package/src/main/browser/debug/plugin-debug-session-factory.ts +9 -4
  97. package/src/main/browser/documents-main.ts +2 -0
  98. package/src/main/browser/languages-main.ts +43 -2
  99. package/src/main/browser/status-bar-message-registry-main.ts +2 -1
  100. package/src/main/browser/view/tree-view-widget.tsx +2 -2
  101. package/src/plugin/documents.ts +9 -8
  102. package/src/plugin/file-system-event-service-ext-impl.ts +1 -1
  103. package/src/plugin/languages/linked-editing-range.ts +48 -0
  104. package/src/plugin/languages-utils.ts +55 -0
  105. package/src/plugin/languages.ts +139 -40
  106. package/src/plugin/markdown-string.ts +83 -26
  107. package/src/plugin/node/debug/debug.ts +2 -1
  108. package/src/plugin/node/debug/plugin-debug-adapter-session.ts +2 -0
  109. package/src/plugin/plugin-context.ts +15 -3
  110. package/src/plugin/scm.ts +1 -1
  111. package/src/plugin/status-bar/status-bar-item.ts +3 -3
  112. package/src/plugin/type-converters.spec.ts +20 -17
  113. package/src/plugin/type-converters.ts +17 -12
  114. package/src/plugin/types-impl.ts +31 -11
  115. package/src/plugin/workspace.ts +1 -1
@@ -19,20 +19,18 @@ import {
19
19
  PLUGIN_RPC_CONTEXT,
20
20
  LanguagesMain,
21
21
  SerializedLanguageConfiguration,
22
- SerializedRegExp,
23
- SerializedOnEnterRule,
24
- SerializedIndentationRule,
25
22
  Position,
26
23
  Selection,
27
24
  RawColorInfo,
28
25
  WorkspaceEditDto,
29
- PluginInfo
26
+ PluginInfo,
27
+ Plugin,
30
28
  } from '../common/plugin-api-rpc';
31
29
  import { RPCProtocol } from '../common/rpc-protocol';
32
30
  import * as theia from '@theia/plugin';
33
31
  import { DocumentsExtImpl } from './documents';
34
32
  import { PluginModel } from '../common/plugin-protocol';
35
- import { Disposable, URI } from './types-impl';
33
+ import { Disposable, URI, LanguageStatusSeverity } from './types-impl';
36
34
  import { UriComponents } from '../common/uri-components';
37
35
  import {
38
36
  CodeActionProviderDocumentation,
@@ -63,6 +61,7 @@ import {
63
61
  CallHierarchyItem,
64
62
  CallHierarchyIncomingCall,
65
63
  CallHierarchyOutgoingCall,
64
+ LinkedEditingRanges,
66
65
  } from '../common/plugin-api-rpc-model';
67
66
  import { CompletionAdapter } from './languages/completion';
68
67
  import { Diagnostics } from './languages/diagnostics';
@@ -93,7 +92,10 @@ import { CallHierarchyAdapter } from './languages/call-hierarchy';
93
92
  import { BinaryBuffer } from '@theia/core/lib/common/buffer';
94
93
  import { DocumentSemanticTokensAdapter, DocumentRangeSemanticTokensAdapter } from './languages/semantic-highlighting';
95
94
  import { isReadonlyArray } from '../common/arrays';
96
- import { DisposableCollection } from '@theia/core/lib/common/disposable';
95
+ import { DisposableCollection, disposableTimeout, Disposable as TheiaDisposable } from '@theia/core/lib/common/disposable';
96
+ import { Severity } from '@theia/core/lib/common/severity';
97
+ import { LinkedEditingRangeAdapter } from './languages/linked-editing-range';
98
+ import { serializeEnterRules, serializeIndentation, serializeRegExp } from './languages-utils';
97
99
 
98
100
  type Adapter = CompletionAdapter |
99
101
  SignatureHelpAdapter |
@@ -118,7 +120,8 @@ type Adapter = CompletionAdapter |
118
120
  RenameAdapter |
119
121
  CallHierarchyAdapter |
120
122
  DocumentRangeSemanticTokensAdapter |
121
- DocumentSemanticTokensAdapter;
123
+ DocumentSemanticTokensAdapter |
124
+ LinkedEditingRangeAdapter;
122
125
 
123
126
  export class LanguagesExtImpl implements LanguagesExt {
124
127
 
@@ -630,6 +633,19 @@ export class LanguagesExtImpl implements LanguagesExt {
630
633
  }
631
634
  // ### Call Hierarchy Provider end
632
635
 
636
+ // ### Linked Editing Range Provider begin
637
+ registerLinkedEditingRangeProvider(selector: theia.DocumentSelector, provider: theia.LinkedEditingRangeProvider): theia.Disposable {
638
+ const handle = this.addNewAdapter(new LinkedEditingRangeAdapter(this.documents, provider));
639
+ this.proxy.$registerLinkedEditingRangeProvider(handle, this.transformDocumentSelector(selector));
640
+ return this.createDisposable(handle);
641
+ }
642
+
643
+ $provideLinkedEditingRanges(handle: number, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise<LinkedEditingRanges | undefined> {
644
+ return this.withAdapter(handle, LinkedEditingRangeAdapter, async adapter => adapter.provideRanges(URI.revive(resource), position, token), undefined);
645
+ }
646
+
647
+ // ### Linked Editing Range Provider end
648
+
633
649
  // #region semantic coloring
634
650
 
635
651
  registerDocumentSemanticTokensProvider(selector: theia.DocumentSelector, provider: theia.DocumentSemanticTokensProvider, legend: theia.SemanticTokensLegend,
@@ -668,46 +684,129 @@ export class LanguagesExtImpl implements LanguagesExt {
668
684
  return this.withAdapter(handle, DocumentRangeSemanticTokensAdapter, adapter => adapter.provideDocumentRangeSemanticTokens(URI.revive(resource), range, token), null);
669
685
  }
670
686
 
671
- // #endregion
672
- }
673
-
674
- function serializeEnterRules(rules?: theia.OnEnterRule[]): SerializedOnEnterRule[] | undefined {
675
- if (typeof rules === 'undefined' || rules === null) {
676
- return undefined;
677
- }
687
+ // Copied from https://github.com/microsoft/vscode/blob/7d9b1c37f8e5ae3772782ba3b09d827eb3fdd833/src/vs/workbench/api/common/extHostLanguages.ts
688
+ protected statusItemHandlePool = 0;
689
+ protected readonly statusItemIds = new Set<string>();
690
+ createLanguageStatusItem(extension: Plugin, id: string, selector: theia.DocumentSelector): theia.LanguageStatusItem {
678
691
 
679
- return rules.map(r =>
680
- ({
681
- action: r.action,
682
- beforeText: serializeRegExp(r.beforeText),
683
- afterText: serializeRegExp(r.afterText)
684
- } as SerializedOnEnterRule));
685
- }
692
+ const handle = this.statusItemHandlePool++;
693
+ const proxy = this.proxy;
694
+ const ids = this.statusItemIds;
686
695
 
687
- function serializeRegExp(regexp?: RegExp): SerializedRegExp | undefined {
688
- if (typeof regexp === 'undefined' || regexp === null) {
689
- return undefined;
690
- }
696
+ // enforce extension unique identifier
697
+ const fullyQualifiedId = `${extension.model.id}/${id}`;
698
+ if (ids.has(fullyQualifiedId)) {
699
+ throw new Error(`LanguageStatusItem with id '${id}' ALREADY exists`);
700
+ }
701
+ ids.add(fullyQualifiedId);
702
+
703
+ const data: Omit<theia.LanguageStatusItem, 'dispose'> = {
704
+ selector,
705
+ id,
706
+ name: extension.model.displayName ?? extension.model.name,
707
+ severity: LanguageStatusSeverity.Information,
708
+ command: undefined,
709
+ text: '',
710
+ detail: '',
711
+ busy: false
712
+ };
691
713
 
692
- return {
693
- pattern: regexp.source,
694
- flags: (regexp.global ? 'g' : '') + (regexp.ignoreCase ? 'i' : '') + (regexp.multiline ? 'm' : '')
695
- };
696
- }
714
+ let soonHandle: TheiaDisposable | undefined;
715
+ const commandDisposables = new DisposableCollection();
716
+ const updateAsync = () => {
717
+ soonHandle?.dispose();
718
+ soonHandle = disposableTimeout(() => {
719
+ commandDisposables.dispose();
720
+ commandDisposables.push({ dispose: () => { } }); // Mark disposable as undisposed.
721
+ this.proxy.$setLanguageStatus(handle, {
722
+ id: fullyQualifiedId,
723
+ name: data.name ?? extension.model.displayName ?? extension.model.name,
724
+ source: extension.model.displayName ?? extension.model.name,
725
+ selector: this.transformDocumentSelector(data.selector),
726
+ label: data.text,
727
+ detail: data.detail ?? '',
728
+ severity: data.severity === LanguageStatusSeverity.Error ? Severity.Error : data.severity === LanguageStatusSeverity.Warning ? Severity.Warning : Severity.Info,
729
+ command: data.command && this.commands.converter.toSafeCommand(data.command, commandDisposables),
730
+ accessibilityInfo: data.accessibilityInformation,
731
+ busy: data.busy
732
+ });
733
+ }, 0);
734
+ };
697
735
 
698
- function serializeIndentation(indentationRules?: theia.IndentationRule): SerializedIndentationRule | undefined {
699
- if (typeof indentationRules === 'undefined' || indentationRules === null) {
700
- return undefined;
736
+ const result: theia.LanguageStatusItem = {
737
+ dispose(): void {
738
+ commandDisposables.dispose();
739
+ soonHandle?.dispose();
740
+ proxy.$removeLanguageStatus(handle);
741
+ ids.delete(fullyQualifiedId);
742
+ },
743
+ get id(): string {
744
+ return data.id;
745
+ },
746
+ get name(): string | undefined {
747
+ return data.name;
748
+ },
749
+ set name(value) {
750
+ data.name = value;
751
+ updateAsync();
752
+ },
753
+ get selector(): theia.DocumentSelector {
754
+ return data.selector;
755
+ },
756
+ set selector(value) {
757
+ data.selector = value;
758
+ updateAsync();
759
+ },
760
+ get text(): string {
761
+ return data.text;
762
+ },
763
+ set text(value) {
764
+ data.text = value;
765
+ updateAsync();
766
+ },
767
+ get detail(): string | undefined {
768
+ return data.detail;
769
+ },
770
+ set detail(value) {
771
+ data.detail = value;
772
+ updateAsync();
773
+ },
774
+ get severity(): theia.LanguageStatusSeverity {
775
+ return data.severity;
776
+ },
777
+ set severity(value) {
778
+ data.severity = value;
779
+ updateAsync();
780
+ },
781
+ get accessibilityInformation(): theia.AccessibilityInformation | undefined {
782
+ return data.accessibilityInformation;
783
+ },
784
+ set accessibilityInformation(value) {
785
+ data.accessibilityInformation = value;
786
+ updateAsync();
787
+ },
788
+ get command(): theia.Command | undefined {
789
+ return data.command;
790
+ },
791
+ set command(value) {
792
+ data.command = value;
793
+ updateAsync();
794
+ },
795
+ get busy(): boolean {
796
+ return data.busy;
797
+ },
798
+ set busy(value: boolean) {
799
+ data.busy = value;
800
+ updateAsync();
801
+ }
802
+ };
803
+ updateAsync();
804
+ return result;
701
805
  }
702
-
703
- return {
704
- increaseIndentPattern: serializeRegExp(indentationRules.increaseIndentPattern),
705
- decreaseIndentPattern: serializeRegExp(indentationRules.decreaseIndentPattern),
706
- indentNextLinePattern: serializeRegExp(indentationRules.indentNextLinePattern),
707
- unIndentedLinePattern: serializeRegExp(indentationRules.unIndentedLinePattern)
708
- };
806
+ // #endregion
709
807
  }
710
808
 
711
809
  function getPluginLabel(pluginInfo: PluginInfo): string {
712
810
  return pluginInfo.displayName || pluginInfo.name;
713
811
  }
812
+
@@ -14,45 +14,102 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import { MarkdownString as IMarkdownString } from '../common/plugin-api-rpc-model';
17
+ import { Mutable } from '@theia/core';
18
+ import { MarkdownStringImpl as BaseMarkdownString, MarkdownString as MarkdownStringInterface } from '@theia/core/lib/common/markdown-rendering';
19
+ import * as pluginAPI from '@theia/plugin';
20
+ import { es5ClassCompat } from '../common/types';
21
+ import { URI } from './types-impl';
18
22
 
19
- export class MarkdownString {
23
+ // Copied from https://github.com/microsoft/vscode/blob/7d9b1c37f8e5ae3772782ba3b09d827eb3fdd833/src/vs/workbench/api/common/extHostTypes.ts
20
24
 
21
- value: string;
22
- isTrusted?: boolean;
25
+ @es5ClassCompat
26
+ export class MarkdownString implements pluginAPI.MarkdownString {
23
27
 
24
- constructor(value?: string) {
25
- this.value = value || '';
28
+ readonly #delegate: BaseMarkdownString;
29
+
30
+ /**
31
+ * @returns whether the thing is a markdown string implementation with helper methods.
32
+ */
33
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
+ static isMarkdownString(thing: any): thing is pluginAPI.MarkdownString {
35
+ if (thing instanceof MarkdownString) {
36
+ return true;
37
+ }
38
+ return thing && thing.appendCodeblock && thing.appendMarkdown && thing.appendText && (thing.value !== undefined);
39
+ }
40
+
41
+ constructor(value?: string, supportThemeIcons: boolean = false) {
42
+ this.#delegate = new BaseMarkdownString(value, { supportThemeIcons });
43
+ }
44
+
45
+ get value(): string {
46
+ return this.#delegate.value;
47
+ }
48
+ set value(value: string) {
49
+ this.#delegate.value = value;
50
+ }
51
+
52
+ get isTrusted(): boolean | undefined {
53
+ return this.#delegate.isTrusted;
54
+ }
55
+
56
+ set isTrusted(value: boolean | undefined) {
57
+ this.#delegate.isTrusted = value;
58
+ }
59
+
60
+ get supportThemeIcons(): boolean | undefined {
61
+ return this.#delegate.supportThemeIcons;
26
62
  }
27
63
 
28
- appendText(value: string): MarkdownString {
29
- // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
30
- this.value += value.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&');
64
+ set supportThemeIcons(value: boolean | undefined) {
65
+ this.#delegate.supportThemeIcons = value;
66
+ }
67
+
68
+ get supportHtml(): boolean | undefined {
69
+ return this.#delegate.supportHtml;
70
+ }
71
+
72
+ set supportHtml(value: boolean | undefined) {
73
+ this.#delegate.supportHtml = value;
74
+ }
75
+
76
+ get baseUri(): pluginAPI.Uri | undefined {
77
+ return URI.revive(this.#delegate.baseUri);
78
+ }
79
+
80
+ set baseUri(value: pluginAPI.Uri | undefined) {
81
+ this.#delegate.baseUri = value;
82
+ }
83
+
84
+ appendText(value: string): pluginAPI.MarkdownString {
85
+ this.#delegate.appendText(value);
31
86
  return this;
32
87
  }
33
88
 
34
- appendMarkdown(value: string): MarkdownString {
35
- this.value += value;
89
+ appendMarkdown(value: string): pluginAPI.MarkdownString {
90
+ this.#delegate.appendMarkdown(value);
36
91
  return this;
37
92
  }
38
93
 
39
- appendCodeblock(code: string, language: string = ''): MarkdownString {
40
- this.value += '\n```';
41
- this.value += language;
42
- this.value += '\n';
43
- this.value += code;
44
- this.value += '\n```\n';
94
+ appendCodeblock(value: string, language?: string): pluginAPI.MarkdownString {
95
+ this.#delegate.appendCodeblock(language ?? '', value);
45
96
  return this;
46
97
  }
47
- }
48
98
 
49
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
- export function isMarkdownString(thing: any): thing is IMarkdownString {
51
- if (thing instanceof MarkdownString) {
52
- return true;
53
- } else if (thing && typeof thing === 'object') {
54
- return typeof (<MarkdownString>thing).value === 'string'
55
- && (typeof (<MarkdownString>thing).isTrusted === 'boolean' || (<MarkdownString>thing).isTrusted === undefined);
99
+ toJSON(): MarkdownStringInterface {
100
+ const plainObject: Mutable<MarkdownStringInterface> = { value: this.value };
101
+ if (this.isTrusted !== undefined) {
102
+ plainObject.isTrusted = this.isTrusted;
103
+ }
104
+ if (this.supportThemeIcons !== undefined) {
105
+ plainObject.supportThemeIcons = this.supportThemeIcons;
106
+ }
107
+ if (this.supportHtml !== undefined) {
108
+ plainObject.supportHtml = this.supportHtml;
109
+ }
110
+ if (this.baseUri !== undefined) {
111
+ plainObject.baseUri = this.baseUri.toJSON();
112
+ }
113
+ return plainObject;
56
114
  }
57
- return false;
58
115
  }
@@ -290,13 +290,14 @@ export class DebugExtImpl implements DebugExt {
290
290
  return undefined;
291
291
  }
292
292
 
293
- async $createDebugSession(debugConfiguration: theia.DebugConfiguration): Promise<string> {
293
+ async $createDebugSession(debugConfiguration: theia.DebugConfiguration, workspaceFolderUri: string | undefined): Promise<string> {
294
294
  const sessionId = uuid.v4();
295
295
 
296
296
  const theiaSession: theia.DebugSession = {
297
297
  id: sessionId,
298
298
  type: debugConfiguration.type,
299
299
  name: debugConfiguration.name,
300
+ workspaceFolder: this.toWorkspaceFolder(workspaceFolderUri),
300
301
  configuration: debugConfiguration,
301
302
  customRequest: async (command: string, args?: any) => {
302
303
  const response = await this.proxy.$customRequest(sessionId, command, args);
@@ -27,6 +27,7 @@ import { Channel } from '@theia/debug/lib/common/debug-service';
27
27
  export class PluginDebugAdapterSession extends DebugAdapterSessionImpl {
28
28
  readonly type: string;
29
29
  readonly name: string;
30
+ readonly workspaceFolder: theia.WorkspaceFolder | undefined;
30
31
  readonly configuration: theia.DebugConfiguration;
31
32
 
32
33
  constructor(
@@ -38,6 +39,7 @@ export class PluginDebugAdapterSession extends DebugAdapterSessionImpl {
38
39
 
39
40
  this.type = theiaSession.type;
40
41
  this.name = theiaSession.name;
42
+ this.workspaceFolder = theiaSession.workspaceFolder;
41
43
  this.configuration = theiaSession.configuration;
42
44
  }
43
45
 
@@ -140,7 +140,10 @@ import {
140
140
  SourceControlInputBoxValidationType,
141
141
  URI,
142
142
  FileDecoration,
143
- ExtensionMode
143
+ ExtensionMode,
144
+ LinkedEditingRanges,
145
+ LanguageStatusSeverity,
146
+ TextDocumentChangeReason
144
147
  } from './types-impl';
145
148
  import { AuthenticationExtImpl } from './authentication-ext';
146
149
  import { SymbolKind } from '../common/plugin-api-rpc-model';
@@ -155,7 +158,7 @@ import { LanguagesExtImpl } from './languages';
155
158
  import { fromDocumentSelector, pluginToPluginInfo, fromGlobPattern } from './type-converters';
156
159
  import { DialogsExtImpl } from './dialogs';
157
160
  import { NotificationExtImpl } from './notification';
158
- import { score } from '@theia/callhierarchy/lib/common/language-selector';
161
+ import { score } from '@theia/editor/lib/common/language-selector';
159
162
  import { MarkdownString } from './markdown-string';
160
163
  import { TreeViewsExtImpl } from './tree/tree-views';
161
164
  import { ConnectionImpl } from '../common/connection';
@@ -779,6 +782,12 @@ export function createAPIFactory(
779
782
  },
780
783
  registerCallHierarchyProvider(selector: theia.DocumentSelector, provider: theia.CallHierarchyProvider): theia.Disposable {
781
784
  return languagesExt.registerCallHierarchyProvider(selector, provider);
785
+ },
786
+ registerLinkedEditingRangeProvider(selector: theia.DocumentSelector, provider: theia.LinkedEditingRangeProvider): theia.Disposable {
787
+ return languagesExt.registerLinkedEditingRangeProvider(selector, provider);
788
+ },
789
+ createLanguageStatusItem(id: string, selector: theia.DocumentSelector): theia.LanguageStatusItem {
790
+ return languagesExt.createLanguageStatusItem(plugin, id, selector);
782
791
  }
783
792
  };
784
793
 
@@ -955,6 +964,7 @@ export function createAPIFactory(
955
964
  DebugConsoleMode,
956
965
  DiagnosticSeverity,
957
966
  DiagnosticRelatedInformation,
967
+ LanguageStatusSeverity,
958
968
  Location,
959
969
  LogLevel,
960
970
  DiagnosticTag,
@@ -1031,11 +1041,13 @@ export function createAPIFactory(
1031
1041
  SemanticTokens,
1032
1042
  SemanticTokensEdits,
1033
1043
  SemanticTokensEdit,
1044
+ TextDocumentChangeReason,
1034
1045
  ColorThemeKind,
1035
1046
  SourceControlInputBoxValidationType,
1036
1047
  FileDecoration,
1037
1048
  CancellationError,
1038
- ExtensionMode
1049
+ ExtensionMode,
1050
+ LinkedEditingRanges
1039
1051
  };
1040
1052
  };
1041
1053
  }
package/src/plugin/scm.ts CHANGED
@@ -37,7 +37,7 @@ import { Command } from '../common/plugin-api-rpc-model';
37
37
  import { RPCProtocol } from '../common/rpc-protocol';
38
38
  import { URI } from './types-impl';
39
39
  import { ScmCommandArg } from '../common/plugin-api-rpc';
40
- import { sep } from '@theia/callhierarchy/lib/common/paths';
40
+ import { sep } from '@theia/core/lib/common/paths';
41
41
  type ProviderHandle = number;
42
42
  type GroupHandle = number;
43
43
  type ResourceStateHandle = number;
@@ -33,7 +33,7 @@ export class StatusBarItemImpl implements theia.StatusBarItem {
33
33
 
34
34
  private _name: string | undefined;
35
35
  private _text: string;
36
- private _tooltip: string;
36
+ private _tooltip: string | theia.MarkdownString | undefined;
37
37
  private _color: string | ThemeColor | undefined;
38
38
  private _backgroundColor: ThemeColor | undefined;
39
39
  private _command: string | theia.Command;
@@ -74,7 +74,7 @@ export class StatusBarItemImpl implements theia.StatusBarItem {
74
74
  return this._text;
75
75
  }
76
76
 
77
- public get tooltip(): string {
77
+ public get tooltip(): string | theia.MarkdownString | undefined {
78
78
  return this._tooltip;
79
79
  }
80
80
 
@@ -104,7 +104,7 @@ export class StatusBarItemImpl implements theia.StatusBarItem {
104
104
  this.update();
105
105
  }
106
106
 
107
- public set tooltip(tooltip: string) {
107
+ public set tooltip(tooltip: string | theia.MarkdownString | undefined) {
108
108
  this._tooltip = tooltip;
109
109
  this.update();
110
110
  }
@@ -19,7 +19,8 @@ import * as Converter from './type-converters';
19
19
  import * as theia from '@theia/plugin';
20
20
  import * as types from './types-impl';
21
21
  import * as model from '../common/plugin-api-rpc-model';
22
- import { MarkdownString, isMarkdownString } from './markdown-string';
22
+ import { MarkdownString } from './markdown-string';
23
+ import { MarkdownString as MarkdownStringInterface } from '@theia/core/lib/common/markdown-rendering';
23
24
  import { TaskDto } from '../common/plugin-api-rpc';
24
25
  import { TaskGroup } from './types-impl';
25
26
 
@@ -63,7 +64,7 @@ describe('Type converters:', () => {
63
64
  const markdownString = new MarkdownString('**test**');
64
65
 
65
66
  // when
66
- const result = isMarkdownString(markdownString);
67
+ const result = MarkdownStringInterface.is(markdownString);
67
68
 
68
69
  // then
69
70
  assert.deepStrictEqual(result !== false, true);
@@ -74,7 +75,7 @@ describe('Type converters:', () => {
74
75
  const markdownObject = { value: '*test*' };
75
76
 
76
77
  // when
77
- const result = isMarkdownString(markdownObject);
78
+ const result = MarkdownStringInterface.is(markdownObject);
78
79
 
79
80
  // then
80
81
  assert.deepStrictEqual(result !== false, true);
@@ -85,7 +86,7 @@ describe('Type converters:', () => {
85
86
  const markdownObject = { field1: 5, value: '*test*', field2: 'test' };
86
87
 
87
88
  // when
88
- const result = isMarkdownString(markdownObject);
89
+ const result = MarkdownStringInterface.is(markdownObject);
89
90
 
90
91
  // then
91
92
  assert.deepStrictEqual(result !== false, true);
@@ -96,7 +97,7 @@ describe('Type converters:', () => {
96
97
  const nonMarkdownObject = { field1: 5, field2: 'test' };
97
98
 
98
99
  // when
99
- const result = isMarkdownString(nonMarkdownObject);
100
+ const result = MarkdownStringInterface.is(nonMarkdownObject);
100
101
 
101
102
  // then
102
103
  assert.deepStrictEqual(result === false, true);
@@ -107,7 +108,7 @@ describe('Type converters:', () => {
107
108
  const nonMarkdownObject = { isTrusted: true, field1: 5, field2: 'test' };
108
109
 
109
110
  // when
110
- const result = isMarkdownString(nonMarkdownObject);
111
+ const result = MarkdownStringInterface.is(nonMarkdownObject);
111
112
 
112
113
  // then
113
114
  assert.deepStrictEqual(result === false, true);
@@ -125,10 +126,11 @@ describe('Type converters:', () => {
125
126
 
126
127
  it('should convert plugin markdown to model markdown', () => {
127
128
  // when
128
- const result = { ...Converter.fromMarkdown(pluginMarkdown) };
129
+ const result = Converter.fromMarkdown(pluginMarkdown);
129
130
 
130
131
  // then
131
- assert.deepStrictEqual(result, modelMarkdown);
132
+ assert.deepStrictEqual(result, { ...modelMarkdown, supportThemeIcons: false, supportHtml: false },
133
+ 'The implementation includes an explicit default `false` for `supportThemeIcons` and `supportHtml`');
132
134
  });
133
135
 
134
136
  it('should convert string to model markdown', () => {
@@ -153,20 +155,21 @@ describe('Type converters:', () => {
153
155
  const markups: (theia.MarkdownString | theia.MarkedString)[] = [
154
156
  pluginMarkdown,
155
157
  aStringWithMarkdown,
156
- codeblock
158
+ codeblock,
159
+ new MarkdownString('hello', true),
157
160
  ];
158
161
 
159
162
  // when
160
- const result: model.MarkdownString[] = Converter.fromManyMarkdown(markups)
161
- // convert to vanilla JS Object for deepStrictEqual comparison:
162
- .map(md => ({ ...md }));
163
-
163
+ const result: model.MarkdownString[] = Converter.fromManyMarkdown(markups);
164
164
  // then
165
165
  assert.deepStrictEqual(Array.isArray(result), true);
166
- assert.deepStrictEqual(result.length, 3);
167
- assert.deepStrictEqual(result[0], modelMarkdown);
168
- assert.deepStrictEqual(result[1], modelMarkdown);
169
- assert.deepStrictEqual(result[2], modelMarkdownWithCode);
166
+ assert.deepStrictEqual(result.length, 4);
167
+ assert.deepStrictEqual(result[0], { ...modelMarkdown, supportThemeIcons: false, supportHtml: false, },
168
+ 'MarkdownString implementation includes default value for `supportThemeIcons` and `supportHtml`');
169
+ assert.deepStrictEqual(result[1], modelMarkdown, 'Strings should be converted to Markdown.');
170
+ assert.deepStrictEqual(result[2], modelMarkdownWithCode, 'Objects matching the interface should be unchanged');
171
+ assert.deepStrictEqual(result[3], { value: 'hello', supportThemeIcons: true, supportHtml: false },
172
+ 'The constructor argument to MarkdownString for theme icons is respected.');
170
173
  });
171
174
  });
172
175
 
@@ -22,11 +22,12 @@ import {
22
22
  DecorationOptions, EditorPosition, Plugin, Position, WorkspaceTextEditDto, WorkspaceFileEditDto, Selection, TaskDto, WorkspaceEditDto
23
23
  } from '../common/plugin-api-rpc';
24
24
  import * as model from '../common/plugin-api-rpc-model';
25
- import { LanguageFilter, LanguageSelector, RelativePattern } from '@theia/callhierarchy/lib/common/language-selector';
26
- import { isMarkdownString, MarkdownString } from './markdown-string';
25
+ import { LanguageFilter, LanguageSelector, RelativePattern } from '@theia/editor/lib/common/language-selector';
26
+ import { MarkdownString as PluginMarkdownStringImpl } from './markdown-string';
27
27
  import * as types from './types-impl';
28
28
  import { UriComponents } from '../common/uri-components';
29
29
  import { isReadonlyArray } from '../common/arrays';
30
+ import { MarkdownString as MarkdownStringDTO } from '@theia/core/lib/common/markdown-rendering';
30
31
 
31
32
  const SIDE_GROUP = -2;
32
33
  const ACTIVE_GROUP = -1;
@@ -172,7 +173,7 @@ export function fromRangeOrRangeWithMessage(ranges: theia.Range[] | theia.Decora
172
173
  }
173
174
  }
174
175
 
175
- export function fromManyMarkdown(markup: (theia.MarkdownString | theia.MarkedString)[]): model.MarkdownString[] {
176
+ export function fromManyMarkdown(markup: (theia.MarkdownString | theia.MarkedString)[]): MarkdownStringDTO[] {
176
177
  return markup.map(fromMarkdown);
177
178
  }
178
179
 
@@ -188,23 +189,27 @@ function isCodeblock(thing: any): thing is Codeblock {
188
189
  && typeof (<Codeblock>thing).value === 'string';
189
190
  }
190
191
 
191
- export function fromMarkdown(markup: theia.MarkdownString | theia.MarkedString): model.MarkdownString {
192
+ export function fromMarkdown(markup: theia.MarkdownString | theia.MarkedString): MarkdownStringDTO {
192
193
  if (isCodeblock(markup)) {
193
194
  const { language, value } = markup;
194
195
  return { value: '```' + language + '\n' + value + '\n```\n' };
195
- } else if (isMarkdownString(markup)) {
196
+ } else if (markup instanceof PluginMarkdownStringImpl) {
197
+ return markup.toJSON();
198
+ } else if (MarkdownStringDTO.is(markup)) {
196
199
  return markup;
197
200
  } else if (typeof markup === 'string') {
198
- return { value: <string>markup };
201
+ return { value: markup };
199
202
  } else {
200
203
  return { value: '' };
201
204
  }
202
205
  }
203
206
 
204
- export function toMarkdown(value: model.MarkdownString): MarkdownString {
205
- const ret = new MarkdownString(value.value);
206
- ret.isTrusted = value.isTrusted;
207
- return ret;
207
+ export function toMarkdown(value: MarkdownStringDTO): PluginMarkdownStringImpl {
208
+ const implemented = new PluginMarkdownStringImpl(value.value, value.supportThemeIcons);
209
+ implemented.isTrusted = value.isTrusted;
210
+ implemented.supportHtml = value.supportHtml;
211
+ implemented.baseUri = value.baseUri && URI.revive(implemented.baseUri);
212
+ return implemented;
208
213
  }
209
214
 
210
215
  export function fromDocumentSelector(selector: theia.DocumentSelector | undefined): LanguageSelector | undefined {
@@ -466,7 +471,7 @@ export namespace ParameterInformation {
466
471
  export function to(info: model.ParameterInformation): types.ParameterInformation {
467
472
  return {
468
473
  label: info.label,
469
- documentation: isMarkdownString(info.documentation) ? toMarkdown(info.documentation) : info.documentation
474
+ documentation: MarkdownStringDTO.is(info.documentation) ? toMarkdown(info.documentation) : info.documentation
470
475
  };
471
476
  }
472
477
  }
@@ -484,7 +489,7 @@ export namespace SignatureInformation {
484
489
  export function to(info: model.SignatureInformation): types.SignatureInformation {
485
490
  return {
486
491
  label: info.label,
487
- documentation: isMarkdownString(info.documentation) ? toMarkdown(info.documentation) : info.documentation,
492
+ documentation: MarkdownStringDTO.is(info.documentation) ? toMarkdown(info.documentation) : info.documentation,
488
493
  parameters: info.parameters && info.parameters.map(ParameterInformation.to)
489
494
  };
490
495
  }