-
Notifications
You must be signed in to change notification settings - Fork 97
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
Add integration tests for VS Code debugging, eliminate FileAccessor
#1107
Conversation
I wish I could remember the issues we hit (maybe @idavis does) but we hit repeated problems with this code when implementing the debugger and when to use strings vs Uris. (I was hoping we'd not touch it again, else we should have commented it with the details). The biggest challenge I recall was specifically with the GitHub VFS/scheme, so would only occur when you'd open the editor on github.dev, for which I needed to deploy a test extension to be able to test and debug. If I vaguely recall the root cause, it was that at some point in the infra it marshals one of the values via JSON, which for a string works fine, but for a Uri converting it to JSON and back loses the Uri methods (as the Uri base class is not on the prototype chain anymore). However the GitHub file system would detect that one of the Uri properties is present (e.g. 'scheme'), assume IT IS a Uri, and then try and call Uri methods on it (like Either way, if touching this stuff again, be sure to REALLY test it, included when it's running the browser as an extension working with the GitHub virtual file system on github.dev |
The issue was around paths coming in from VS being windows paths instead of URIs. Normally we'd be able to tell the underlying debug session that we want paths always as URIs, but it is broken in web extensions. See this issue: microsoft/vscode-debugadapter-node#298 . I haven't dug into this PR, but when the call to We also use I've left out some historical detail as the project loader changed how the initialization of the debug session is performed. |
@billti @idavis yeah I'm in no rush to check this in without extensive testing, since so far every environment I tried had a unique behavior which made me revise my assumptions... like even Windows browser behaves differently from Linux browser, even when you're using a virtual filesystem - what the heck. I have this test matrix which I'm manually going through but I can't test github.dev / vscode.dev without shipping the dev build, I think. But please let me know if there's another way! Test: Launch configs:
Actions:
VSCode environments:
Platforms:
|
A `Location` refers to a span within a specific source file. It's expressed as a source name and `Range`. See: https://github.com/microsoft/vscode/blob/7923151da4b3567636c1346df9e8ba682744bbf3/src/vscode-dts/vscode.d.ts#L6581 It was defined in the language service protocol, but I'm moving it to a more common location in `compiler/qsc` since I need the debugger to use it in #1107. To summarize this PR and #1038, here's how locations are represented in the compiler vs. higher-level components that interface with VS Code (debugger, language service): | Compiler representation | Line/column representation | |---|---| | `u32` offset (into `SourceMap`) | `Position` (into specific source file) | | `Span` | `Range` | | (`PackageId`, `Span`) | `Location` |
…tarks/eliminate-file-accessor
Benchmark for e15caadClick to view benchmark
|
Benchmark for 70c23d8Click to view benchmark
|
Depends on #1106
VSCode's debugging related APIs sometimes use filesystem paths instead of URIs to represent sources. Previously, our solution was to have a
FileAccessor
which tried to treat the path both ways (first as a filesystem path, then a URI). But by being strategic about exactly where we expect filesystem paths and sanitizing them, we can just consistently use URIs in the rest of the code.Additionally this PR introduces integration tests for the debugger.
We also fix two small-ish bugs here:
{file}
and{workspaceFolder}
weren't treated properly on all platforms/filesystems