Skip to content

Fix 'watch' Task #4932

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions src/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,14 @@ export class AssetGenerator {
private createWatchTaskDescription(): tasks.TaskDescription {
let commandArgs = ['watch', 'run'];

this.AddAdditionalCommandArgs(commandArgs);
const buildProject = this.getBuildProjectPath();
if (buildProject) {
commandArgs.push('--project');
commandArgs.push(buildProject);
}

// NOTE: Don't add any additional args, or this will disable hot reload. See:
// https://github.com/dotnet/sdk/blob/957ae5ca599fdeaee425d23928d42da711373a5e/src/BuiltInTools/dotnet-watch/Program.cs#L247-L256

return {
label: 'watch',
Expand All @@ -279,17 +286,26 @@ export class AssetGenerator {
}

private AddAdditionalCommandArgs(commandArgs: string[]) {
const buildProject = this.getBuildProjectPath();
if (buildProject) {
commandArgs.push(buildProject);
}

commandArgs.push("/property:GenerateFullPaths=true");
commandArgs.push("/consoleloggerparameters:NoSummary");
}

private getBuildProjectPath() : string|null {
let buildProject = this.startupProject;
if (!buildProject) {
buildProject = this.fallbackBuildProject;
}
if (buildProject) {
const buildPath = path.join('${workspaceFolder}', path.relative(this.workspaceFolder.uri.fsPath, buildProject.Path));
commandArgs.push(util.convertNativePathToPosix(buildPath));
return util.convertNativePathToPosix(buildPath);
}

commandArgs.push("/property:GenerateFullPaths=true");
commandArgs.push("/consoleloggerparameters:NoSummary");
return null;
}

public createTasksConfiguration(): tasks.TaskConfiguration {
Expand Down