mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 20:26:08 +00:00
Merge pull request #276125 from microsoft/tyriar/276071_termapi
Remove in operator from api/**terminal**
This commit is contained in:
@@ -245,7 +245,6 @@ export default tseslint.config(
|
||||
'src/vs/platform/mcp/common/mcpManagementCli.ts',
|
||||
'src/vs/workbench/api/browser/mainThreadChatSessions.ts',
|
||||
'src/vs/workbench/api/browser/mainThreadDebugService.ts',
|
||||
'src/vs/workbench/api/browser/mainThreadTerminalService.ts',
|
||||
'src/vs/workbench/api/browser/mainThreadTesting.ts',
|
||||
'src/vs/workbench/api/common/extHost.api.impl.ts',
|
||||
'src/vs/workbench/api/common/extHostChatAgents2.ts',
|
||||
@@ -255,7 +254,6 @@ export default tseslint.config(
|
||||
'src/vs/workbench/api/common/extHostQuickOpen.ts',
|
||||
'src/vs/workbench/api/common/extHostRequireInterceptor.ts',
|
||||
'src/vs/workbench/api/common/extHostTelemetry.ts',
|
||||
'src/vs/workbench/api/common/extHostTerminalService.ts',
|
||||
'src/vs/workbench/api/common/extHostTypeConverters.ts',
|
||||
'src/vs/workbench/api/common/extHostTypes.ts',
|
||||
'src/vs/workbench/api/node/loopbackServer.ts',
|
||||
|
||||
@@ -26,6 +26,7 @@ import { ITerminalQuickFixService, ITerminalQuickFix, TerminalQuickFixType } fro
|
||||
import { TerminalCapability } from '../../../platform/terminal/common/capabilities/capabilities.js';
|
||||
import { ITerminalCompletionService } from '../../contrib/terminalContrib/suggest/browser/terminalCompletionService.js';
|
||||
import { IWorkbenchEnvironmentService } from '../../services/environment/common/environmentService.js';
|
||||
import { hasKey } from '../../../base/common/types.js';
|
||||
|
||||
@extHostNamedCustomer(MainContext.MainThreadTerminalService)
|
||||
export class MainThreadTerminalService implements MainThreadTerminalServiceShape {
|
||||
@@ -182,7 +183,7 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
|
||||
}
|
||||
|
||||
private async _deserializeParentTerminal(location?: TerminalLocation | TerminalEditorLocationOptions | { parentTerminal: ExtHostTerminalIdentifier } | { splitActiveTerminal: boolean; location?: TerminalLocation }): Promise<TerminalLocation | TerminalEditorLocationOptions | { parentTerminal: ITerminalInstance } | { splitActiveTerminal: boolean } | undefined> {
|
||||
if (typeof location === 'object' && 'parentTerminal' in location) {
|
||||
if (typeof location === 'object' && hasKey(location, { parentTerminal: true })) {
|
||||
const parentTerminal = await this._extHostTerminals.get(location.parentTerminal.toString());
|
||||
return parentTerminal ? { parentTerminal } : undefined;
|
||||
}
|
||||
@@ -527,10 +528,10 @@ export function getOutputMatchForLines(lines: string[], outputMatcher: ITerminal
|
||||
|
||||
function parseQuickFix(id: string, source: string, fix: TerminalQuickFix): ITerminalQuickFix {
|
||||
let type = TerminalQuickFixType.TerminalCommand;
|
||||
if ('uri' in fix) {
|
||||
if (hasKey(fix, { uri: true })) {
|
||||
fix.uri = URI.revive(fix.uri);
|
||||
type = TerminalQuickFixType.Opener;
|
||||
} else if ('id' in fix) {
|
||||
} else if (hasKey(fix, { id: true })) {
|
||||
type = TerminalQuickFixType.VscodeCommand;
|
||||
}
|
||||
return { id, type, source, ...fix };
|
||||
|
||||
@@ -28,6 +28,7 @@ import { IExtHostCommands } from './extHostCommands.js';
|
||||
import { MarshalledId } from '../../../base/common/marshallingIds.js';
|
||||
import { ISerializedTerminalInstanceContext } from '../../contrib/terminal/common/terminal.js';
|
||||
import { isWindows } from '../../../base/common/platform.js';
|
||||
import { hasKey } from '../../../base/common/types.js';
|
||||
|
||||
export interface IExtHostTerminalService extends ExtHostTerminalServiceShape, IDisposable {
|
||||
|
||||
@@ -218,11 +219,11 @@ export class ExtHostTerminal extends Disposable {
|
||||
|
||||
private _serializeParentTerminal(location?: TerminalLocation | vscode.TerminalEditorLocationOptions | vscode.TerminalSplitLocationOptions, parentTerminal?: ExtHostTerminalIdentifier): TerminalLocation | { viewColumn: EditorGroupColumn; preserveFocus?: boolean } | { parentTerminal: ExtHostTerminalIdentifier } | undefined {
|
||||
if (typeof location === 'object') {
|
||||
if ('parentTerminal' in location && location.parentTerminal && parentTerminal) {
|
||||
if (hasKey(location, { parentTerminal: true }) && location.parentTerminal && parentTerminal) {
|
||||
return { parentTerminal };
|
||||
}
|
||||
|
||||
if ('viewColumn' in location) {
|
||||
if (hasKey(location, { viewColumn: true })) {
|
||||
return { viewColumn: ViewColumn.from(location.viewColumn), preserveFocus: location.preserveFocus };
|
||||
}
|
||||
|
||||
@@ -527,7 +528,7 @@ export abstract class BaseExtHostTerminalService extends Disposable implements I
|
||||
|
||||
protected _serializeParentTerminal(options: vscode.TerminalOptions, internalOptions?: ITerminalInternalOptions): ITerminalInternalOptions {
|
||||
internalOptions = internalOptions ? internalOptions : {};
|
||||
if (options.location && typeof options.location === 'object' && 'parentTerminal' in options.location) {
|
||||
if (options.location && typeof options.location === 'object' && hasKey(options.location, { parentTerminal: true })) {
|
||||
const parentTerminal = options.location.parentTerminal;
|
||||
if (parentTerminal) {
|
||||
const parentExtHostTerminal = this._terminals.find(t => t.value === parentTerminal);
|
||||
@@ -537,7 +538,7 @@ export abstract class BaseExtHostTerminalService extends Disposable implements I
|
||||
}
|
||||
} else if (options.location && typeof options.location !== 'object') {
|
||||
internalOptions.location = options.location;
|
||||
} else if (internalOptions.location && typeof internalOptions.location === 'object' && 'splitActiveTerminal' in internalOptions.location) {
|
||||
} else if (internalOptions.location && typeof internalOptions.location === 'object' && hasKey(internalOptions.location, { splitActiveTerminal: true })) {
|
||||
internalOptions.location = { splitActiveTerminal: true };
|
||||
}
|
||||
return internalOptions;
|
||||
@@ -850,15 +851,15 @@ export abstract class BaseExtHostTerminalService extends Disposable implements I
|
||||
if (token.isCancellationRequested) {
|
||||
return;
|
||||
}
|
||||
if (profile && !('options' in profile)) {
|
||||
if (profile && !hasKey(profile, { options: true })) {
|
||||
profile = { options: profile };
|
||||
}
|
||||
|
||||
if (!profile || !('options' in profile)) {
|
||||
if (!profile || !hasKey(profile, { options: true })) {
|
||||
throw new Error(`No terminal profile options provided for id "${id}"`);
|
||||
}
|
||||
|
||||
if ('pty' in profile.options) {
|
||||
if (hasKey(profile.options, { pty: true })) {
|
||||
this.createExtensionTerminal(profile.options, options);
|
||||
return;
|
||||
}
|
||||
@@ -1270,7 +1271,7 @@ function asTerminalIcon(iconPath?: vscode.Uri | { light: vscode.Uri; dark: vscod
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (!('id' in iconPath)) {
|
||||
if (!hasKey(iconPath, { id: true })) {
|
||||
return iconPath;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user