@codingame/monaco-vscode-extensions-service-override 4.1.0 → 4.1.1
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/_virtual/semver.js +3 -0
- package/extensions.js +6 -6
- package/external/vscode-semver/semver.js +985 -0
- package/override/vs/workbench/browser/parts/editor/textEditor.weak.js +8 -0
- package/package.json +9 -9
- package/vscode/src/vs/base/common/console.js +62 -0
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagementCLI.js +497 -0
- package/vscode/src/vs/platform/extensionResourceLoader/browser/extensionResourceLoaderService.js +44 -0
- package/vscode/src/vs/platform/lifecycle/common/lifecycle.js +27 -0
- package/vscode/src/vs/platform/remote/common/managedSocket.js +98 -0
- package/vscode/src/vs/workbench/api/browser/extensionHost.contribution.js +104 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadAiEmbeddingVector.js +31 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadAiRelatedInformation.js +35 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +254 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadBulkEdits.js +68 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadCLICommands.js +103 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChat.js +70 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +207 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatVariables.js +41 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadClipboard.js +24 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadCodeInsets.js +108 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadCommands.js +98 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +560 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadConfiguration.js +80 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadConsole.js +35 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +579 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDebugService.js +435 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDecorations.js +102 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDiagnostics.js +69 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDialogs.js +68 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDocumentContentProviders.js +79 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.js +253 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDocumentsAndEditors.js +370 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDownloadService.js +22 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadEditSessionIdentityParticipant.js +41 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadEditor.js +414 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +501 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadEditors.js +227 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadErrors.js +24 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadExtensionService.js +317 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadFileSystem.js +208 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +369 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadInlineChat.js +72 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadInteractive.js +28 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadIssueReporter.js +50 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLabelService.js +27 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +1016 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.js +185 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguages.js +78 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLocalization.js +35 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLogService.js +78 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadManagedSockets.js +93 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadMessageService.js +137 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +194 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.js +123 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.js +188 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDto.js +129 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.js +131 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +374 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.js +25 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +48 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadOutputService.js +76 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadProfileContentHandlers.js +38 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadProgress.js +68 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadQuickDiff.js +42 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadQuickOpen.js +185 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadRemoteConnectionData.js +30 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadSCM.js +493 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js +49 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadSearch.js +168 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadSecretState.js +70 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadShare.js +50 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadSpeech.js +99 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadStatusBar.js +53 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadStorage.js +72 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +731 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTelemetry.js +53 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +409 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTerminalShellIntegration.js +51 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTesting.js +219 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTheming.js +24 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTimeline.js +55 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.js +312 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTunnelService.js +223 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadUriOpeners.js +110 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadUrls.js +61 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviewManager.js +29 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviewPanels.js +283 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviewViews.js +100 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviews.js +135 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadWindow.js +57 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +268 -0
- package/vscode/src/vs/workbench/api/common/shared/dataTransferCache.js +35 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/customTextEditorModel.js +76 -0
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/contributedOpeners.js +83 -0
- package/vscode/src/vs/workbench/services/extensions/browser/extensionService.js +285 -0
- package/vscode/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.js +276 -0
- package/vscode/src/vs/workbench/services/extensions/browser/webWorkerFileSystemProvider.js +52 -0
- package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +1149 -0
- package/vscode/src/vs/workbench/services/extensions/common/extHostCustomers.js +41 -0
- package/vscode/src/vs/workbench/services/extensions/common/extensionDevOptions.js +25 -0
- package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +512 -0
- package/vscode/src/vs/workbench/services/extensions/common/extensionRunningLocationTracker.js +274 -0
- package/vscode/src/vs/workbench/services/extensions/common/extensionStorageMigration.js +58 -0
- package/vscode/src/vs/workbench/services/extensions/common/extensionsProposedApi.js +80 -0
- package/vscode/src/vs/workbench/services/extensions/common/extensionsUtil.js +64 -0
- package/vscode/src/vs/workbench/services/extensions/common/lazyCreateExtensionHostManager.js +161 -0
- package/vscode/src/vs/workbench/services/extensions/common/remoteConsoleUtil.js +49 -0
- package/vscode/src/vs/workbench/services/extensions/common/remoteExtensionHost.js +222 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
4
|
+
import { IEnvironmentService } from 'vscode/vscode/vs/platform/environment/common/environment';
|
|
5
|
+
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService';
|
|
6
|
+
import { TELEMETRY_SETTING_ID, TELEMETRY_OLD_SETTING_ID, ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
7
|
+
import { supportsTelemetry } from 'vscode/vscode/vs/platform/telemetry/common/telemetryUtils';
|
|
8
|
+
import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
|
|
9
|
+
import { ExtHostContext, MainContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
|
|
10
|
+
|
|
11
|
+
var MainThreadTelemetry_1;
|
|
12
|
+
let MainThreadTelemetry = class MainThreadTelemetry extends Disposable {
|
|
13
|
+
static { MainThreadTelemetry_1 = this; }
|
|
14
|
+
static { this._name = 'pluginHostTelemetry'; }
|
|
15
|
+
constructor(extHostContext, _telemetryService, _configurationService, _environmentService, _productService) {
|
|
16
|
+
super();
|
|
17
|
+
this._telemetryService = _telemetryService;
|
|
18
|
+
this._configurationService = _configurationService;
|
|
19
|
+
this._environmentService = _environmentService;
|
|
20
|
+
this._productService = _productService;
|
|
21
|
+
this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostTelemetry));
|
|
22
|
+
if (supportsTelemetry(this._productService, this._environmentService)) {
|
|
23
|
+
this._register(this._configurationService.onDidChangeConfiguration(e => {
|
|
24
|
+
if (e.affectsConfiguration(TELEMETRY_SETTING_ID) || e.affectsConfiguration(TELEMETRY_OLD_SETTING_ID)) {
|
|
25
|
+
this._proxy.$onDidChangeTelemetryLevel(this.telemetryLevel);
|
|
26
|
+
}
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
this._proxy.$initializeTelemetryLevel(this.telemetryLevel, supportsTelemetry(this._productService, this._environmentService), this._productService.enabledTelemetryLevels);
|
|
30
|
+
}
|
|
31
|
+
get telemetryLevel() {
|
|
32
|
+
if (!supportsTelemetry(this._productService, this._environmentService)) {
|
|
33
|
+
return 0 ;
|
|
34
|
+
}
|
|
35
|
+
return this._telemetryService.telemetryLevel;
|
|
36
|
+
}
|
|
37
|
+
$publicLog(eventName, data = Object.create(null)) {
|
|
38
|
+
data[MainThreadTelemetry_1._name] = true;
|
|
39
|
+
this._telemetryService.publicLog(eventName, data);
|
|
40
|
+
}
|
|
41
|
+
$publicLog2(eventName, data) {
|
|
42
|
+
this.$publicLog(eventName, data);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
MainThreadTelemetry = MainThreadTelemetry_1 = __decorate([
|
|
46
|
+
extHostNamedCustomer(MainContext.MainThreadTelemetry),
|
|
47
|
+
( __param(1, ITelemetryService)),
|
|
48
|
+
( __param(2, IConfigurationService)),
|
|
49
|
+
( __param(3, IEnvironmentService)),
|
|
50
|
+
( __param(4, IProductService))
|
|
51
|
+
], MainThreadTelemetry);
|
|
52
|
+
|
|
53
|
+
export { MainThreadTelemetry };
|
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { DisposableStore, MutableDisposable, combinedDisposable, Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
|
+
import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
|
|
4
|
+
import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
|
|
5
|
+
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
6
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
7
|
+
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
8
|
+
import { TerminalLocation, TerminalExitReason } from 'vscode/vscode/vs/platform/terminal/common/terminal';
|
|
9
|
+
import { TerminalDataBufferer } from 'vscode/vscode/vs/platform/terminal/common/terminalDataBuffering';
|
|
10
|
+
import { ITerminalService, ITerminalGroupService, ITerminalEditorService } from 'vscode/vscode/vs/workbench/contrib/terminal/browser/terminal';
|
|
11
|
+
import { TerminalProcessExtHostProxy } from 'vscode/vscode/vs/workbench/contrib/terminal/browser/terminalProcessExtHostProxy';
|
|
12
|
+
import { IEnvironmentVariableService } from 'vscode/vscode/vs/workbench/contrib/terminal/common/environmentVariable';
|
|
13
|
+
import { serializeEnvironmentVariableCollection, deserializeEnvironmentVariableCollection, deserializeEnvironmentDescriptionMap } from 'vscode/vscode/vs/platform/terminal/common/environmentVariableShared';
|
|
14
|
+
import { ITerminalProfileResolverService, ITerminalProfileService } from 'vscode/vscode/vs/workbench/contrib/terminal/common/terminal';
|
|
15
|
+
import { IRemoteAgentService } from 'vscode/vscode/vs/workbench/services/remote/common/remoteAgentService';
|
|
16
|
+
import { OS } from 'vscode/vscode/vs/base/common/platform';
|
|
17
|
+
import { Promises } from 'vscode/vscode/vs/base/common/async';
|
|
18
|
+
import { ITerminalLinkProviderService } from 'vscode/vscode/vs/workbench/contrib/terminalContrib/links/browser/links';
|
|
19
|
+
import { ITerminalQuickFixService, TerminalQuickFixType } from 'vscode/vscode/vs/workbench/contrib/terminalContrib/quickFix/browser/quickFix';
|
|
20
|
+
|
|
21
|
+
let MainThreadTerminalService = class MainThreadTerminalService {
|
|
22
|
+
constructor(_extHostContext, _terminalService, _terminalLinkProviderService, _terminalQuickFixService, _instantiationService, _environmentVariableService, _logService, _terminalProfileResolverService, remoteAgentService, _terminalGroupService, _terminalEditorService, _terminalProfileService) {
|
|
23
|
+
this._extHostContext = _extHostContext;
|
|
24
|
+
this._terminalService = _terminalService;
|
|
25
|
+
this._terminalLinkProviderService = _terminalLinkProviderService;
|
|
26
|
+
this._terminalQuickFixService = _terminalQuickFixService;
|
|
27
|
+
this._instantiationService = _instantiationService;
|
|
28
|
+
this._environmentVariableService = _environmentVariableService;
|
|
29
|
+
this._logService = _logService;
|
|
30
|
+
this._terminalProfileResolverService = _terminalProfileResolverService;
|
|
31
|
+
this._terminalGroupService = _terminalGroupService;
|
|
32
|
+
this._terminalEditorService = _terminalEditorService;
|
|
33
|
+
this._terminalProfileService = _terminalProfileService;
|
|
34
|
+
this._store = ( new DisposableStore());
|
|
35
|
+
this._extHostTerminals = ( new Map());
|
|
36
|
+
this._terminalProcessProxies = ( new Map());
|
|
37
|
+
this._profileProviders = ( new Map());
|
|
38
|
+
this._quickFixProviders = ( new Map());
|
|
39
|
+
this._dataEventTracker = ( new MutableDisposable());
|
|
40
|
+
this._sendCommandEventListener = ( new MutableDisposable());
|
|
41
|
+
this._linkProvider = this._store.add(( new MutableDisposable()));
|
|
42
|
+
this._os = OS;
|
|
43
|
+
this._proxy = ( _extHostContext.getProxy(ExtHostContext.ExtHostTerminalService));
|
|
44
|
+
this._store.add(_terminalService.onDidCreateInstance((instance) => {
|
|
45
|
+
this._onTerminalOpened(instance);
|
|
46
|
+
this._onInstanceDimensionsChanged(instance);
|
|
47
|
+
}));
|
|
48
|
+
this._store.add(_terminalService.onDidDisposeInstance(instance => this._onTerminalDisposed(instance)));
|
|
49
|
+
this._store.add(_terminalService.onAnyInstanceProcessIdReady(instance => this._onTerminalProcessIdReady(instance)));
|
|
50
|
+
this._store.add(_terminalService.onDidChangeInstanceDimensions(instance => this._onInstanceDimensionsChanged(instance)));
|
|
51
|
+
this._store.add(_terminalService.onAnyInstanceMaximumDimensionsChange(instance => this._onInstanceMaximumDimensionsChanged(instance)));
|
|
52
|
+
this._store.add(_terminalService.onDidRequestStartExtensionTerminal(e => this._onRequestStartExtensionTerminal(e)));
|
|
53
|
+
this._store.add(_terminalService.onDidChangeActiveInstance(instance => this._onActiveTerminalChanged(instance ? instance.instanceId : null)));
|
|
54
|
+
this._store.add(_terminalService.onAnyInstanceTitleChange(instance => instance && this._onTitleChanged(instance.instanceId, instance.title)));
|
|
55
|
+
this._store.add(_terminalService.onAnyInstanceDataInput(instance => this._proxy.$acceptTerminalInteraction(instance.instanceId)));
|
|
56
|
+
this._store.add(_terminalService.onAnyInstanceSelectionChange(instance => this._proxy.$acceptTerminalSelection(instance.instanceId, instance.selection)));
|
|
57
|
+
for (const instance of this._terminalService.instances) {
|
|
58
|
+
this._onTerminalOpened(instance);
|
|
59
|
+
instance.processReady.then(() => this._onTerminalProcessIdReady(instance));
|
|
60
|
+
}
|
|
61
|
+
const activeInstance = this._terminalService.activeInstance;
|
|
62
|
+
if (activeInstance) {
|
|
63
|
+
this._proxy.$acceptActiveTerminalChanged(activeInstance.instanceId);
|
|
64
|
+
}
|
|
65
|
+
if (this._environmentVariableService.collections.size > 0) {
|
|
66
|
+
const collectionAsArray = [...this._environmentVariableService.collections.entries()];
|
|
67
|
+
const serializedCollections = ( collectionAsArray.map(e => {
|
|
68
|
+
return [e[0], serializeEnvironmentVariableCollection(e[1].map)];
|
|
69
|
+
}));
|
|
70
|
+
this._proxy.$initEnvironmentVariableCollections(serializedCollections);
|
|
71
|
+
}
|
|
72
|
+
remoteAgentService.getEnvironment().then(async (env) => {
|
|
73
|
+
this._os = env?.os || OS;
|
|
74
|
+
this._updateDefaultProfile();
|
|
75
|
+
});
|
|
76
|
+
this._store.add(this._terminalProfileService.onDidChangeAvailableProfiles(() => this._updateDefaultProfile()));
|
|
77
|
+
}
|
|
78
|
+
dispose() {
|
|
79
|
+
this._store.dispose();
|
|
80
|
+
for (const provider of ( this._profileProviders.values())) {
|
|
81
|
+
provider.dispose();
|
|
82
|
+
}
|
|
83
|
+
for (const provider of ( this._quickFixProviders.values())) {
|
|
84
|
+
provider.dispose();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
async _updateDefaultProfile() {
|
|
88
|
+
const remoteAuthority = this._extHostContext.remoteAuthority ?? undefined;
|
|
89
|
+
const defaultProfile = this._terminalProfileResolverService.getDefaultProfile({ remoteAuthority, os: this._os });
|
|
90
|
+
const defaultAutomationProfile = this._terminalProfileResolverService.getDefaultProfile({ remoteAuthority, os: this._os, allowAutomationShell: true });
|
|
91
|
+
this._proxy.$acceptDefaultProfile(...(await Promise.all([defaultProfile, defaultAutomationProfile])));
|
|
92
|
+
}
|
|
93
|
+
async _getTerminalInstance(id) {
|
|
94
|
+
if (typeof id === 'string') {
|
|
95
|
+
return this._extHostTerminals.get(id);
|
|
96
|
+
}
|
|
97
|
+
return this._terminalService.getInstanceFromId(id);
|
|
98
|
+
}
|
|
99
|
+
async $createTerminal(extHostTerminalId, launchConfig) {
|
|
100
|
+
const shellLaunchConfig = {
|
|
101
|
+
name: launchConfig.name,
|
|
102
|
+
executable: launchConfig.shellPath,
|
|
103
|
+
args: launchConfig.shellArgs,
|
|
104
|
+
cwd: typeof launchConfig.cwd === 'string' ? launchConfig.cwd : URI.revive(launchConfig.cwd),
|
|
105
|
+
icon: launchConfig.icon,
|
|
106
|
+
color: launchConfig.color,
|
|
107
|
+
initialText: launchConfig.initialText,
|
|
108
|
+
waitOnExit: launchConfig.waitOnExit,
|
|
109
|
+
ignoreConfigurationCwd: true,
|
|
110
|
+
env: launchConfig.env,
|
|
111
|
+
strictEnv: launchConfig.strictEnv,
|
|
112
|
+
hideFromUser: launchConfig.hideFromUser,
|
|
113
|
+
customPtyImplementation: launchConfig.isExtensionCustomPtyTerminal
|
|
114
|
+
? (id, cols, rows) => ( new TerminalProcessExtHostProxy(id, cols, rows, this._terminalService))
|
|
115
|
+
: undefined,
|
|
116
|
+
extHostTerminalId,
|
|
117
|
+
forceShellIntegration: launchConfig.forceShellIntegration,
|
|
118
|
+
isFeatureTerminal: launchConfig.isFeatureTerminal,
|
|
119
|
+
isExtensionOwnedTerminal: launchConfig.isExtensionOwnedTerminal,
|
|
120
|
+
useShellEnvironment: launchConfig.useShellEnvironment,
|
|
121
|
+
isTransient: launchConfig.isTransient
|
|
122
|
+
};
|
|
123
|
+
const terminal = Promises.withAsyncBody(async (r) => {
|
|
124
|
+
const terminal = await this._terminalService.createTerminal({
|
|
125
|
+
config: shellLaunchConfig,
|
|
126
|
+
location: await this._deserializeParentTerminal(launchConfig.location)
|
|
127
|
+
});
|
|
128
|
+
r(terminal);
|
|
129
|
+
});
|
|
130
|
+
this._extHostTerminals.set(extHostTerminalId, terminal);
|
|
131
|
+
const terminalInstance = await terminal;
|
|
132
|
+
this._store.add(terminalInstance.onDisposed(() => {
|
|
133
|
+
this._extHostTerminals.delete(extHostTerminalId);
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
async _deserializeParentTerminal(location) {
|
|
137
|
+
if (typeof location === 'object' && 'parentTerminal' in location) {
|
|
138
|
+
const parentTerminal = await this._extHostTerminals.get(( location.parentTerminal.toString()));
|
|
139
|
+
return parentTerminal ? { parentTerminal } : undefined;
|
|
140
|
+
}
|
|
141
|
+
return location;
|
|
142
|
+
}
|
|
143
|
+
async $show(id, preserveFocus) {
|
|
144
|
+
const terminalInstance = await this._getTerminalInstance(id);
|
|
145
|
+
if (terminalInstance) {
|
|
146
|
+
this._terminalService.setActiveInstance(terminalInstance);
|
|
147
|
+
if (terminalInstance.target === TerminalLocation.Editor) {
|
|
148
|
+
await this._terminalEditorService.revealActiveEditor(preserveFocus);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
await this._terminalGroupService.showPanel(!preserveFocus);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
async $hide(id) {
|
|
156
|
+
const instanceToHide = await this._getTerminalInstance(id);
|
|
157
|
+
const activeInstance = this._terminalService.activeInstance;
|
|
158
|
+
if (activeInstance && activeInstance.instanceId === instanceToHide?.instanceId && activeInstance.target !== TerminalLocation.Editor) {
|
|
159
|
+
this._terminalGroupService.hidePanel();
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
async $dispose(id) {
|
|
163
|
+
(await this._getTerminalInstance(id))?.dispose(TerminalExitReason.Extension);
|
|
164
|
+
}
|
|
165
|
+
async $sendText(id, text, shouldExecute) {
|
|
166
|
+
const instance = await this._getTerminalInstance(id);
|
|
167
|
+
await instance?.sendText(text, shouldExecute);
|
|
168
|
+
}
|
|
169
|
+
$sendProcessExit(terminalId, exitCode) {
|
|
170
|
+
this._terminalProcessProxies.get(terminalId)?.emitExit(exitCode);
|
|
171
|
+
}
|
|
172
|
+
$startSendingDataEvents() {
|
|
173
|
+
if (!this._dataEventTracker.value) {
|
|
174
|
+
this._dataEventTracker.value = this._instantiationService.createInstance(TerminalDataEventTracker, (id, data) => {
|
|
175
|
+
this._onTerminalData(id, data);
|
|
176
|
+
});
|
|
177
|
+
for (const instance of this._terminalService.instances) {
|
|
178
|
+
for (const data of instance.initialDataEvents || []) {
|
|
179
|
+
this._onTerminalData(instance.instanceId, data);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
$stopSendingDataEvents() {
|
|
185
|
+
this._dataEventTracker.clear();
|
|
186
|
+
}
|
|
187
|
+
$startSendingCommandEvents() {
|
|
188
|
+
if (this._sendCommandEventListener.value) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const multiplexer = this._terminalService.createOnInstanceCapabilityEvent(2 , capability => capability.onCommandFinished);
|
|
192
|
+
const sub = multiplexer.event(e => {
|
|
193
|
+
this._onDidExecuteCommand(e.instance.instanceId, {
|
|
194
|
+
commandLine: e.data.command,
|
|
195
|
+
cwd: e.data.cwd,
|
|
196
|
+
exitCode: e.data.exitCode,
|
|
197
|
+
output: e.data.getOutput()
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
this._sendCommandEventListener.value = combinedDisposable(multiplexer, sub);
|
|
201
|
+
}
|
|
202
|
+
$stopSendingCommandEvents() {
|
|
203
|
+
this._sendCommandEventListener.clear();
|
|
204
|
+
}
|
|
205
|
+
$startLinkProvider() {
|
|
206
|
+
this._linkProvider.value = this._terminalLinkProviderService.registerLinkProvider(( new ExtensionTerminalLinkProvider(this._proxy)));
|
|
207
|
+
}
|
|
208
|
+
$stopLinkProvider() {
|
|
209
|
+
this._linkProvider.clear();
|
|
210
|
+
}
|
|
211
|
+
$registerProcessSupport(isSupported) {
|
|
212
|
+
this._terminalService.registerProcessSupport(isSupported);
|
|
213
|
+
}
|
|
214
|
+
$registerProfileProvider(id, extensionIdentifier) {
|
|
215
|
+
this._profileProviders.set(id, this._terminalProfileService.registerTerminalProfileProvider(extensionIdentifier, id, {
|
|
216
|
+
createContributedTerminalProfile: async (options) => {
|
|
217
|
+
return this._proxy.$createContributedProfileTerminal(id, options);
|
|
218
|
+
}
|
|
219
|
+
}));
|
|
220
|
+
}
|
|
221
|
+
$unregisterProfileProvider(id) {
|
|
222
|
+
this._profileProviders.get(id)?.dispose();
|
|
223
|
+
this._profileProviders.delete(id);
|
|
224
|
+
}
|
|
225
|
+
async $registerQuickFixProvider(id, extensionId) {
|
|
226
|
+
this._quickFixProviders.set(id, this._terminalQuickFixService.registerQuickFixProvider(id, {
|
|
227
|
+
provideTerminalQuickFixes: async (terminalCommand, lines, options, token) => {
|
|
228
|
+
if (token.isCancellationRequested) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
if (options.outputMatcher?.length && options.outputMatcher.length > 40) {
|
|
232
|
+
options.outputMatcher.length = 40;
|
|
233
|
+
this._logService.warn('Cannot exceed output matcher length of 40');
|
|
234
|
+
}
|
|
235
|
+
const commandLineMatch = terminalCommand.command.match(options.commandLineMatcher);
|
|
236
|
+
if (!commandLineMatch || !lines) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
const outputMatcher = options.outputMatcher;
|
|
240
|
+
let outputMatch;
|
|
241
|
+
if (outputMatcher) {
|
|
242
|
+
outputMatch = getOutputMatchForLines(lines, outputMatcher);
|
|
243
|
+
}
|
|
244
|
+
if (!outputMatch) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const matchResult = { commandLineMatch, outputMatch, commandLine: terminalCommand.command };
|
|
248
|
+
if (matchResult) {
|
|
249
|
+
const result = await this._proxy.$provideTerminalQuickFixes(id, matchResult, token);
|
|
250
|
+
if (result && Array.isArray(result)) {
|
|
251
|
+
return ( result.map(r => parseQuickFix(id, extensionId, r)));
|
|
252
|
+
}
|
|
253
|
+
else if (result) {
|
|
254
|
+
return parseQuickFix(id, extensionId, result);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
}));
|
|
260
|
+
}
|
|
261
|
+
$unregisterQuickFixProvider(id) {
|
|
262
|
+
this._quickFixProviders.get(id)?.dispose();
|
|
263
|
+
this._quickFixProviders.delete(id);
|
|
264
|
+
}
|
|
265
|
+
_onActiveTerminalChanged(terminalId) {
|
|
266
|
+
this._proxy.$acceptActiveTerminalChanged(terminalId);
|
|
267
|
+
}
|
|
268
|
+
_onTerminalData(terminalId, data) {
|
|
269
|
+
this._proxy.$acceptTerminalProcessData(terminalId, data);
|
|
270
|
+
}
|
|
271
|
+
_onDidExecuteCommand(terminalId, command) {
|
|
272
|
+
this._proxy.$acceptDidExecuteCommand(terminalId, command);
|
|
273
|
+
}
|
|
274
|
+
_onTitleChanged(terminalId, name) {
|
|
275
|
+
this._proxy.$acceptTerminalTitleChange(terminalId, name);
|
|
276
|
+
}
|
|
277
|
+
_onTerminalDisposed(terminalInstance) {
|
|
278
|
+
this._proxy.$acceptTerminalClosed(terminalInstance.instanceId, terminalInstance.exitCode, terminalInstance.exitReason ?? TerminalExitReason.Unknown);
|
|
279
|
+
}
|
|
280
|
+
_onTerminalOpened(terminalInstance) {
|
|
281
|
+
const extHostTerminalId = terminalInstance.shellLaunchConfig.extHostTerminalId;
|
|
282
|
+
const shellLaunchConfigDto = {
|
|
283
|
+
name: terminalInstance.shellLaunchConfig.name,
|
|
284
|
+
executable: terminalInstance.shellLaunchConfig.executable,
|
|
285
|
+
args: terminalInstance.shellLaunchConfig.args,
|
|
286
|
+
cwd: terminalInstance.shellLaunchConfig.cwd,
|
|
287
|
+
env: terminalInstance.shellLaunchConfig.env,
|
|
288
|
+
hideFromUser: terminalInstance.shellLaunchConfig.hideFromUser
|
|
289
|
+
};
|
|
290
|
+
this._proxy.$acceptTerminalOpened(terminalInstance.instanceId, extHostTerminalId, terminalInstance.title, shellLaunchConfigDto);
|
|
291
|
+
}
|
|
292
|
+
_onTerminalProcessIdReady(terminalInstance) {
|
|
293
|
+
if (terminalInstance.processId === undefined) {
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
this._proxy.$acceptTerminalProcessId(terminalInstance.instanceId, terminalInstance.processId);
|
|
297
|
+
}
|
|
298
|
+
_onInstanceDimensionsChanged(instance) {
|
|
299
|
+
this._proxy.$acceptTerminalDimensions(instance.instanceId, instance.cols, instance.rows);
|
|
300
|
+
}
|
|
301
|
+
_onInstanceMaximumDimensionsChanged(instance) {
|
|
302
|
+
this._proxy.$acceptTerminalMaximumDimensions(instance.instanceId, instance.maxCols, instance.maxRows);
|
|
303
|
+
}
|
|
304
|
+
_onRequestStartExtensionTerminal(request) {
|
|
305
|
+
const proxy = request.proxy;
|
|
306
|
+
this._terminalProcessProxies.set(proxy.instanceId, proxy);
|
|
307
|
+
const initialDimensions = request.cols && request.rows ? {
|
|
308
|
+
columns: request.cols,
|
|
309
|
+
rows: request.rows
|
|
310
|
+
} : undefined;
|
|
311
|
+
this._proxy.$startExtensionTerminal(proxy.instanceId, initialDimensions).then(request.callback);
|
|
312
|
+
proxy.onInput(data => this._proxy.$acceptProcessInput(proxy.instanceId, data));
|
|
313
|
+
proxy.onShutdown(immediate => this._proxy.$acceptProcessShutdown(proxy.instanceId, immediate));
|
|
314
|
+
proxy.onRequestCwd(() => this._proxy.$acceptProcessRequestCwd(proxy.instanceId));
|
|
315
|
+
proxy.onRequestInitialCwd(() => this._proxy.$acceptProcessRequestInitialCwd(proxy.instanceId));
|
|
316
|
+
}
|
|
317
|
+
$sendProcessData(terminalId, data) {
|
|
318
|
+
this._terminalProcessProxies.get(terminalId)?.emitData(data);
|
|
319
|
+
}
|
|
320
|
+
$sendProcessReady(terminalId, pid, cwd, windowsPty) {
|
|
321
|
+
this._terminalProcessProxies.get(terminalId)?.emitReady(pid, cwd, windowsPty);
|
|
322
|
+
}
|
|
323
|
+
$sendProcessProperty(terminalId, property) {
|
|
324
|
+
if (property.type === "title" ) {
|
|
325
|
+
const instance = this._terminalService.getInstanceFromId(terminalId);
|
|
326
|
+
instance?.rename(property.value);
|
|
327
|
+
}
|
|
328
|
+
this._terminalProcessProxies.get(terminalId)?.emitProcessProperty(property);
|
|
329
|
+
}
|
|
330
|
+
$setEnvironmentVariableCollection(extensionIdentifier, persistent, collection, descriptionMap) {
|
|
331
|
+
if (collection) {
|
|
332
|
+
const translatedCollection = {
|
|
333
|
+
persistent,
|
|
334
|
+
map: deserializeEnvironmentVariableCollection(collection),
|
|
335
|
+
descriptionMap: deserializeEnvironmentDescriptionMap(descriptionMap)
|
|
336
|
+
};
|
|
337
|
+
this._environmentVariableService.set(extensionIdentifier, translatedCollection);
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
this._environmentVariableService.delete(extensionIdentifier);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
MainThreadTerminalService = __decorate([
|
|
345
|
+
extHostNamedCustomer(MainContext.MainThreadTerminalService),
|
|
346
|
+
( __param(1, ITerminalService)),
|
|
347
|
+
( __param(2, ITerminalLinkProviderService)),
|
|
348
|
+
( __param(3, ITerminalQuickFixService)),
|
|
349
|
+
( __param(4, IInstantiationService)),
|
|
350
|
+
( __param(5, IEnvironmentVariableService)),
|
|
351
|
+
( __param(6, ILogService)),
|
|
352
|
+
( __param(7, ITerminalProfileResolverService)),
|
|
353
|
+
( __param(8, IRemoteAgentService)),
|
|
354
|
+
( __param(9, ITerminalGroupService)),
|
|
355
|
+
( __param(10, ITerminalEditorService)),
|
|
356
|
+
( __param(11, ITerminalProfileService))
|
|
357
|
+
], MainThreadTerminalService);
|
|
358
|
+
let TerminalDataEventTracker = class TerminalDataEventTracker extends Disposable {
|
|
359
|
+
constructor(_callback, _terminalService) {
|
|
360
|
+
super();
|
|
361
|
+
this._callback = _callback;
|
|
362
|
+
this._terminalService = _terminalService;
|
|
363
|
+
this._register(this._bufferer = ( new TerminalDataBufferer(this._callback)));
|
|
364
|
+
for (const instance of this._terminalService.instances) {
|
|
365
|
+
this._registerInstance(instance);
|
|
366
|
+
}
|
|
367
|
+
this._register(this._terminalService.onDidCreateInstance(instance => this._registerInstance(instance)));
|
|
368
|
+
this._register(this._terminalService.onDidDisposeInstance(instance => this._bufferer.stopBuffering(instance.instanceId)));
|
|
369
|
+
}
|
|
370
|
+
_registerInstance(instance) {
|
|
371
|
+
this._register(this._bufferer.startBuffering(instance.instanceId, instance.onData));
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
TerminalDataEventTracker = ( __decorate([
|
|
375
|
+
( __param(1, ITerminalService))
|
|
376
|
+
], TerminalDataEventTracker));
|
|
377
|
+
class ExtensionTerminalLinkProvider {
|
|
378
|
+
constructor(_proxy) {
|
|
379
|
+
this._proxy = _proxy;
|
|
380
|
+
}
|
|
381
|
+
async provideLinks(instance, line) {
|
|
382
|
+
const proxy = this._proxy;
|
|
383
|
+
const extHostLinks = await proxy.$provideLinks(instance.instanceId, line);
|
|
384
|
+
return ( extHostLinks.map(dto => ({
|
|
385
|
+
id: dto.id,
|
|
386
|
+
startIndex: dto.startIndex,
|
|
387
|
+
length: dto.length,
|
|
388
|
+
label: dto.label,
|
|
389
|
+
activate: () => proxy.$activateLink(instance.instanceId, dto.id)
|
|
390
|
+
})));
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
function getOutputMatchForLines(lines, outputMatcher) {
|
|
394
|
+
const match = lines.join('\n').match(outputMatcher.lineMatcher);
|
|
395
|
+
return match ? { regexMatch: match, outputLines: lines } : undefined;
|
|
396
|
+
}
|
|
397
|
+
function parseQuickFix(id, source, fix) {
|
|
398
|
+
let type = TerminalQuickFixType.TerminalCommand;
|
|
399
|
+
if ('uri' in fix) {
|
|
400
|
+
fix.uri = URI.revive(fix.uri);
|
|
401
|
+
type = TerminalQuickFixType.Opener;
|
|
402
|
+
}
|
|
403
|
+
else if ('id' in fix) {
|
|
404
|
+
type = TerminalQuickFixType.VscodeCommand;
|
|
405
|
+
}
|
|
406
|
+
return { id, type, source, ...fix };
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export { MainThreadTerminalService, getOutputMatchForLines };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
3
|
+
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
|
|
5
|
+
import { ITerminalService } from 'vscode/vscode/vs/workbench/contrib/terminal/browser/terminal';
|
|
6
|
+
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
|
|
7
|
+
import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
|
|
8
|
+
|
|
9
|
+
let MainThreadTerminalShellIntegration = class MainThreadTerminalShellIntegration extends Disposable {
|
|
10
|
+
constructor(extHostContext, _terminalService, workbenchEnvironmentService) {
|
|
11
|
+
super();
|
|
12
|
+
this._terminalService = _terminalService;
|
|
13
|
+
this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostTerminalShellIntegration));
|
|
14
|
+
const onDidAddCommandDetection = this._terminalService.createOnInstanceEvent(instance => {
|
|
15
|
+
return ( Event.map(Event.filter(instance.capabilities.onDidAddCapabilityType, e => {
|
|
16
|
+
return e === 2 ;
|
|
17
|
+
}, this._store), () => instance));
|
|
18
|
+
});
|
|
19
|
+
this._store.add(onDidAddCommandDetection(e => this._proxy.$shellIntegrationChange(e.instanceId)));
|
|
20
|
+
const commandDetectionStartEvent = this._store.add(this._terminalService.createOnInstanceCapabilityEvent(2 , e => e.onCommandExecuted));
|
|
21
|
+
let currentCommand;
|
|
22
|
+
this._store.add(commandDetectionStartEvent.event(e => {
|
|
23
|
+
if (e.data === currentCommand) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
currentCommand = e.data;
|
|
27
|
+
this._proxy.$shellExecutionStart(e.instance.instanceId, e.data.command, e.data.cwd);
|
|
28
|
+
}));
|
|
29
|
+
const commandDetectionEndEvent = this._store.add(this._terminalService.createOnInstanceCapabilityEvent(2 , e => e.onCommandFinished));
|
|
30
|
+
this._store.add(commandDetectionEndEvent.event(e => {
|
|
31
|
+
currentCommand = undefined;
|
|
32
|
+
this._proxy.$shellExecutionEnd(e.instance.instanceId, e.data.command, e.data.exitCode);
|
|
33
|
+
}));
|
|
34
|
+
const cwdChangeEvent = this._store.add(this._terminalService.createOnInstanceCapabilityEvent(0 , e => e.onDidChangeCwd));
|
|
35
|
+
this._store.add(cwdChangeEvent.event(e => this._proxy.$cwdChange(e.instance.instanceId, e.data)));
|
|
36
|
+
this._store.add(this._terminalService.onDidDisposeInstance(e => this._proxy.$closeTerminal(e.instanceId)));
|
|
37
|
+
if (!workbenchEnvironmentService.remoteAuthority) {
|
|
38
|
+
this._store.add(this._terminalService.onAnyInstanceData(e => this._proxy.$shellExecutionData(e.instance.instanceId, e.data)));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
$executeCommand(terminalId, commandLine) {
|
|
42
|
+
this._terminalService.getInstanceFromId(terminalId)?.runCommand(commandLine, true);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
MainThreadTerminalShellIntegration = __decorate([
|
|
46
|
+
extHostNamedCustomer(MainContext.MainThreadTerminalShellIntegration),
|
|
47
|
+
( __param(1, ITerminalService)),
|
|
48
|
+
( __param(2, IWorkbenchEnvironmentService))
|
|
49
|
+
], MainThreadTerminalShellIntegration);
|
|
50
|
+
|
|
51
|
+
export { MainThreadTerminalShellIntegration };
|