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

Move the Location struct to a more common place #1106

Merged
merged 1 commit into from
Feb 7, 2024

Conversation

minestarks
Copy link
Member

@minestarks minestarks commented Feb 2, 2024

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

@minestarks minestarks added this pull request to the merge queue Feb 7, 2024
Merged via the queue into main with commit fa336ec Feb 7, 2024
14 checks passed
@minestarks minestarks deleted the minestarks/location branch February 7, 2024 18:44
github-merge-queue bot pushed a commit that referenced this pull request Mar 12, 2024
…#1107)

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:
- launch.json variables like `{file}` and `{workspaceFolder}` weren't
treated properly on all platforms/filesystems
- when launching the debugger on an untitled file, the user may be
prompted to save the file. If they choose to save the file, the debugger
will fail to launch. (This is probably not as big an issue anymore,
since we disabled the auto-save behavior by default since I've opened
this PR.)
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.

3 participants