Skip to content
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

Normalize tsconfig path #73001

Merged
merged 2 commits into from
May 21, 2019
Merged

Normalize tsconfig path #73001

merged 2 commits into from
May 21, 2019

Conversation

NizamLZ
Copy link
Contributor

@NizamLZ NizamLZ commented Apr 28, 2019

Normalize tsconfig path before task identifier generation to resolve #68812

Cause:
The task identifier is generated using the required fields of a given task type. For typescript, the value of the tsconfig is included in the task identifier. Typescript extension is generating the value of tsconfig using the platform specific path separator(irrespective of the value in tasks.json) but the createTaskIdentifier() in common/tasks.ts is using the value present in tasks.json.
Hence configuringTask in task.contribution.ts#L1467 is evaluated as null (the task identifiers don't match), making the task invalid.
This PR normalizes the value of tsconfig before the task identifier is generated.

@alexr00 alexr00 self-requested a review April 29, 2019 09:43
@NizamLZ NizamLZ reopened this May 1, 2019
@msftclas
Copy link

msftclas commented May 1, 2019

CLA assistant check
All CLA requirements met.

}
return project.path;
return normalizePath(projectPath);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexr00, done as suggested. Had to use a custom normalizePath() since path.posix.normalize() does not convert win32 paths to unix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing to note as you mentioned earlier, all the tasks.json files around the world which have windows path separators will show 'There are task errors' dialog with the below output:
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is correct. We did something similar with ${relativeFile} here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexr00, If all is good, can you please approve this PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NizamLZ we are in our endgame now, which means that we are trying to only make critical changes. We were slowing down our changes last week too. Because of this, I'll need to wait until next week to merge this PR.

Copy link
Contributor Author

@NizamLZ NizamLZ May 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. I was just hoping for an approval of the PR, not merge. Non the less, I now understand that the PR is accepted.

PS: This 'we are in the endgame now' gives me chills!
were-in-the-endgame-now

@alexr00 alexr00 added this to the May 2019 milestone May 21, 2019
@alexr00 alexr00 merged commit 36e7f18 into microsoft:master May 21, 2019
@erinha
Copy link
Member

erinha commented Jun 6, 2019

@alexr00 and @NizamLZ, not sure of the best way to get some clarification about this change...

I was just auto-updated to the latest version of VS code and noticed that my custom tasks now always caused an error: "Error: The typescript task detection didn't contribute a task for the following configuration ... The task will be ignored." I was surprised since the tasks seemed to be working before the upgrade.

After quite a bit of time spelunking the VS Code update list and following many issue links, I discovered that this change appears to have broken all existing and working tasks.json of this form. This is particularly notable because, from what I can tell, the newly required form (forward slashes instead of backslashes) does not work on older versions. It seems like the ramifications of this are that literally all VS Code users who has custom tasks of the old form will immediately break on upgrade (which they may not even realize happened, since it frequently happens automatically). Moreover, it will not be obvious to them what broke or how to fix it: there's no obvious error message or indication of exactly the new requirement.

When I did come across this thread, I was surprised to find that this exact issue was called out above: we're going to break all Windows users and seemingly dismissed. While I don't want to suggest that breaking changes can never be introduced, it seems like this particular change is going to cause untold developer hours trying to understand why their tasks broke suddenly, how to fix the problem, etc. Is it possible to elaborate on the threshold for when breaking changes like this can be introduced without any warning or obvious remediation alerts? Are there times when backwards compatibility should be considered? Or maybe I'm misunderstanding the impact (i.e. will there be fewer devs broken by this than I think and somehow I got lucky?)

Thanks!

@alexr00
Copy link
Member

alexr00 commented Jun 13, 2019

@erinha you are right that there should have been some sort of announcement for this. I should have included it in the release notes. In this case, the breaking change fixed a bug (typescript tasks could not be customized in a cross platform way). We have a precedence for this kind of change (#70050). This change will impact Windows users who have customized typescript tasks.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeScript task detection is not cross-platform
4 participants