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

Fix Windows paths. #1662

Merged
merged 2 commits into from
Feb 28, 2020
Merged

Fix Windows paths. #1662

merged 2 commits into from
Feb 28, 2020

Conversation

mattn
Copy link
Contributor

@mattn mattn commented Jan 21, 2020

vscode-uri use lower-case drive-letter. So convert it always in getFilePath()

Fixes #1316

@octref
Copy link
Member

octref commented Jan 21, 2020

I'm traveling and don't have a Windows machine at hand, but I was trying to fix Windows CI (#1266 (comment)), so I pushed two branches to see what would happen:

@mattn
Copy link
Contributor Author

mattn commented Feb 10, 2020

Any update?

@@ -200,7 +201,7 @@ export class VLS {

changes.forEach(c => {
if (c.type === FileChangeType.Changed) {
const fsPath = Uri.parse(c.uri).fsPath;
const fsPath = getFileFsPath(c.uri);
Copy link
Member

Choose a reason for hiding this comment

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

Did you mean to change to getFilePath? How is this change different than getFileFsPath's implementation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is unification of processing. In the future getFileFsPath will allow you to make unified fine-tuning(or fixing).

return Uri.parse(documentUri).path.slice(1);
// vscode-uri use lower-case drive letter
// https://github.com/microsoft/vscode-uri/blob/95e03c06f87d38f25eda1ae3c343fe5b7eec3f52/src/index.ts#L1017
return Uri.parse(documentUri).path.replace(/^\/[a-zA-Z]/, (s: string) => s.slice(1).toLowerCase());
Copy link
Member

Choose a reason for hiding this comment

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

This change would only make drive letters lowercase for you...Does that fix your issue?

Or is your issue a bug on TS 3.7.3? See #1589 (comment) which includes some changes upstream that handles drive letters differently.
If upgrading to TS 3.7.5 (with vetur.useWorkspaceDependencies) fixes your issue, then this isn't the correct fix.

Copy link
Contributor

Choose a reason for hiding this comment

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

I've tested this on Windows and it actually fixes my path issues I tested from master branch which includes ts 3.7.5 (message was vue-ls: Loaded bundled typescript@3.7.5). Without this line change, vetur didn't work.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, rebasing on master and will release once CI goes through.

vscode-uri use lower-case drive-letter. So convert it always in getFilePath()
@octref octref merged commit 05b4e7a into vuejs:master Feb 28, 2020
octref added a commit that referenced this pull request Feb 28, 2020
@mattn
Copy link
Contributor Author

mattn commented Feb 28, 2020

Thank you

@octref
Copy link
Member

octref commented Feb 28, 2020

Thank you as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Language Server: Problem with incorrect paths in Windows
3 participants