@theia/plugin-ext 1.26.0-next.7 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/common/paths-util.js +1 -1
- package/lib/common/paths-util.js.map +1 -1
- package/lib/common/plugin-api-rpc-model.d.ts +12 -12
- package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc-model.js +3 -1
- package/lib/common/plugin-api-rpc-model.js.map +1 -1
- package/lib/common/plugin-api-rpc.d.ts +24 -5
- package/lib/common/plugin-api-rpc.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc.js +2 -1
- package/lib/common/plugin-api-rpc.js.map +1 -1
- package/lib/common/plugin-protocol.d.ts +1 -0
- package/lib/common/plugin-protocol.d.ts.map +1 -1
- package/lib/common/plugin-protocol.js.map +1 -1
- package/lib/hosted/browser/worker/worker-main.js +4 -2
- package/lib/hosted/browser/worker/worker-main.js.map +1 -1
- package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts.map +1 -1
- package/lib/hosted/node/hosted-plugin-deployer-handler.js +2 -0
- package/lib/hosted/node/hosted-plugin-deployer-handler.js.map +1 -1
- package/lib/hosted/node/plugin-host-proxy.d.ts +18 -0
- package/lib/hosted/node/plugin-host-proxy.d.ts.map +1 -0
- package/lib/hosted/node/plugin-host-proxy.js +70 -0
- package/lib/hosted/node/plugin-host-proxy.js.map +1 -0
- package/lib/hosted/node/plugin-host-rpc.d.ts.map +1 -1
- package/lib/hosted/node/plugin-host-rpc.js +6 -2
- package/lib/hosted/node/plugin-host-rpc.js.map +1 -1
- package/lib/main/browser/debug/debug-main.d.ts +1 -0
- package/lib/main/browser/debug/debug-main.d.ts.map +1 -1
- package/lib/main/browser/debug/debug-main.js +3 -1
- package/lib/main/browser/debug/debug-main.js.map +1 -1
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts +1 -1
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts.map +1 -1
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.js +2 -2
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.js.map +1 -1
- package/lib/main/browser/debug/plugin-debug-service.d.ts +3 -1
- package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
- package/lib/main/browser/debug/plugin-debug-service.js +14 -3
- package/lib/main/browser/debug/plugin-debug-service.js.map +1 -1
- package/lib/main/browser/debug/plugin-debug-session-factory.d.ts +5 -2
- package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
- package/lib/main/browser/debug/plugin-debug-session-factory.js +6 -4
- package/lib/main/browser/debug/plugin-debug-session-factory.js.map +1 -1
- package/lib/main/browser/documents-main.d.ts.map +1 -1
- package/lib/main/browser/documents-main.js +2 -0
- package/lib/main/browser/documents-main.js.map +1 -1
- package/lib/main/browser/languages-main.d.ts +8 -2
- package/lib/main/browser/languages-main.d.ts.map +1 -1
- package/lib/main/browser/languages-main.js +36 -0
- package/lib/main/browser/languages-main.js.map +1 -1
- package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
- package/lib/main/browser/plugin-ext-frontend-module.js +0 -3
- package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
- package/lib/main/browser/status-bar-message-registry-main.d.ts +2 -1
- package/lib/main/browser/status-bar-message-registry-main.d.ts.map +1 -1
- package/lib/main/browser/status-bar-message-registry-main.js.map +1 -1
- package/lib/main/browser/terminal-main.js +1 -1
- package/lib/main/browser/terminal-main.js.map +1 -1
- package/lib/main/browser/view/tree-view-widget.js +2 -2
- package/lib/main/browser/view/tree-view-widget.js.map +1 -1
- package/lib/plugin/comments.js +1 -1
- package/lib/plugin/comments.js.map +1 -1
- package/lib/plugin/documents.d.ts.map +1 -1
- package/lib/plugin/documents.js +3 -1
- package/lib/plugin/documents.js.map +1 -1
- package/lib/plugin/file-system-event-service-ext-impl.d.ts +1 -1
- package/lib/plugin/file-system-event-service-ext-impl.d.ts.map +1 -1
- package/lib/plugin/file-system-event-service-ext-impl.js +1 -1
- package/lib/plugin/file-system-event-service-ext-impl.js.map +1 -1
- package/lib/plugin/languages/linked-editing-range.d.ts +12 -0
- package/lib/plugin/languages/linked-editing-range.d.ts.map +1 -0
- package/lib/plugin/languages/linked-editing-range.js +41 -0
- package/lib/plugin/languages/linked-editing-range.js.map +1 -0
- package/lib/plugin/languages-utils.d.ts +6 -0
- package/lib/plugin/languages-utils.d.ts.map +1 -0
- package/lib/plugin/languages-utils.js +52 -0
- package/lib/plugin/languages-utils.js.map +1 -0
- package/lib/plugin/languages.d.ts +7 -2
- package/lib/plugin/languages.d.ts.map +1 -1
- package/lib/plugin/languages.js +132 -33
- package/lib/plugin/languages.js.map +1 -1
- package/lib/plugin/markdown-string.d.ts +23 -9
- package/lib/plugin/markdown-string.d.ts.map +1 -1
- package/lib/plugin/markdown-string.js +97 -26
- package/lib/plugin/markdown-string.js.map +1 -1
- package/lib/plugin/node/debug/debug.d.ts +1 -1
- package/lib/plugin/node/debug/debug.d.ts.map +1 -1
- package/lib/plugin/node/debug/debug.js +2 -1
- package/lib/plugin/node/debug/debug.js.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts +1 -0
- package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-session.js +1 -0
- package/lib/plugin/node/debug/plugin-debug-adapter-session.js.map +1 -1
- package/lib/plugin/plugin-context.d.ts.map +1 -1
- package/lib/plugin/plugin-context.js +11 -2
- package/lib/plugin/plugin-context.js.map +1 -1
- package/lib/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/plugin/plugin-manager.js +3 -1
- package/lib/plugin/plugin-manager.js.map +1 -1
- package/lib/plugin/prefix-sum-computer.d.ts +1 -1
- package/lib/plugin/prefix-sum-computer.d.ts.map +1 -1
- package/lib/plugin/prefix-sum-computer.js +8 -8
- package/lib/plugin/prefix-sum-computer.js.map +1 -1
- package/lib/plugin/scm.js +1 -1
- package/lib/plugin/scm.js.map +1 -1
- package/lib/plugin/status-bar/status-bar-item.d.ts +2 -2
- package/lib/plugin/status-bar/status-bar-item.d.ts.map +1 -1
- package/lib/plugin/status-bar/status-bar-item.js.map +1 -1
- package/lib/plugin/terminal-ext.d.ts +2 -1
- package/lib/plugin/terminal-ext.d.ts.map +1 -1
- package/lib/plugin/terminal-ext.js +2 -1
- package/lib/plugin/terminal-ext.js.map +1 -1
- package/lib/plugin/theming.d.ts +1 -1
- package/lib/plugin/theming.js +3 -3
- package/lib/plugin/type-converters.d.ts +6 -5
- package/lib/plugin/type-converters.d.ts.map +1 -1
- package/lib/plugin/type-converters.js +12 -6
- package/lib/plugin/type-converters.js.map +1 -1
- package/lib/plugin/type-converters.spec.js +16 -15
- package/lib/plugin/type-converters.spec.js.map +1 -1
- package/lib/plugin/types-impl.d.ts +21 -8
- package/lib/plugin/types-impl.d.ts.map +1 -1
- package/lib/plugin/types-impl.js +25 -7
- package/lib/plugin/types-impl.js.map +1 -1
- package/lib/plugin/workspace.js +1 -1
- package/lib/plugin/workspace.js.map +1 -1
- package/package.json +26 -24
- package/src/common/paths-util.ts +1 -1
- package/src/common/plugin-api-rpc-model.ts +13 -12
- package/src/common/plugin-api-rpc.ts +30 -6
- package/src/common/plugin-protocol.ts +1 -0
- package/src/hosted/browser/worker/worker-main.ts +4 -2
- package/src/hosted/node/hosted-plugin-deployer-handler.ts +1 -0
- package/src/hosted/node/plugin-host-proxy.ts +80 -0
- package/src/hosted/node/plugin-host-rpc.ts +6 -2
- package/src/main/browser/debug/debug-main.ts +5 -1
- package/src/main/browser/debug/plugin-debug-adapter-contribution.ts +2 -2
- package/src/main/browser/debug/plugin-debug-service.ts +16 -3
- package/src/main/browser/debug/plugin-debug-session-factory.ts +9 -4
- package/src/main/browser/documents-main.ts +2 -0
- package/src/main/browser/languages-main.ts +43 -2
- package/src/main/browser/plugin-ext-frontend-module.ts +0 -4
- package/src/main/browser/status-bar-message-registry-main.ts +2 -1
- package/src/main/browser/terminal-main.ts +1 -1
- package/src/main/browser/view/tree-view-widget.tsx +2 -2
- package/src/plugin/comments.ts +1 -1
- package/src/plugin/documents.ts +9 -8
- package/src/plugin/file-system-event-service-ext-impl.ts +1 -1
- package/src/plugin/languages/linked-editing-range.ts +48 -0
- package/src/plugin/languages-utils.ts +55 -0
- package/src/plugin/languages.ts +139 -40
- package/src/plugin/markdown-string.ts +83 -26
- package/src/plugin/node/debug/debug.ts +2 -1
- package/src/plugin/node/debug/plugin-debug-adapter-session.ts +2 -0
- package/src/plugin/plugin-context.ts +15 -3
- package/src/plugin/plugin-manager.ts +3 -1
- package/src/plugin/prefix-sum-computer.ts +8 -8
- package/src/plugin/scm.ts +1 -1
- package/src/plugin/status-bar/status-bar-item.ts +3 -3
- package/src/plugin/terminal-ext.ts +5 -2
- package/src/plugin/theming.ts +4 -4
- package/src/plugin/type-converters.spec.ts +20 -17
- package/src/plugin/type-converters.ts +17 -12
- package/src/plugin/types-impl.ts +31 -11
- package/src/plugin/workspace.ts +1 -1
package/src/plugin/languages.ts
CHANGED
|
@@ -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
|
-
//
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
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
|
-
|
|
680
|
-
|
|
681
|
-
|
|
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
|
-
|
|
688
|
-
|
|
689
|
-
|
|
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
|
-
|
|
693
|
-
|
|
694
|
-
|
|
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
|
-
|
|
699
|
-
|
|
700
|
-
|
|
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 {
|
|
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
|
-
|
|
23
|
+
// Copied from https://github.com/microsoft/vscode/blob/7d9b1c37f8e5ae3772782ba3b09d827eb3fdd833/src/vs/workbench/api/common/extHostTypes.ts
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
@es5ClassCompat
|
|
26
|
+
export class MarkdownString implements pluginAPI.MarkdownString {
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
|
89
|
+
appendMarkdown(value: string): pluginAPI.MarkdownString {
|
|
90
|
+
this.#delegate.appendMarkdown(value);
|
|
36
91
|
return this;
|
|
37
92
|
}
|
|
38
93
|
|
|
39
|
-
appendCodeblock(
|
|
40
|
-
this.
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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/
|
|
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
|
}
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
} from '../common/plugin-api-rpc';
|
|
31
31
|
import { PluginMetadata, PluginJsonValidationContribution } from '../common/plugin-protocol';
|
|
32
32
|
import * as theia from '@theia/plugin';
|
|
33
|
+
import * as types from './types-impl';
|
|
33
34
|
import { join } from './path';
|
|
34
35
|
import { EnvExtImpl } from './env';
|
|
35
36
|
import { PreferenceRegistryExtImpl } from './preference-registry';
|
|
@@ -372,6 +373,7 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
|
|
|
372
373
|
const secrets = new SecretStorageExt(plugin, this.secrets);
|
|
373
374
|
const globalStoragePath = join(configStorage.hostGlobalStoragePath, plugin.model.id);
|
|
374
375
|
const extension = new PluginExt(this, plugin);
|
|
376
|
+
const extensionModeValue = plugin.isUnderDevelopment ? types.ExtensionMode.Development : types.ExtensionMode.Production;
|
|
375
377
|
const pluginContext: theia.PluginContext = {
|
|
376
378
|
extensionPath: extension.extensionPath,
|
|
377
379
|
extensionUri: extension.extensionUri,
|
|
@@ -386,7 +388,7 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
|
|
|
386
388
|
globalStoragePath: globalStoragePath,
|
|
387
389
|
globalStorageUri: Uri.file(globalStoragePath),
|
|
388
390
|
environmentVariableCollection: this.terminalService.getEnvironmentVariableCollection(plugin.model.id),
|
|
389
|
-
extensionMode:
|
|
391
|
+
extensionMode: extensionModeValue,
|
|
390
392
|
extension,
|
|
391
393
|
logUri: Uri.file(logPath)
|
|
392
394
|
};
|
|
@@ -114,9 +114,9 @@ export class PrefixSumComputer {
|
|
|
114
114
|
return true;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
public removeValues(startIndex: number,
|
|
117
|
+
public removeValues(startIndex: number, count: number): boolean {
|
|
118
118
|
startIndex = toUint32(startIndex);
|
|
119
|
-
|
|
119
|
+
count = toUint32(count);
|
|
120
120
|
|
|
121
121
|
const oldValues = this.values;
|
|
122
122
|
const oldPrefixSum = this.prefixSum;
|
|
@@ -125,18 +125,18 @@ export class PrefixSumComputer {
|
|
|
125
125
|
return false;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
const
|
|
129
|
-
if (
|
|
130
|
-
|
|
128
|
+
const maxCount = oldValues.length - startIndex;
|
|
129
|
+
if (count >= maxCount) {
|
|
130
|
+
count = maxCount;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
if (
|
|
133
|
+
if (count === 0) {
|
|
134
134
|
return false;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
this.values = new Uint32Array(oldValues.length -
|
|
137
|
+
this.values = new Uint32Array(oldValues.length - count);
|
|
138
138
|
this.values.set(oldValues.subarray(0, startIndex), 0);
|
|
139
|
-
this.values.set(oldValues.subarray(startIndex +
|
|
139
|
+
this.values.set(oldValues.subarray(startIndex + count), startIndex);
|
|
140
140
|
|
|
141
141
|
this.prefixSum = new Uint32Array(this.values.length);
|
|
142
142
|
if (startIndex - 1 < this.prefixSumValidIndex[0]) {
|
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/
|
|
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
|
}
|
|
@@ -138,9 +138,10 @@ export class TerminalServiceExtImpl implements TerminalServiceExt {
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
$terminalClosed(id: string): void {
|
|
141
|
+
$terminalClosed(id: string, exitStatus: theia.TerminalExitStatus | undefined): void {
|
|
142
142
|
const terminal = this._terminals.get(id);
|
|
143
143
|
if (terminal) {
|
|
144
|
+
terminal.exitStatus = exitStatus ?? { code: undefined };
|
|
144
145
|
this.onDidCloseTerminalEmitter.fire(terminal);
|
|
145
146
|
this._terminals.delete(id);
|
|
146
147
|
}
|
|
@@ -270,7 +271,10 @@ export class TerminalExtImpl implements Terminal {
|
|
|
270
271
|
|
|
271
272
|
readonly id = new Deferred<string>();
|
|
272
273
|
|
|
274
|
+
exitStatus: theia.TerminalExitStatus | undefined;
|
|
275
|
+
|
|
273
276
|
deferredProcessId = new Deferred<number>();
|
|
277
|
+
|
|
274
278
|
get processId(): Thenable<number> {
|
|
275
279
|
return this.deferredProcessId.promise;
|
|
276
280
|
}
|
|
@@ -292,7 +296,6 @@ export class TerminalExtImpl implements Terminal {
|
|
|
292
296
|
dispose(): void {
|
|
293
297
|
this.id.promise.then(id => this.proxy.$dispose(id));
|
|
294
298
|
}
|
|
295
|
-
|
|
296
299
|
}
|
|
297
300
|
|
|
298
301
|
export class PseudoTerminal {
|
package/src/plugin/theming.ts
CHANGED
|
@@ -29,13 +29,13 @@ import { ThemeType } from '@theia/core/lib/browser/theming';
|
|
|
29
29
|
export class ThemingExtImpl implements ThemingExt {
|
|
30
30
|
|
|
31
31
|
private actual: ColorTheme;
|
|
32
|
-
private
|
|
32
|
+
private _onDidChangeActiveColorTheme: Emitter<ColorTheme>;
|
|
33
33
|
|
|
34
34
|
constructor(
|
|
35
35
|
readonly rpc: RPCProtocol
|
|
36
36
|
) {
|
|
37
37
|
this.actual = new ColorTheme(ColorThemeKind.Dark);
|
|
38
|
-
this.
|
|
38
|
+
this._onDidChangeActiveColorTheme = new Emitter<ColorTheme>();
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
get activeColorTheme(): ColorTheme {
|
|
@@ -44,7 +44,7 @@ export class ThemingExtImpl implements ThemingExt {
|
|
|
44
44
|
|
|
45
45
|
$onColorThemeChange(type: ThemeType): void {
|
|
46
46
|
this.actual = new ColorTheme(this.convertKind(type));
|
|
47
|
-
this.
|
|
47
|
+
this._onDidChangeActiveColorTheme.fire(this.actual);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
protected convertKind(type: ThemeType): ColorThemeKind {
|
|
@@ -64,7 +64,7 @@ export class ThemingExtImpl implements ThemingExt {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
get onDidChangeActiveColorTheme(): Event<ColorTheme> {
|
|
67
|
-
return this.
|
|
67
|
+
return this._onDidChangeActiveColorTheme.event;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
}
|