diff --git a/src/vs/workbench/api/browser/mainThreadTerminalService.ts b/src/vs/workbench/api/browser/mainThreadTerminalService.ts index daab5df909d..295cafe4de0 100644 --- a/src/vs/workbench/api/browser/mainThreadTerminalService.ts +++ b/src/vs/workbench/api/browser/mainThreadTerminalService.ts @@ -20,10 +20,9 @@ import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteA import { OperatingSystem, OS } from 'vs/base/common/platform'; import { TerminalEditorLocationOptions } from 'vscode'; import { Promises } from 'vs/base/common/async'; -import { TerminalQuickFixType } from 'vs/workbench/api/common/extHostTypes'; import { ISerializableEnvironmentDescriptionMap, ISerializableEnvironmentVariableCollection } from 'vs/platform/terminal/common/environmentVariable'; import { ITerminalLinkProviderService } from 'vs/workbench/contrib/terminalContrib/links/browser/links'; -import { ITerminalQuickFixService, ITerminalQuickFix } from 'vs/workbench/contrib/terminalContrib/quickFix/browser/quickFix'; +import { ITerminalQuickFixService, ITerminalQuickFix, TerminalQuickFixType } from 'vs/workbench/contrib/terminalContrib/quickFix/browser/quickFix'; @extHostNamedCustomer(MainContext.MainThreadTerminalService) @@ -448,10 +447,12 @@ export function getOutputMatchForLines(lines: string[], outputMatcher: ITerminal } function parseQuickFix(id: string, source: string, fix: TerminalQuickFix): ITerminalQuickFix { - let type = TerminalQuickFixType.Command; + let type = TerminalQuickFixType.TerminalCommand; if ('uri' in fix) { fix.uri = URI.revive(fix.uri); type = TerminalQuickFixType.Opener; + } else if ('id' in fix) { + type = TerminalQuickFixType.VscodeCommand; } return { id, type, source, ...fix }; } diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index 1673b845c0c..291edaf4e33 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -1478,7 +1478,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I TerminalLocation: extHostTypes.TerminalLocation, TerminalProfile: extHostTypes.TerminalProfile, TerminalExitReason: extHostTypes.TerminalExitReason, - TerminalQuickFixType: extHostTypes.TerminalQuickFixType, TextDocumentSaveReason: extHostTypes.TextDocumentSaveReason, TextEdit: extHostTypes.TextEdit, SnippetTextEdit: extHostTypes.SnippetTextEdit, diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index be6ebc586b2..2f2bba71433 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -52,8 +52,9 @@ export enum TerminalOutputAnchor { } export enum TerminalQuickFixType { - Command = 0, - Opener = 1 + TerminalCommand = 0, + Opener = 1, + Command = 3 } @es5ClassCompat diff --git a/src/vs/workbench/contrib/terminalContrib/quickFix/browser/quickFix.ts b/src/vs/workbench/contrib/terminalContrib/quickFix/browser/quickFix.ts index 382d5144b23..8a13380b971 100644 --- a/src/vs/workbench/contrib/terminalContrib/quickFix/browser/quickFix.ts +++ b/src/vs/workbench/contrib/terminalContrib/quickFix/browser/quickFix.ts @@ -29,7 +29,7 @@ export interface ITerminalQuickFixProviderSelector { provider: ITerminalQuickFixProvider; } -export type TerminalQuickFixActionInternal = IAction | ITerminalQuickFixCommandAction | ITerminalQuickFixOpenerAction; +export type TerminalQuickFixActionInternal = IAction | ITerminalQuickFixExecuteTerminalCommandAction | ITerminalQuickFixOpenerAction; export type TerminalQuickFixCallback = (matchResult: ITerminalCommandMatchResult) => TerminalQuickFixActionInternal[] | TerminalQuickFixActionInternal | undefined; export type TerminalQuickFixCallbackExtension = (terminalCommand: ITerminalCommand, lines: string[] | undefined, option: ITerminalQuickFixOptions, token: CancellationToken) => Promise; @@ -44,9 +44,10 @@ export interface ITerminalQuickFixProvider { } export enum TerminalQuickFixType { - Command = 0, + TerminalCommand = 0, Opener = 1, - Port = 2 + Port = 2, + VscodeCommand = 3 } export interface ITerminalQuickFixOptions { @@ -63,8 +64,8 @@ export interface ITerminalQuickFix { source: string; } -export interface ITerminalQuickFixCommandAction extends ITerminalQuickFix { - type: TerminalQuickFixType.Command; +export interface ITerminalQuickFixExecuteTerminalCommandAction extends ITerminalQuickFix { + type: TerminalQuickFixType.TerminalCommand; terminalCommand: string; // TODO: Should this depend on whether alt is held? addNewLine?: boolean; @@ -73,6 +74,9 @@ export interface ITerminalQuickFixOpenerAction extends ITerminalQuickFix { type: TerminalQuickFixType.Opener; uri: URI; } +export interface ITerminalQuickFixCommandAction extends ITerminalQuickFix { + title: string; +} export interface ITerminalCommandMatchResult { commandLine: string; diff --git a/src/vs/workbench/contrib/terminalContrib/quickFix/browser/quickFixAddon.ts b/src/vs/workbench/contrib/terminalContrib/quickFix/browser/quickFixAddon.ts index 765d03c2141..0631a1e4e04 100644 --- a/src/vs/workbench/contrib/terminalContrib/quickFix/browser/quickFixAddon.ts +++ b/src/vs/workbench/contrib/terminalContrib/quickFix/browser/quickFixAddon.ts @@ -28,12 +28,13 @@ import { IAnchor } from 'vs/base/browser/ui/contextview/contextview'; import { ILabelService } from 'vs/platform/label/common/label'; import { Schemas } from 'vs/base/common/network'; import { URI } from 'vs/base/common/uri'; -import { ITerminalQuickFixInternalOptions, ITerminalQuickFixResolvedExtensionOptions, ITerminalQuickFix, ITerminalQuickFixCommandAction, ITerminalQuickFixOpenerAction, ITerminalQuickFixOptions, ITerminalQuickFixProviderSelector, ITerminalQuickFixService, ITerminalQuickFixUnresolvedExtensionOptions, TerminalQuickFixType } from 'vs/workbench/contrib/terminalContrib/quickFix/browser/quickFix'; +import { ITerminalQuickFixInternalOptions, ITerminalQuickFixResolvedExtensionOptions, ITerminalQuickFix, ITerminalQuickFixExecuteTerminalCommandAction, ITerminalQuickFixOpenerAction, ITerminalQuickFixOptions, ITerminalQuickFixProviderSelector, ITerminalQuickFixService, ITerminalQuickFixUnresolvedExtensionOptions, TerminalQuickFixType, ITerminalQuickFixCommandAction } from 'vs/workbench/contrib/terminalContrib/quickFix/browser/quickFix'; import { ITerminalCommandSelector } from 'vs/platform/terminal/common/terminal'; import { ActionListItemKind, IActionListItem } from 'vs/platform/actionWidget/browser/actionList'; import { CodeActionKind } from 'vs/editor/contrib/codeAction/common/types'; import { Codicon } from 'vs/base/common/codicons'; import { ThemeIcon } from 'vs/base/common/themables'; +import { ICommandService } from 'vs/platform/commands/common/commands'; const quickFixSelectors = [ DecorationSelector.QuickFix, @@ -75,6 +76,7 @@ export class TerminalQuickFixAddon extends Disposable implements ITerminalAddon, private readonly _aliases: string[][] | undefined, private readonly _capabilities: ITerminalCapabilityStore, @ITerminalQuickFixService private readonly _quickFixService: ITerminalQuickFixService, + @ICommandService private readonly _commandService: ICommandService, @IConfigurationService private readonly _configurationService: IConfigurationService, @IAudioCueService private readonly _audioCueService: IAudioCueService, @IOpenerService private readonly _openerService: IOpenerService, @@ -192,7 +194,7 @@ export class TerminalQuickFixAddon extends Disposable implements ITerminalAddon, await this._extensionService.activateByEvent(`onTerminalQuickFixRequest:${id}`); return this._quickFixService.providers.get(id)?.provideTerminalQuickFixes(command, lines, { type: 'resolved', commandLineMatcher: selector.commandLineMatcher, outputMatcher: selector.outputMatcher, commandExitResult: selector.commandExitResult, id: selector.id }, new CancellationTokenSource().token); }; - const result = await getQuickFixesForCommand(aliases, terminal, command, this._commandListeners, this._openerService, this._labelService, this._onDidRequestRerunCommand, resolver); + const result = await getQuickFixesForCommand(aliases, terminal, command, this._commandListeners, this._commandService, this._openerService, this._labelService, this._onDidRequestRerunCommand, resolver); if (!result) { return; } @@ -293,6 +295,7 @@ export async function getQuickFixesForCommand( terminal: Terminal, terminalCommand: ITerminalCommand, quickFixOptions: Map, + commandService: ICommandService, openerService: IOpenerService, labelService: ILabelService, onDidRequestRerunCommand?: Emitter<{ command: string; addNewLine?: boolean }>, @@ -339,15 +342,15 @@ export async function getQuickFixesForCommand( let action: ITerminalAction | undefined; if ('type' in quickFix) { switch (quickFix.type) { - case TerminalQuickFixType.Command: { - const fix = quickFix as ITerminalQuickFixCommandAction; + case TerminalQuickFixType.TerminalCommand: { + const fix = quickFix as ITerminalQuickFixExecuteTerminalCommandAction; if (commandQuickFixSet.has(fix.terminalCommand)) { continue; } commandQuickFixSet.add(fix.terminalCommand); const label = localize('quickFix.command', 'Run: {0}', fix.terminalCommand); action = { - type: TerminalQuickFixType.Command, + type: TerminalQuickFixType.TerminalCommand, class: undefined, source: quickFix.source, id: quickFix.id, @@ -405,6 +408,20 @@ export async function getQuickFixesForCommand( }; break; } + case TerminalQuickFixType.VscodeCommand: { + const fix = quickFix as ITerminalQuickFixCommandAction; + action = { + source: quickFix.source, + type: fix.type, + id: fix.id, + label: fix.title, + class: undefined, + enabled: true, + run: () => commandService.executeCommand(fix.id), + tooltip: fix.title + }; + break; + } } if (action) { fixes.push(action); @@ -477,9 +494,11 @@ function getQuickFixIcon(quickFix: TerminalQuickFixItem): ThemeIcon { const isUrl = (quickFix.action.uri.scheme === Schemas.http || quickFix.action.uri.scheme === Schemas.https); return isUrl ? Codicon.linkExternal : Codicon.goToFile; } - case TerminalQuickFixType.Command: + case TerminalQuickFixType.TerminalCommand: return Codicon.run; case TerminalQuickFixType.Port: return Codicon.debugDisconnect; + case TerminalQuickFixType.VscodeCommand: + return Codicon.lightbulb; } } diff --git a/src/vs/workbench/contrib/terminalContrib/quickFix/browser/terminalQuickFixBuiltinActions.ts b/src/vs/workbench/contrib/terminalContrib/quickFix/browser/terminalQuickFixBuiltinActions.ts index 0bc357b08b4..386eb5153fb 100644 --- a/src/vs/workbench/contrib/terminalContrib/quickFix/browser/terminalQuickFixBuiltinActions.ts +++ b/src/vs/workbench/contrib/terminalContrib/quickFix/browser/terminalQuickFixBuiltinActions.ts @@ -6,7 +6,7 @@ import { URI } from 'vs/base/common/uri'; import { localize } from 'vs/nls'; import { ITerminalInstance } from 'vs/workbench/contrib/terminal/browser/terminal'; -import { ITerminalQuickFixInternalOptions, ITerminalCommandMatchResult, ITerminalQuickFixCommandAction, TerminalQuickFixActionInternal, TerminalQuickFixType } from 'vs/workbench/contrib/terminalContrib/quickFix/browser/quickFix'; +import { ITerminalQuickFixInternalOptions, ITerminalCommandMatchResult, ITerminalQuickFixExecuteTerminalCommandAction, TerminalQuickFixActionInternal, TerminalQuickFixType } from 'vs/workbench/contrib/terminalContrib/quickFix/browser/quickFix'; export const GitCommandLineRegex = /git/; export const GitPushCommandLineRegex = /git\s+push/; @@ -49,7 +49,7 @@ export function gitSimilar(): ITerminalQuickFixInternalOptions { if (fixedCommand) { actions.push({ id: 'Git Similar', - type: TerminalQuickFixType.Command, + type: TerminalQuickFixType.TerminalCommand, terminalCommand: matchResult.commandLine.replace(/git\s+[^\s]+/, () => `git ${fixedCommand}`), addNewLine: true, source: QuickFixSource.Builtin @@ -79,7 +79,7 @@ export function gitTwoDashes(): ITerminalQuickFixInternalOptions { return; } return { - type: TerminalQuickFixType.Command, + type: TerminalQuickFixType.TerminalCommand, id: 'Git Two Dashes', terminalCommand: matchResult.commandLine.replace(` -${problemArg}`, () => ` --${problemArg}`), addNewLine: true, @@ -175,7 +175,7 @@ export function gitPushSetUpstream(): ITerminalQuickFixInternalOptions { } if (fixedCommand) { actions.push({ - type: TerminalQuickFixType.Command, + type: TerminalQuickFixType.TerminalCommand, id: 'Git Push Set Upstream', terminalCommand: fixedCommand, addNewLine: true, @@ -268,11 +268,11 @@ export function pwshGeneralError(): ITerminalQuickFixInternalOptions { if (!suggestions) { return; } - const result: ITerminalQuickFixCommandAction[] = []; + const result: ITerminalQuickFixExecuteTerminalCommandAction[] = []; for (const suggestion of suggestions) { result.push({ id: 'Pwsh General Error', - type: TerminalQuickFixType.Command, + type: TerminalQuickFixType.TerminalCommand, terminalCommand: suggestion, source: QuickFixSource.Builtin }); @@ -314,7 +314,7 @@ export function pwshUnixCommandNotFoundError(): ITerminalQuickFixInternalOptions } // Always remove the first element as it's the "Suggestion [cmd-not-found]"" line - const result: ITerminalQuickFixCommandAction[] = []; + const result: ITerminalQuickFixExecuteTerminalCommandAction[] = []; let inSuggestions = false; for (; i < lines.length; i++) { const line = lines[i].trim(); @@ -325,7 +325,7 @@ export function pwshUnixCommandNotFoundError(): ITerminalQuickFixInternalOptions if (installCommand) { result.push({ id: 'Pwsh Unix Command Not Found Error', - type: TerminalQuickFixType.Command, + type: TerminalQuickFixType.TerminalCommand, terminalCommand: installCommand, source: QuickFixSource.Builtin }); @@ -339,7 +339,7 @@ export function pwshUnixCommandNotFoundError(): ITerminalQuickFixInternalOptions if (inSuggestions) { result.push({ id: 'Pwsh Unix Command Not Found Error', - type: TerminalQuickFixType.Command, + type: TerminalQuickFixType.TerminalCommand, terminalCommand: line.trim(), source: QuickFixSource.Builtin }); diff --git a/src/vs/workbench/contrib/terminalContrib/quickFix/test/browser/quickFixAddon.test.ts b/src/vs/workbench/contrib/terminalContrib/quickFix/test/browser/quickFixAddon.test.ts index 107304e632c..5d5a0a16a07 100644 --- a/src/vs/workbench/contrib/terminalContrib/quickFix/test/browser/quickFixAddon.test.ts +++ b/src/vs/workbench/contrib/terminalContrib/quickFix/test/browser/quickFixAddon.test.ts @@ -30,11 +30,13 @@ import { TestStorageService } from 'vs/workbench/test/common/workbenchTestServic import { ITerminalQuickFixService } from 'vs/workbench/contrib/terminalContrib/quickFix/browser/quickFix'; import { ITerminalOutputMatcher } from 'vs/platform/terminal/common/terminal'; import { importAMDNodeModule } from 'vs/amdX'; +import { TestCommandService } from 'vs/editor/test/browser/editorTestServices'; suite('QuickFixAddon', () => { let quickFixAddon: TerminalQuickFixAddon; let terminalInstance: Pick; let commandDetection: CommandDetectionCapability; + let commandService: TestCommandService; let openerService: OpenerService; let labelService: LabelService; let terminal: Terminal; @@ -62,6 +64,7 @@ suite('QuickFixAddon', () => { capabilities.add(TerminalCapability.CommandDetection, commandDetection); instantiationService.stub(IContextMenuService, instantiationService.createInstance(ContextMenuService)); instantiationService.stub(IOpenerService, {} as Partial); + commandService = new TestCommandService(instantiationService); terminalInstance = { async freePortKillProcess(port: string): Promise { } } as Pick; @@ -96,23 +99,23 @@ suite('QuickFixAddon', () => { }); suite('returns undefined when', () => { test('output does not match', async () => { - strictEqual(await (getQuickFixesForCommand([], terminal, createCommand(command, `invalid output`, GitSimilarOutputRegex, exitCode, [`invalid output`]), expectedMap, openerService, labelService)), undefined); + strictEqual(await (getQuickFixesForCommand([], terminal, createCommand(command, `invalid output`, GitSimilarOutputRegex, exitCode, [`invalid output`]), expectedMap, commandService, openerService, labelService)), undefined); }); test('command does not match', async () => { - strictEqual(await (getQuickFixesForCommand([], terminal, createCommand(`gt sttatus`, output, GitSimilarOutputRegex, exitCode, outputLines), expectedMap, openerService, labelService)), undefined); + strictEqual(await (getQuickFixesForCommand([], terminal, createCommand(`gt sttatus`, output, GitSimilarOutputRegex, exitCode, outputLines), expectedMap, commandService, openerService, labelService)), undefined); }); }); suite('returns actions when', () => { test('expected unix exit code', async () => { - assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, GitSimilarOutputRegex, exitCode, outputLines), expectedMap, openerService, labelService)), actions); + assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, GitSimilarOutputRegex, exitCode, outputLines), expectedMap, commandService, openerService, labelService)), actions); }); test('matching exit status', async () => { - assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, GitSimilarOutputRegex, 2, outputLines), expectedMap, openerService, labelService)), actions); + assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, GitSimilarOutputRegex, 2, outputLines), expectedMap, commandService, openerService, labelService)), actions); }); }); suite('returns match', () => { test('returns match', async () => { - assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, GitSimilarOutputRegex, exitCode, outputLines), expectedMap, openerService, labelService)), actions); + assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, GitSimilarOutputRegex, exitCode, outputLines), expectedMap, commandService, openerService, labelService)), actions); }); test('returns multiple match', async () => { @@ -133,13 +136,13 @@ suite('QuickFixAddon', () => { tooltip: 'Run: git push', command: 'git push' }]; - assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand('git pu', output, GitSimilarOutputRegex, exitCode, output.split('\n')), expectedMap, openerService, labelService)), actions); + assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand('git pu', output, GitSimilarOutputRegex, exitCode, output.split('\n')), expectedMap, commandService, openerService, labelService)), actions); }); test('passes any arguments through', async () => { output = `git: 'checkoutt' is not a git command. See 'git --help'. The most similar commands are checkout`; - assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand('git checkoutt .', output, GitSimilarOutputRegex, exitCode, output.split('\n')), expectedMap, openerService, labelService)), [{ + assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand('git checkoutt .', output, GitSimilarOutputRegex, exitCode, output.split('\n')), expectedMap, commandService, openerService, labelService)), [{ id: 'Git Similar', enabled: true, label: 'Run: git checkout .', @@ -168,18 +171,18 @@ suite('QuickFixAddon', () => { }); suite('returns undefined when', () => { test('output does not match', async () => { - strictEqual((await getQuickFixesForCommand([], terminal, createCommand(command, `invalid output`, GitTwoDashesRegex, exitCode), expectedMap, openerService, labelService)), undefined); + strictEqual((await getQuickFixesForCommand([], terminal, createCommand(command, `invalid output`, GitTwoDashesRegex, exitCode), expectedMap, commandService, openerService, labelService)), undefined); }); test('command does not match', async () => { - strictEqual((await getQuickFixesForCommand([], terminal, createCommand(`gt sttatus`, output, GitTwoDashesRegex, exitCode), expectedMap, openerService, labelService)), undefined); + strictEqual((await getQuickFixesForCommand([], terminal, createCommand(`gt sttatus`, output, GitTwoDashesRegex, exitCode), expectedMap, commandService, openerService, labelService)), undefined); }); }); suite('returns actions when', () => { test('expected unix exit code', async () => { - assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, GitTwoDashesRegex, exitCode), expectedMap, openerService, labelService)), actions); + assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, GitTwoDashesRegex, exitCode), expectedMap, commandService, openerService, labelService)), actions); }); test('matching exit status', async () => { - assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, GitTwoDashesRegex, 2), expectedMap, openerService, labelService)), actions); + assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, GitTwoDashesRegex, 2), expectedMap, commandService, openerService, labelService)), actions); }); }); }); @@ -215,11 +218,11 @@ suite('QuickFixAddon', () => { }); suite('returns undefined when', () => { test('output does not match', async () => { - strictEqual((await getQuickFixesForCommand([], terminal, createCommand(portCommand, `invalid output`, FreePortOutputRegex), expectedMap, openerService, labelService)), undefined); + strictEqual((await getQuickFixesForCommand([], terminal, createCommand(portCommand, `invalid output`, FreePortOutputRegex), expectedMap, commandService, openerService, labelService)), undefined); }); }); test('returns actions', async () => { - assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(portCommand, output, FreePortOutputRegex), expectedMap, openerService, labelService)), actionOptions); + assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(portCommand, output, FreePortOutputRegex), expectedMap, commandService, openerService, labelService)), actionOptions); }); }); } @@ -246,18 +249,18 @@ suite('QuickFixAddon', () => { }); suite('returns undefined when', () => { test('output does not match', async () => { - strictEqual((await getQuickFixesForCommand([], terminal, createCommand(command, `invalid output`, GitPushOutputRegex, exitCode), expectedMap, openerService, labelService)), undefined); + strictEqual((await getQuickFixesForCommand([], terminal, createCommand(command, `invalid output`, GitPushOutputRegex, exitCode), expectedMap, commandService, openerService, labelService)), undefined); }); test('command does not match', async () => { - strictEqual((await getQuickFixesForCommand([], terminal, createCommand(`git status`, output, GitPushOutputRegex, exitCode), expectedMap, openerService, labelService)), undefined); + strictEqual((await getQuickFixesForCommand([], terminal, createCommand(`git status`, output, GitPushOutputRegex, exitCode), expectedMap, commandService, openerService, labelService)), undefined); }); }); suite('returns actions when', () => { test('expected unix exit code', async () => { - assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, GitPushOutputRegex, exitCode), expectedMap, openerService, labelService)), actions); + assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, GitPushOutputRegex, exitCode), expectedMap, commandService, openerService, labelService)), actions); }); test('matching exit status', async () => { - assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, GitPushOutputRegex, 2), expectedMap, openerService, labelService)), actions); + assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, GitPushOutputRegex, 2), expectedMap, commandService, openerService, labelService)), actions); }); }); }); @@ -287,18 +290,18 @@ suite('QuickFixAddon', () => { }); suite('returns undefined when', () => { test('output does not match', async () => { - strictEqual((await getQuickFixesForCommand([], terminal, createCommand(command, `invalid output`, GitCreatePrOutputRegex, exitCode), expectedMap, openerService, labelService)), undefined); + strictEqual((await getQuickFixesForCommand([], terminal, createCommand(command, `invalid output`, GitCreatePrOutputRegex, exitCode), expectedMap, commandService, openerService, labelService)), undefined); }); test('command does not match', async () => { - strictEqual((await getQuickFixesForCommand([], terminal, createCommand(`git status`, output, GitCreatePrOutputRegex, exitCode), expectedMap, openerService, labelService)), undefined); + strictEqual((await getQuickFixesForCommand([], terminal, createCommand(`git status`, output, GitCreatePrOutputRegex, exitCode), expectedMap, commandService, openerService, labelService)), undefined); }); test('failure exit status', async () => { - strictEqual((await getQuickFixesForCommand([], terminal, createCommand(command, output, GitCreatePrOutputRegex, 2), expectedMap, openerService, labelService)), undefined); + strictEqual((await getQuickFixesForCommand([], terminal, createCommand(command, output, GitCreatePrOutputRegex, 2), expectedMap, commandService, openerService, labelService)), undefined); }); }); suite('returns actions when', () => { test('expected unix exit code', async () => { - assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, GitCreatePrOutputRegex, exitCode), expectedMap, openerService, labelService)), actions); + assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, GitCreatePrOutputRegex, exitCode), expectedMap, commandService, openerService, labelService)), actions); }); }); }); @@ -326,18 +329,18 @@ suite('QuickFixAddon', () => { }); suite('returns undefined when', () => { test('output does not match', async () => { - strictEqual((await getQuickFixesForCommand([], terminal, createCommand(command, `invalid output`, GitPushOutputRegex, exitCode), expectedMap, openerService, labelService)), undefined); + strictEqual((await getQuickFixesForCommand([], terminal, createCommand(command, `invalid output`, GitPushOutputRegex, exitCode), expectedMap, commandService, openerService, labelService)), undefined); }); test('command does not match', async () => { - strictEqual((await getQuickFixesForCommand([], terminal, createCommand(`git status`, output, GitPushOutputRegex, exitCode), expectedMap, openerService, labelService)), undefined); + strictEqual((await getQuickFixesForCommand([], terminal, createCommand(`git status`, output, GitPushOutputRegex, exitCode), expectedMap, commandService, openerService, labelService)), undefined); }); }); suite('returns actions when', () => { test('expected unix exit code', async () => { - assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, GitPushOutputRegex, exitCode), expectedMap, openerService, labelService)), actions); + assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, GitPushOutputRegex, exitCode), expectedMap, commandService, openerService, labelService)), actions); }); test('matching exit status', async () => { - assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, GitPushOutputRegex, 2), expectedMap, openerService, labelService)), actions); + assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, GitPushOutputRegex, 2), expectedMap, commandService, openerService, labelService)), actions); }); }); }); @@ -386,10 +389,10 @@ suite('QuickFixAddon', () => { expectedMap.set(pushCommand.commandLineMatcher.toString(), [pushCommand]); }); test('returns undefined when output does not match', async () => { - strictEqual((await getQuickFixesForCommand([], terminal, createCommand(command, `invalid output`, PwshGeneralErrorOutputRegex, exitCode), expectedMap, openerService, labelService)), undefined); + strictEqual((await getQuickFixesForCommand([], terminal, createCommand(command, `invalid output`, PwshGeneralErrorOutputRegex, exitCode), expectedMap, commandService, openerService, labelService)), undefined); }); test('returns actions when output matches', async () => { - assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, PwshGeneralErrorOutputRegex, exitCode), expectedMap, openerService, labelService)), actions); + assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, PwshGeneralErrorOutputRegex, exitCode), expectedMap, commandService, openerService, labelService)), actions); }); }); suite('Unix cmd-not-found', () => { @@ -430,10 +433,10 @@ suite('QuickFixAddon', () => { expectedMap.set(pushCommand.commandLineMatcher.toString(), [pushCommand]); }); test('returns undefined when output does not match', async () => { - strictEqual((await getQuickFixesForCommand([], terminal, createCommand(command, `invalid output`, PwshUnixCommandNotFoundErrorOutputRegex, exitCode), expectedMap, openerService, labelService)), undefined); + strictEqual((await getQuickFixesForCommand([], terminal, createCommand(command, `invalid output`, PwshUnixCommandNotFoundErrorOutputRegex, exitCode), expectedMap, commandService, openerService, labelService)), undefined); }); test('returns actions when output matches', async () => { - assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, PwshUnixCommandNotFoundErrorOutputRegex, exitCode), expectedMap, openerService, labelService)), actions); + assertMatchOptions((await getQuickFixesForCommand([], terminal, createCommand(command, output, PwshUnixCommandNotFoundErrorOutputRegex, exitCode), expectedMap, commandService, openerService, labelService)), actions); }); }); }); diff --git a/src/vscode-dts/vscode.proposed.terminalQuickFixProvider.d.ts b/src/vscode-dts/vscode.proposed.terminalQuickFixProvider.d.ts index 094d1b969c4..4daa96722d8 100644 --- a/src/vscode-dts/vscode.proposed.terminalQuickFixProvider.d.ts +++ b/src/vscode-dts/vscode.proposed.terminalQuickFixProvider.d.ts @@ -80,9 +80,4 @@ declare module 'vscode' { Top = 0, Bottom = 1 } - - enum TerminalQuickFixType { - Command = 0, - Opener = 1 - } }