未验证 提交 9be88790 编写于 作者: M meganrogge

fix #129427

上级 3a1cf8e5
......@@ -632,4 +632,4 @@ export interface IExtensionTerminalProfile extends ITerminalProfileContribution
}
export type ITerminalProfileObject = ITerminalExecutable | ITerminalProfileSource | IExtensionTerminalProfile | null;
export type ITerminalProfileQuickpickObject = ITerminalProfile | IExtensionTerminalProfile;
export type ITerminalProfileType = ITerminalProfile | IExtensionTerminalProfile;
......@@ -8,7 +8,7 @@ import { IDisposable } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri';
import { FindReplaceState } from 'vs/editor/contrib/find/findState';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IShellLaunchConfig, ITerminalChildProcess, ITerminalDimensions, ITerminalLaunchError, ITerminalProfile, ITerminalTabLayoutInfoById, TerminalIcon, TitleEventSource, TerminalShellType, ICreateContributedTerminalProfileOptions, ICreateTerminalOptions, TerminalLocation, IExtensionTerminalProfile } from 'vs/platform/terminal/common/terminal';
import { IShellLaunchConfig, ITerminalChildProcess, ITerminalDimensions, ITerminalLaunchError, ITerminalProfile, ITerminalTabLayoutInfoById, TerminalIcon, TitleEventSource, TerminalShellType, ICreateContributedTerminalProfileOptions, ICreateTerminalOptions, TerminalLocation, IExtensionTerminalProfile, ITerminalProfileType } from 'vs/platform/terminal/common/terminal';
import { ICommandTracker, INavigationMode, IOffProcessTerminalService, IRemoteTerminalAttachTarget, IStartExtensionTerminalRequest, ITerminalConfigHelper, ITerminalProcessExtHostProxy } from 'vs/workbench/contrib/terminal/common/terminal';
import type { Terminal as XTermTerminal } from 'xterm';
import type { SearchAddon as XTermSearchAddon } from 'xterm-addon-search';
......@@ -108,6 +108,7 @@ export interface ITerminalService extends ITerminalInstanceHost {
isProcessSupportRegistered: boolean;
readonly connectionState: TerminalConnectionState;
readonly availableProfiles: ITerminalProfile[];
readonly allProfiles: ITerminalProfileType[] | undefined;
readonly profilesReady: Promise<void>;
initializeTerminals(): Promise<void>;
......
......@@ -165,8 +165,19 @@ export function registerTerminalActions() {
let event: MouseEvent | PointerEvent | KeyboardEvent | undefined;
let options: ICreateTerminalOptions | undefined;
if (typeof eventOrOptionsOrProfile === 'object' && eventOrOptionsOrProfile && 'profileName' in eventOrOptionsOrProfile) {
const config = terminalService.availableProfiles.find(profile => profile.profileName === eventOrOptionsOrProfile.profileName);
if (typeof eventOrOptionsOrProfile === 'object' && eventOrOptionsOrProfile && ('profileName' in eventOrOptionsOrProfile || 'title' in eventOrOptionsOrProfile)) {
const config = terminalService.allProfiles?.find(profile => {
if (profile) {
if ('title' in profile) {
return profile.title === eventOrOptionsOrProfile.profileName;
} else if ('profileName' in profile) {
return profile.profileName === eventOrOptionsOrProfile.profileName;
} else {
return false;
}
}
return false;
});
if (!config) {
throw new Error(`Could not find terminal profile "${eventOrOptionsOrProfile.profileName}"`);
}
......
......@@ -23,7 +23,7 @@ import { ILabelService } from 'vs/platform/label/common/label';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { IKeyMods, IPickOptions, IQuickInputButton, IQuickInputService, IQuickPickItem, IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { ICreateContributedTerminalProfileOptions, ICreateTerminalOptions, IExtensionTerminalProfile, IShellLaunchConfig, ITerminalLaunchError, ITerminalProfile, ITerminalProfileObject, ITerminalsLayoutInfo, ITerminalsLayoutInfoById, TerminalLocation, TerminalSettingId, TerminalSettingPrefix } from 'vs/platform/terminal/common/terminal';
import { ICreateContributedTerminalProfileOptions, ICreateTerminalOptions, IExtensionTerminalProfile, IShellLaunchConfig, ITerminalLaunchError, ITerminalProfile, ITerminalProfileObject, ITerminalProfileType, ITerminalsLayoutInfo, ITerminalsLayoutInfoById, TerminalLocation, TerminalSettingId, TerminalSettingPrefix } from 'vs/platform/terminal/common/terminal';
import { registerTerminalDefaultProfileConfiguration } from 'vs/platform/terminal/common/terminalPlatformConfiguration';
import { iconForeground } from 'vs/platform/theme/common/colorRegistry';
import { IconDefinition } from 'vs/platform/theme/common/iconRegistry';
......@@ -80,6 +80,15 @@ export class TerminalService implements ITerminalService {
this._refreshAvailableProfiles();
return this._availableProfiles || [];
}
get allProfiles(): ITerminalProfileType[] | undefined {
if (this._availableProfiles) {
const profiles: ITerminalProfileType[] = [];
profiles.concat(this._availableProfiles);
profiles.concat(this._terminalContributionService.terminalProfiles);
return profiles;
}
return undefined;
}
get configHelper(): ITerminalConfigHelper { return this._configHelper; }
get instances(): ITerminalInstance[] {
return this._terminalGroupService.instances.concat(this._terminalEditorService.instances);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册