-
Notifications
You must be signed in to change notification settings - Fork 163
Fix workspace path when multiProjectSetup is enabled #759
Conversation
c9edfdf
to
7445b96
Compare
Applied the security fixes, just to get a building branch :), I can remove them if you'd rather do it yourself |
Sorry for taking so long. Would you mind rebasing against master again? It'd be great to also have some kind of a regression test for this :) |
Just did that in the meantime, so it'd be good to skip the relevant commits as well. |
src/extension.ts
Outdated
@@ -90,7 +90,7 @@ function whenOpeningTextDocument( | |||
return; | |||
} | |||
|
|||
const folderPath = folder.uri.toString(); | |||
const folderPath = folder.uri.path; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this change give us anything? I feel like we shouldn't use unix-only path if there's not a clear reason; If we should, then we ideally need to somehow document the rationale as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it was just to make hashing identical across systems. I can't remember if it was actually necessary (probably not, so I'll remove it)
parse obviously only takes URIs meaning it should be `file:///[path]` using the file command does that as well as fixing from windows format to file uri format.
Only when applying `**` at both ends does it pick it up, shouldn't really affect anyone, given it's still using the full path for matching.
…ableMultiProjectSetup" feature.
2cb4974
to
12378b1
Compare
src/extension.ts
Outdated
@@ -208,8 +208,9 @@ class ClientWorkspace { | |||
}; | |||
|
|||
const pattern = this.config.multiProjectEnabled | |||
? `${this.folder.uri.path}/**` | |||
? `**${this.folder.uri.path}/**` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I'm still wondering about this change... What exactly is the output for both .path
and .fsPath
and why do we need to prefix that with a wildcard?
Is the wildcard supposed to make the pattern drive-letter-agnostic, e.g. it'd match both C:\Some\Path
and D:\Some\Path
with a **/some/path/**
pattern?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right that's a really good point.
for fsPath it's what you would expect just standard operative system paths
windows: c:\Some\Path
linux: /some/path
path is what is interesting (it's basically the path part of a FILE uri):
windows: /c:/Some/Path
with the file uri: file:///c:/Some/Path
linux: /Some/Path
with the file uri: file:///Some/Path
Now the pattern matcher uses file uri paths for matching, my guess is they wanted to have a OS agnostic pattern matcher.
The **
is because windows puts something else infront of the files when matching and I have no clue what however the only way to get around it was **
which will catch it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a better solution would be to only apply this for windows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying! What do you mean by something else? Do you mean like c%3A
(which is percent-encoded c:
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I meant they put something [something]/c:/...
I don't know what that something is and I couldn't figure it out, I thought it was fine however but I understand wanting to fix it the correct way :).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I did some digging around vscode and vscode-languageserver-node and it seems this should also accept RelativePattern
, which encapsulates better what we want to achieve. The typings, however, only accept string
, so I'd be fine landing this as-is :)
3a6466d
to
65480c5
Compare
Thank you! I don't want to block this PR further, really appreciate your time and effort to land these fixes 🙇 |
When
enableMultiProjectSetup=true
the following bugs will be fixedcargo build
as it would previously point to the root folder (pointed out by @jli in Handle cases when the outer workspace is not a rust project #419).The branch has been tested on windows 10 & ubuntu 18.04
Will fix #713