Skip to content

Commit

Permalink
Don't use getCompiledProjectInfo in pickProcess (#4333)
Browse files Browse the repository at this point in the history
* Skip test to let artifacts publish

* Fix stupid build issue

* Fix for .NET debugging

* Remove export moniker

* Remove changes to global.test.
  • Loading branch information
nturinski authored Nov 13, 2024
1 parent a31bf0f commit 90439a6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
9 changes: 3 additions & 6 deletions src/commands/pickFuncProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { sendRequestWithTimeout, type AzExtRequestPrepareOptions } from '@micros
import { callWithTelemetryAndErrorHandling, parseError, UserCancelledError, type IActionContext } from '@microsoft/vscode-azext-utils';
import * as unixPsTree from 'ps-tree';
import * as vscode from 'vscode';
import { hostStartTaskName, ProjectLanguage } from '../constants';
import { hostStartTaskName } from '../constants';
import { preDebugValidate, type IPreDebugValidateResult } from '../debug/validatePreDebug';
import { ext } from '../extensionVariables';
import { buildPathToWorkspaceFolderMap, getFuncPortFromTaskOrProject, isFuncHostTask, runningFuncTaskMap, stopFuncTaskIfRunning, type IRunningFuncTask } from '../funcCoreTools/funcHostTask';
Expand All @@ -17,7 +17,6 @@ import { requestUtils } from '../utils/requestUtils';
import { taskUtils } from '../utils/taskUtils';
import { getWindowsProcessTree, ProcessDataFlag, type IProcessInfo, type IWindowsProcessTree } from '../utils/windowsProcessTree';
import { getWorkspaceSetting } from '../vsCodeConfig/settings';
import { getCompiledProjectInfo } from '../workspace/listLocalProjects';

const funcTaskReadyEmitter = new vscode.EventEmitter<vscode.WorkspaceFolder>();
export const onDotnetFuncTaskReady = funcTaskReadyEmitter.event;
Expand Down Expand Up @@ -82,10 +81,6 @@ export async function pickFuncProcess(context: IActionContext, debugConfig: vsco
throw new UserCancelledError('preDebugValidate');
}

const projectInfo = await getCompiledProjectInfo(context, result.workspace.uri.fsPath, ProjectLanguage.CSharp);
const buildPath: string = projectInfo?.compiledProjectPath || result.workspace.uri.fsPath;
await waitForPrevFuncTaskToStop(result.workspace, buildPath);

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const preLaunchTaskName: string | undefined = debugConfig.preLaunchTask;
const tasks: vscode.Task[] = await vscode.tasks.fetchTasks();
Expand All @@ -97,6 +92,8 @@ export async function pickFuncProcess(context: IActionContext, debugConfig: vsco
throw new Error(localize('noFuncTask', 'Failed to find "{0}" task.', preLaunchTaskName || hostStartTaskName));
}

const buildPath: string = (funcTask.execution as vscode.ShellExecution)?.options?.cwd || result.workspace.uri.fsPath;
await waitForPrevFuncTaskToStop(result.workspace, buildPath);
const taskInfo = await startFuncTask(context, result.workspace, buildPath, funcTask);
return await pickChildProcess(taskInfo);
}
Expand Down
4 changes: 1 addition & 3 deletions src/funcCoreTools/funcHostTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,7 @@ export function stopFuncTaskIfRunning(workspaceFolder: vscode.WorkspaceFolder |
runningFuncTask = [runningFuncTaskMap.get(workspaceFolder, buildPath)];
}

if (runningFuncTask !== undefined) {


if (runningFuncTask !== undefined && runningFuncTask.length > 0) {
for (const runningFuncTaskItem of runningFuncTask) {
if (!runningFuncTaskItem) break;
if (terminate) {
Expand Down
2 changes: 1 addition & 1 deletion src/workspace/listLocalProjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export async function listLocalProjects(): Promise<ListLocalProjectsResult> {

type CompiledProjectInfo = { compiledProjectPath: string; isIsolated: boolean };

export async function getCompiledProjectInfo(context: IActionContext, projectPath: string, projectLanguage: ProjectLanguage): Promise<CompiledProjectInfo | undefined> {
async function getCompiledProjectInfo(context: IActionContext, projectPath: string, projectLanguage: ProjectLanguage): Promise<CompiledProjectInfo | undefined> {
if (projectLanguage === ProjectLanguage.CSharp || projectLanguage === ProjectLanguage.FSharp) {
const projFiles: dotnetUtils.ProjectFile[] = await dotnetUtils.getProjFiles(context, projectLanguage, projectPath);
if (projFiles.length === 1) {
Expand Down

0 comments on commit 90439a6

Please sign in to comment.