601 lines
25 KiB
Text
601 lines
25 KiB
Text
diff --git a/extensions/vscode-colorize-perf-tests/src/colorizer.test.ts b/extensions/vscode-colorize-perf-tests/src/colorizer.test.ts
|
|
index 2076a96d6b3..73c94126e98 100644
|
|
--- a/extensions/vscode-colorize-perf-tests/src/colorizer.test.ts
|
|
+++ b/extensions/vscode-colorize-perf-tests/src/colorizer.test.ts
|
|
@@ -93,11 +93,16 @@ interface TextMateTimes {
|
|
}
|
|
|
|
async function runCommand<TimesType = TreeSitterTimes | TextMateTimes>(command: string, file: Uri, times: number): Promise<TimesType[]> {
|
|
- const results: TimesType[] = [];
|
|
- for (let i = 0; i < times; i++) {
|
|
- results.push(await commands.executeCommand(command, file));
|
|
+ console.log('Entering runCommand in extensions/vscode-colorize-perf-tests/src/colorizer.test.ts:95');
|
|
+ try {
|
|
+ const results: TimesType[] = [];
|
|
+ for (let i = 0; i < times; i++) {
|
|
+ results.push(await commands.executeCommand(command, file));
|
|
+ }
|
|
+ return results;
|
|
+ } finally {
|
|
+ console.log('Exiting runCommand in extensions/vscode-colorize-perf-tests/src/colorizer.test.ts:95');
|
|
}
|
|
- return results;
|
|
}
|
|
|
|
async function doTest(file: Uri, times: number) {
|
|
diff --git a/src/vs/editor/browser/coreCommands.ts b/src/vs/editor/browser/coreCommands.ts
|
|
index 9331eea48ff..353f63b1e2d 100644
|
|
--- a/src/vs/editor/browser/coreCommands.ts
|
|
+++ b/src/vs/editor/browser/coreCommands.ts
|
|
@@ -2141,12 +2141,17 @@ class EditorHandlerCommand extends Command {
|
|
}
|
|
|
|
public runCommand(accessor: ServicesAccessor, args: unknown): void {
|
|
- const editor = accessor.get(ICodeEditorService).getFocusedCodeEditor();
|
|
- if (!editor) {
|
|
- return;
|
|
- }
|
|
+ console.log('Entering runCommand in src/vs/editor/browser/coreCommands.ts:2143');
|
|
+ try {
|
|
+ const editor = accessor.get(ICodeEditorService).getFocusedCodeEditor();
|
|
+ if (!editor) {
|
|
+ return;
|
|
+ }
|
|
|
|
- editor.trigger('keyboard', this._handlerId, args);
|
|
+ editor.trigger('keyboard', this._handlerId, args);
|
|
+ } finally {
|
|
+ console.log('Exiting runCommand in src/vs/editor/browser/coreCommands.ts:2143');
|
|
+ }
|
|
}
|
|
}
|
|
|
|
diff --git a/src/vs/editor/browser/editorExtensions.ts b/src/vs/editor/browser/editorExtensions.ts
|
|
index d5961dd4f1e..4b47db11de8 100644
|
|
--- a/src/vs/editor/browser/editorExtensions.ts
|
|
+++ b/src/vs/editor/browser/editorExtensions.ts
|
|
@@ -223,27 +223,32 @@ export class MultiCommand extends Command {
|
|
}
|
|
|
|
public runCommand(accessor: ServicesAccessor, args: unknown): void | Promise<void> {
|
|
- const logService = accessor.get(ILogService);
|
|
- const contextKeyService = accessor.get(IContextKeyService);
|
|
- logService.trace(`Executing Command '${this.id}' which has ${this._implementations.length} bound.`);
|
|
- for (const impl of this._implementations) {
|
|
- if (impl.when) {
|
|
- const context = contextKeyService.getContext(getActiveElement());
|
|
- const value = impl.when.evaluate(context);
|
|
- if (!value) {
|
|
- continue;
|
|
+ console.log('Entering runCommand in src/vs/editor/browser/editorExtensions.ts:225');
|
|
+ try {
|
|
+ const logService = accessor.get(ILogService);
|
|
+ const contextKeyService = accessor.get(IContextKeyService);
|
|
+ logService.trace(`Executing Command '${this.id}' which has ${this._implementations.length} bound.`);
|
|
+ for (const impl of this._implementations) {
|
|
+ if (impl.when) {
|
|
+ const context = contextKeyService.getContext(getActiveElement());
|
|
+ const value = impl.when.evaluate(context);
|
|
+ if (!value) {
|
|
+ continue;
|
|
+ }
|
|
}
|
|
- }
|
|
- const result = impl.implementation(accessor, args);
|
|
- if (result) {
|
|
- logService.trace(`Command '${this.id}' was handled by '${impl.name}'.`);
|
|
- if (typeof result === 'boolean') {
|
|
- return;
|
|
+ const result = impl.implementation(accessor, args);
|
|
+ if (result) {
|
|
+ logService.trace(`Command '${this.id}' was handled by '${impl.name}'.`);
|
|
+ if (typeof result === 'boolean') {
|
|
+ return;
|
|
+ }
|
|
+ return result;
|
|
}
|
|
- return result;
|
|
}
|
|
+ logService.trace(`The Command '${this.id}' was not handled by any implementation.`);
|
|
+ } finally {
|
|
+ console.log('Exiting runCommand in src/vs/editor/browser/editorExtensions.ts:225');
|
|
}
|
|
- logService.trace(`The Command '${this.id}' was not handled by any implementation.`);
|
|
}
|
|
}
|
|
|
|
@@ -263,7 +268,12 @@ export class ProxyCommand extends Command {
|
|
}
|
|
|
|
public runCommand(accessor: ServicesAccessor, args: unknown): void | Promise<void> {
|
|
- return this.command.runCommand(accessor, args);
|
|
+ console.log('Entering runCommand in src/vs/editor/browser/editorExtensions.ts:265');
|
|
+ try {
|
|
+ return this.command.runCommand(accessor, args);
|
|
+ } finally {
|
|
+ console.log('Exiting runCommand in src/vs/editor/browser/editorExtensions.ts:265');
|
|
+ }
|
|
}
|
|
}
|
|
|
|
@@ -326,7 +336,12 @@ export abstract class EditorCommand extends Command {
|
|
}
|
|
|
|
public runCommand(accessor: ServicesAccessor, args: unknown): void | Promise<void> {
|
|
- return EditorCommand.runEditorCommand(accessor, args, this.precondition, (accessor, editor, args) => this.runEditorCommand(accessor, editor, args));
|
|
+ console.log('Entering runCommand in src/vs/editor/browser/editorExtensions.ts:328');
|
|
+ try {
|
|
+ return EditorCommand.runEditorCommand(accessor, args, this.precondition, (accessor, editor, args) => this.runEditorCommand(accessor, editor, args));
|
|
+ } finally {
|
|
+ console.log('Exiting runCommand in src/vs/editor/browser/editorExtensions.ts:328');
|
|
+ }
|
|
}
|
|
|
|
public abstract runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, args: unknown): void | Promise<void>;
|
|
diff --git a/src/vs/editor/contrib/linkedEditing/browser/linkedEditing.ts b/src/vs/editor/contrib/linkedEditing/browser/linkedEditing.ts
|
|
index 09f9257f2d7..54bb7cfe53d 100644
|
|
--- a/src/vs/editor/contrib/linkedEditing/browser/linkedEditing.ts
|
|
+++ b/src/vs/editor/contrib/linkedEditing/browser/linkedEditing.ts
|
|
@@ -410,23 +410,28 @@ export class LinkedEditingAction extends EditorAction {
|
|
}
|
|
|
|
override runCommand(accessor: ServicesAccessor, args: [URI, IPosition]): void | Promise<void> {
|
|
- const editorService = accessor.get(ICodeEditorService);
|
|
- const [uri, pos] = Array.isArray(args) && args || [undefined, undefined];
|
|
+ console.log('Entering runCommand in src/vs/editor/contrib/linkedEditing/browser/linkedEditing.ts:412');
|
|
+ try {
|
|
+ const editorService = accessor.get(ICodeEditorService);
|
|
+ const [uri, pos] = Array.isArray(args) && args || [undefined, undefined];
|
|
|
|
- if (URI.isUri(uri) && Position.isIPosition(pos)) {
|
|
- return editorService.openCodeEditor({ resource: uri }, editorService.getActiveCodeEditor()).then(editor => {
|
|
- if (!editor) {
|
|
- return;
|
|
- }
|
|
- editor.setPosition(pos);
|
|
- editor.invokeWithinContext(accessor => {
|
|
- this.reportTelemetry(accessor, editor);
|
|
- return this.run(accessor, editor);
|
|
- });
|
|
- }, onUnexpectedError);
|
|
- }
|
|
+ if (URI.isUri(uri) && Position.isIPosition(pos)) {
|
|
+ return editorService.openCodeEditor({ resource: uri }, editorService.getActiveCodeEditor()).then(editor => {
|
|
+ if (!editor) {
|
|
+ return;
|
|
+ }
|
|
+ editor.setPosition(pos);
|
|
+ editor.invokeWithinContext(accessor => {
|
|
+ this.reportTelemetry(accessor, editor);
|
|
+ return this.run(accessor, editor);
|
|
+ });
|
|
+ }, onUnexpectedError);
|
|
+ }
|
|
|
|
- return super.runCommand(accessor, args);
|
|
+ return super.runCommand(accessor, args);
|
|
+ } finally {
|
|
+ console.log('Exiting runCommand in src/vs/editor/contrib/linkedEditing/browser/linkedEditing.ts:412');
|
|
+ }
|
|
}
|
|
|
|
run(_accessor: ServicesAccessor, editor: ICodeEditor): Promise<void> {
|
|
diff --git a/src/vs/editor/contrib/rename/browser/rename.ts b/src/vs/editor/contrib/rename/browser/rename.ts
|
|
index cf675f54cf4..4f17ede4134 100644
|
|
--- a/src/vs/editor/contrib/rename/browser/rename.ts
|
|
+++ b/src/vs/editor/contrib/rename/browser/rename.ts
|
|
@@ -379,23 +379,28 @@ export class RenameAction extends EditorAction {
|
|
}
|
|
|
|
override runCommand(accessor: ServicesAccessor, args: [URI, IPosition]): void | Promise<void> {
|
|
- const editorService = accessor.get(ICodeEditorService);
|
|
- const [uri, pos] = Array.isArray(args) && args || [undefined, undefined];
|
|
+ console.log('Entering runCommand in src/vs/editor/contrib/rename/browser/rename.ts:381');
|
|
+ try {
|
|
+ const editorService = accessor.get(ICodeEditorService);
|
|
+ const [uri, pos] = Array.isArray(args) && args || [undefined, undefined];
|
|
+
|
|
+ if (URI.isUri(uri) && Position.isIPosition(pos)) {
|
|
+ return editorService.openCodeEditor({ resource: uri }, editorService.getActiveCodeEditor()).then(editor => {
|
|
+ if (!editor) {
|
|
+ return;
|
|
+ }
|
|
+ editor.setPosition(pos);
|
|
+ editor.invokeWithinContext(accessor => {
|
|
+ this.reportTelemetry(accessor, editor);
|
|
+ return this.run(accessor, editor);
|
|
+ });
|
|
+ }, onUnexpectedError);
|
|
+ }
|
|
|
|
- if (URI.isUri(uri) && Position.isIPosition(pos)) {
|
|
- return editorService.openCodeEditor({ resource: uri }, editorService.getActiveCodeEditor()).then(editor => {
|
|
- if (!editor) {
|
|
- return;
|
|
- }
|
|
- editor.setPosition(pos);
|
|
- editor.invokeWithinContext(accessor => {
|
|
- this.reportTelemetry(accessor, editor);
|
|
- return this.run(accessor, editor);
|
|
- });
|
|
- }, onUnexpectedError);
|
|
+ return super.runCommand(accessor, args);
|
|
+ } finally {
|
|
+ console.log('Exiting runCommand in src/vs/editor/contrib/rename/browser/rename.ts:381');
|
|
}
|
|
-
|
|
- return super.runCommand(accessor, args);
|
|
}
|
|
|
|
run(accessor: ServicesAccessor, editor: ICodeEditor): Promise<void> {
|
|
diff --git a/src/vs/editor/test/browser/testCodeEditor.ts b/src/vs/editor/test/browser/testCodeEditor.ts
|
|
index adede234180..4baf3fba5a4 100644
|
|
--- a/src/vs/editor/test/browser/testCodeEditor.ts
|
|
+++ b/src/vs/editor/test/browser/testCodeEditor.ts
|
|
@@ -114,9 +114,14 @@ export class TestCodeEditor extends CodeEditorWidget implements ICodeEditor {
|
|
this._register(disposable);
|
|
}
|
|
public runCommand(command: EditorCommand, args?: any): void | Promise<void> {
|
|
- return this._instantiationService.invokeFunction((accessor) => {
|
|
- return command.runEditorCommand(accessor, this, args);
|
|
- });
|
|
+ console.log('Entering runCommand in src/vs/editor/test/browser/testCodeEditor.ts:116');
|
|
+ try {
|
|
+ return this._instantiationService.invokeFunction((accessor) => {
|
|
+ return command.runEditorCommand(accessor, this, args);
|
|
+ });
|
|
+ } finally {
|
|
+ console.log('Exiting runCommand in src/vs/editor/test/browser/testCodeEditor.ts:116');
|
|
+ }
|
|
}
|
|
public runAction(action: ITestEditorAction, args?: any): void | Promise<void> {
|
|
return this._instantiationService.invokeFunction((accessor) => {
|
|
diff --git a/src/vs/workbench/contrib/chat/test/browser/actions/chatExecuteActions.test.ts b/src/vs/workbench/contrib/chat/test/browser/actions/chatExecuteActions.test.ts
|
|
index 3465f33300b..0bdf3f0567c 100644
|
|
--- a/src/vs/workbench/contrib/chat/test/browser/actions/chatExecuteActions.test.ts
|
|
+++ b/src/vs/workbench/contrib/chat/test/browser/actions/chatExecuteActions.test.ts
|
|
@@ -25,10 +25,13 @@ interface IExecuteHandoffResult {
|
|
error?: string;
|
|
}
|
|
|
|
-// CommandsRegistry types all handlers as returning void, but our commands
|
|
-// return real values. This helper performs the double cast safely.
|
|
function runCommand<T>(handler: Function, ...args: unknown[]): T {
|
|
- return handler(...args) as unknown as T;
|
|
+ console.log('Entering runCommand in src/vs/workbench/contrib/chat/test/browser/actions/chatExecuteActions.test.ts:30');
|
|
+ try {
|
|
+ return handler(...args) as unknown as T;
|
|
+ } finally {
|
|
+ console.log('Exiting runCommand in src/vs/workbench/contrib/chat/test/browser/actions/chatExecuteActions.test.ts:30');
|
|
+ }
|
|
}
|
|
|
|
async function runCommandAsync<T>(handler: Function, ...args: unknown[]): Promise<T> {
|
|
diff --git a/src/vs/workbench/contrib/chat/test/browser/plugins/pluginInstallService.test.ts b/src/vs/workbench/contrib/chat/test/browser/plugins/pluginInstallService.test.ts
|
|
index db448e31734..8c3964adb28 100644
|
|
--- a/src/vs/workbench/contrib/chat/test/browser/plugins/pluginInstallService.test.ts
|
|
+++ b/src/vs/workbench/contrib/chat/test/browser/plugins/pluginInstallService.test.ts
|
|
@@ -141,10 +141,15 @@ suite('PluginInstallService', () => {
|
|
processReady: Promise.resolve(),
|
|
dispose: () => { },
|
|
runCommand: (command: string, _addNewLine?: boolean) => {
|
|
- state.terminalCommands.push(command);
|
|
- // Simulate command completing after runCommand is called
|
|
- if (finishedCallback) {
|
|
- finishedCallback({ id: 'command', exitCode: state.terminalExitCode });
|
|
+ console.log('Entering runCommand in src/vs/workbench/contrib/chat/test/browser/plugins/pluginInstallService.test.ts:143');
|
|
+ try {
|
|
+ state.terminalCommands.push(command);
|
|
+ // Simulate command completing after runCommand is called
|
|
+ if (finishedCallback) {
|
|
+ finishedCallback({ id: 'command', exitCode: state.terminalExitCode });
|
|
+ }
|
|
+ } finally {
|
|
+ console.log('Exiting runCommand in src/vs/workbench/contrib/chat/test/browser/plugins/pluginInstallService.test.ts:143');
|
|
}
|
|
},
|
|
capabilities: {
|
|
diff --git a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
|
|
index 75894ea61eb..9a69662eab7 100644
|
|
--- a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
|
|
+++ b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
|
|
@@ -975,54 +975,59 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
|
|
}
|
|
|
|
async runCommand(commandLine: string, shouldExecute: boolean, commandId?: string, forceBracketedPasteMode?: boolean): Promise<void> {
|
|
- let commandDetection = this.capabilities.get(TerminalCapability.CommandDetection);
|
|
- const siInjectionEnabled = this._configurationService.getValue(TerminalSettingId.ShellIntegrationEnabled) === true;
|
|
- const timeoutMs = getShellIntegrationTimeout(
|
|
- this._configurationService,
|
|
- siInjectionEnabled,
|
|
- this.hasRemoteAuthority,
|
|
- this._processManager.processReadyTimestamp
|
|
- );
|
|
-
|
|
- if (!commandDetection || commandDetection.promptInputModel.state !== PromptInputState.Input) {
|
|
- const store = new DisposableStore();
|
|
-
|
|
- await Promise.race([
|
|
- new Promise<void>(r => {
|
|
- store.add(this.capabilities.onDidAddCommandDetectionCapability(e => {
|
|
- commandDetection = e;
|
|
- if (commandDetection.promptInputModel.state === PromptInputState.Input) {
|
|
- r();
|
|
- } else {
|
|
- store.add(commandDetection.promptInputModel.onDidStartInput(() => {
|
|
+ console.log('Entering runCommand in src/vs/workbench/contrib/terminal/browser/terminalInstance.ts:977');
|
|
+ try {
|
|
+ let commandDetection = this.capabilities.get(TerminalCapability.CommandDetection);
|
|
+ const siInjectionEnabled = this._configurationService.getValue(TerminalSettingId.ShellIntegrationEnabled) === true;
|
|
+ const timeoutMs = getShellIntegrationTimeout(
|
|
+ this._configurationService,
|
|
+ siInjectionEnabled,
|
|
+ this.hasRemoteAuthority,
|
|
+ this._processManager.processReadyTimestamp
|
|
+ );
|
|
+
|
|
+ if (!commandDetection || commandDetection.promptInputModel.state !== PromptInputState.Input) {
|
|
+ const store = new DisposableStore();
|
|
+
|
|
+ await Promise.race([
|
|
+ new Promise<void>(r => {
|
|
+ store.add(this.capabilities.onDidAddCommandDetectionCapability(e => {
|
|
+ commandDetection = e;
|
|
+ if (commandDetection.promptInputModel.state === PromptInputState.Input) {
|
|
r();
|
|
- }));
|
|
- }
|
|
- }));
|
|
- }),
|
|
- timeout(timeoutMs)
|
|
- ]);
|
|
- store.dispose();
|
|
- }
|
|
-
|
|
- // If a command ID was provided and we have command detection, set it as the next command ID
|
|
- // so it will be used when the shell sends the command start sequence
|
|
- if (commandId && commandDetection) {
|
|
- this.xterm?.shellIntegration.setNextCommandId(commandLine, commandId);
|
|
- await this._processManager.setNextCommandId(commandLine, commandId);
|
|
- }
|
|
-
|
|
- // Determine whether to send ETX (ctrl+c) before running the command. Only do this when the
|
|
- // command will be executed immediately or when command detection shows the prompt contains text.
|
|
- if (shouldExecute && (!commandDetection || commandDetection.promptInputModel.value.length > 0)) {
|
|
- await this.sendText('\x03', false);
|
|
- // Wait a little before running the command to avoid the sequences being echoed while the ^C
|
|
- // is being evaluated
|
|
- await timeout(100);
|
|
- }
|
|
- // By default, use bracketed paste mode only when not running the command; callers can override
|
|
- // this by explicitly enabling it via the bracketedPasteMode argument.
|
|
- await this.sendText(commandLine, shouldExecute, !shouldExecute || forceBracketedPasteMode);
|
|
+ } else {
|
|
+ store.add(commandDetection.promptInputModel.onDidStartInput(() => {
|
|
+ r();
|
|
+ }));
|
|
+ }
|
|
+ }));
|
|
+ }),
|
|
+ timeout(timeoutMs)
|
|
+ ]);
|
|
+ store.dispose();
|
|
+ }
|
|
+
|
|
+ // If a command ID was provided and we have command detection, set it as the next command ID
|
|
+ // so it will be used when the shell sends the command start sequence
|
|
+ if (commandId && commandDetection) {
|
|
+ this.xterm?.shellIntegration.setNextCommandId(commandLine, commandId);
|
|
+ await this._processManager.setNextCommandId(commandLine, commandId);
|
|
+ }
|
|
+
|
|
+ // Determine whether to send ETX (ctrl+c) before running the command. Only do this when the
|
|
+ // command will be executed immediately or when command detection shows the prompt contains text.
|
|
+ if (shouldExecute && (!commandDetection || commandDetection.promptInputModel.value.length > 0)) {
|
|
+ await this.sendText('\x03', false);
|
|
+ // Wait a little before running the command to avoid the sequences being echoed while the ^C
|
|
+ // is being evaluated
|
|
+ await timeout(100);
|
|
+ }
|
|
+ // By default, use bracketed paste mode only when not running the command; callers can override
|
|
+ // this by explicitly enabling it via the bracketedPasteMode argument.
|
|
+ await this.sendText(commandLine, shouldExecute, !shouldExecute || forceBracketedPasteMode);
|
|
+ } finally {
|
|
+ console.log('Exiting runCommand in src/vs/workbench/contrib/terminal/browser/terminalInstance.ts:977');
|
|
+ }
|
|
}
|
|
|
|
detachFromElement(): void {
|
|
diff --git a/test/automation/src/quickaccess.ts b/test/automation/src/quickaccess.ts
|
|
index f28ec436636..efd89c0bed5 100644
|
|
--- a/test/automation/src/quickaccess.ts
|
|
+++ b/test/automation/src/quickaccess.ts
|
|
@@ -173,52 +173,57 @@ export class QuickAccess {
|
|
}
|
|
|
|
async runCommand(commandId: string, options?: { keepOpen?: boolean; exactLabelMatch?: boolean }): Promise<void> {
|
|
- const keepOpen = options?.keepOpen;
|
|
- const exactLabelMatch = options?.exactLabelMatch;
|
|
+ console.log('Entering runCommand in test/automation/src/quickaccess.ts:175');
|
|
+ try {
|
|
+ const keepOpen = options?.keepOpen;
|
|
+ const exactLabelMatch = options?.exactLabelMatch;
|
|
|
|
- const openCommandPalletteAndTypeCommand = async (): Promise<boolean> => {
|
|
- // open commands picker
|
|
- await this.openQuickAccessWithRetry(QuickAccessKind.Commands, `>${commandId}`);
|
|
+ const openCommandPalletteAndTypeCommand = async (): Promise<boolean> => {
|
|
+ // open commands picker
|
|
+ await this.openQuickAccessWithRetry(QuickAccessKind.Commands, `>${commandId}`);
|
|
|
|
- // wait for best choice to be focused
|
|
- await this.quickInput.waitForQuickInputElementFocused();
|
|
+ // wait for best choice to be focused
|
|
+ await this.quickInput.waitForQuickInputElementFocused();
|
|
|
|
- // Retry for as long as the command not found
|
|
- const text = await this.quickInput.waitForQuickInputElementText();
|
|
+ // Retry for as long as the command not found
|
|
+ const text = await this.quickInput.waitForQuickInputElementText();
|
|
|
|
- if (text === 'No matching commands' || (exactLabelMatch && text !== commandId)) {
|
|
- return false;
|
|
- }
|
|
+ if (text === 'No matching commands' || (exactLabelMatch && text !== commandId)) {
|
|
+ return false;
|
|
+ }
|
|
|
|
- return true;
|
|
- };
|
|
+ return true;
|
|
+ };
|
|
|
|
- let hasCommandFound = await openCommandPalletteAndTypeCommand();
|
|
+ let hasCommandFound = await openCommandPalletteAndTypeCommand();
|
|
|
|
- if (!hasCommandFound) {
|
|
+ if (!hasCommandFound) {
|
|
|
|
- this.code.logger.log(`QuickAccess: No matching commands, will retry...`);
|
|
- await this.quickInput.closeQuickInput();
|
|
+ this.code.logger.log(`QuickAccess: No matching commands, will retry...`);
|
|
+ await this.quickInput.closeQuickInput();
|
|
|
|
- let retries = 0;
|
|
- while (++retries < 5) {
|
|
- hasCommandFound = await openCommandPalletteAndTypeCommand();
|
|
- if (hasCommandFound) {
|
|
- break;
|
|
- } else {
|
|
- this.code.logger.log(`QuickAccess: No matching commands, will retry...`);
|
|
- await this.quickInput.closeQuickInput();
|
|
- await this.code.wait(1000);
|
|
+ let retries = 0;
|
|
+ while (++retries < 5) {
|
|
+ hasCommandFound = await openCommandPalletteAndTypeCommand();
|
|
+ if (hasCommandFound) {
|
|
+ break;
|
|
+ } else {
|
|
+ this.code.logger.log(`QuickAccess: No matching commands, will retry...`);
|
|
+ await this.quickInput.closeQuickInput();
|
|
+ await this.code.wait(1000);
|
|
+ }
|
|
}
|
|
- }
|
|
|
|
- if (!hasCommandFound) {
|
|
- throw new Error(`QuickAccess.runCommand(commandId: ${commandId}) failed to find command.`);
|
|
+ if (!hasCommandFound) {
|
|
+ throw new Error(`QuickAccess.runCommand(commandId: ${commandId}) failed to find command.`);
|
|
+ }
|
|
}
|
|
- }
|
|
|
|
- // wait and click on best choice
|
|
- await this.quickInput.selectQuickInputElement(0, keepOpen);
|
|
+ // wait and click on best choice
|
|
+ await this.quickInput.selectQuickInputElement(0, keepOpen);
|
|
+ } finally {
|
|
+ console.log('Exiting runCommand in test/automation/src/quickaccess.ts:175');
|
|
+ }
|
|
}
|
|
|
|
async openQuickOutline(): Promise<void> {
|
|
diff --git a/test/automation/src/terminal.ts b/test/automation/src/terminal.ts
|
|
index 70d807a6e4a..2649efb7055 100644
|
|
--- a/test/automation/src/terminal.ts
|
|
+++ b/test/automation/src/terminal.ts
|
|
@@ -81,30 +81,35 @@ export class Terminal {
|
|
constructor(private code: Code, private quickaccess: QuickAccess, private quickinput: QuickInput) { }
|
|
|
|
async runCommand(commandId: TerminalCommandId, expectedLocation?: 'editor' | 'panel'): Promise<void> {
|
|
- const keepOpen = commandId === TerminalCommandId.Join;
|
|
- await this.quickaccess.runCommand(commandId, { keepOpen });
|
|
- if (keepOpen) {
|
|
- await this.code.dispatchKeybinding('enter', async () => {
|
|
- await this.quickinput.waitForQuickInputClosed();
|
|
- });
|
|
- }
|
|
- switch (commandId) {
|
|
- case TerminalCommandId.Show:
|
|
- case TerminalCommandId.CreateNewEditor:
|
|
- case TerminalCommandId.CreateNew:
|
|
- case TerminalCommandId.NewWithProfile:
|
|
- await this._waitForTerminal(expectedLocation === 'editor' || commandId === TerminalCommandId.CreateNewEditor ? 'editor' : 'panel');
|
|
- break;
|
|
- case TerminalCommandId.KillAll:
|
|
- // HACK: Attempt to kill all terminals to clean things up, this is known to be flaky
|
|
- // but the reason why isn't known. This is typically called in the after each hook,
|
|
- // Since it's not actually required that all terminals are killed just continue on
|
|
- // after 2 seconds.
|
|
- await Promise.race([
|
|
- this.code.waitForElements(Selector.Xterm, true, e => e.length === 0),
|
|
- this.code.wait(2000)
|
|
- ]);
|
|
- break;
|
|
+ console.log('Entering runCommand in test/automation/src/terminal.ts:83');
|
|
+ try {
|
|
+ const keepOpen = commandId === TerminalCommandId.Join;
|
|
+ await this.quickaccess.runCommand(commandId, { keepOpen });
|
|
+ if (keepOpen) {
|
|
+ await this.code.dispatchKeybinding('enter', async () => {
|
|
+ await this.quickinput.waitForQuickInputClosed();
|
|
+ });
|
|
+ }
|
|
+ switch (commandId) {
|
|
+ case TerminalCommandId.Show:
|
|
+ case TerminalCommandId.CreateNewEditor:
|
|
+ case TerminalCommandId.CreateNew:
|
|
+ case TerminalCommandId.NewWithProfile:
|
|
+ await this._waitForTerminal(expectedLocation === 'editor' || commandId === TerminalCommandId.CreateNewEditor ? 'editor' : 'panel');
|
|
+ break;
|
|
+ case TerminalCommandId.KillAll:
|
|
+ // HACK: Attempt to kill all terminals to clean things up, this is known to be flaky
|
|
+ // but the reason why isn't known. This is typically called in the after each hook,
|
|
+ // Since it's not actually required that all terminals are killed just continue on
|
|
+ // after 2 seconds.
|
|
+ await Promise.race([
|
|
+ this.code.waitForElements(Selector.Xterm, true, e => e.length === 0),
|
|
+ this.code.wait(2000)
|
|
+ ]);
|
|
+ break;
|
|
+ }
|
|
+ } finally {
|
|
+ console.log('Exiting runCommand in test/automation/src/terminal.ts:83');
|
|
}
|
|
}
|
|
|
|
diff --git a/test/sanity/src/uiTest.ts b/test/sanity/src/uiTest.ts
|
|
index 96733481e96..45246e52a2f 100644
|
|
--- a/test/sanity/src/uiTest.ts
|
|
+++ b/test/sanity/src/uiTest.ts
|
|
@@ -79,17 +79,19 @@ export class UITest {
|
|
await page.waitForTimeout(500);
|
|
}
|
|
|
|
- /**
|
|
- * Run a command from the command palette.
|
|
- */
|
|
private async runCommand(page: Page, command: string) {
|
|
- this.context.log(`Running command: ${command}`);
|
|
- await page.keyboard.press('F1');
|
|
- const input = page.getByPlaceholder(/^Type the name of a command/);
|
|
- await input.fill(`>${command}`);
|
|
- const item = page.locator('span.monaco-highlighted-label', { hasText: new RegExp(`^${command}$`) });
|
|
- await item.click();
|
|
- await input.waitFor({ state: 'hidden' });
|
|
+ console.log('Entering runCommand in test/sanity/src/uiTest.ts:85');
|
|
+ try {
|
|
+ this.context.log(`Running command: ${command}`);
|
|
+ await page.keyboard.press('F1');
|
|
+ const input = page.getByPlaceholder(/^Type the name of a command/);
|
|
+ await input.fill(`>${command}`);
|
|
+ const item = page.locator('span.monaco-highlighted-label', { hasText: new RegExp(`^${command}$`) });
|
|
+ await item.click();
|
|
+ await input.waitFor({ state: 'hidden' });
|
|
+ } finally {
|
|
+ console.log('Exiting runCommand in test/sanity/src/uiTest.ts:85');
|
|
+ }
|
|
}
|
|
|
|
/**
|