Skip to content

Contribute breakpoints for the "rust" language - #9484

Merged
Andrew Wang (WardenGnaw) merged 2 commits into
microsoft:mainfrom
chuckries:patch-1
Jun 28, 2022
Merged

Contribute breakpoints for the "rust" language#9484
Andrew Wang (WardenGnaw) merged 2 commits into
microsoft:mainfrom
chuckries:patch-1

Conversation

@chuckries

Copy link
Copy Markdown
Member

Since rust code can be debugged with this extension, contribute breakpoints for the "rust" language such that the workaround of "allow breakpoints in all files" is no longer required.

@chuckries

Copy link
Copy Markdown
Member Author

fixes #75 for rust only

@WardenGnaw

Copy link
Copy Markdown
Member

Gregg Miskelly (@gregg-miskelly)

Do we want to set contributes.debugger.languages: [ ..., "rust"] to both debuggers?

@chuckries

Copy link
Copy Markdown
Member Author

I wasn't sure about "languages" as we don't offer any language features for rust? just bp support.

I tried disabling the rust-analyzer extension and turned off "bps can be set in any file" and was still able to set bps in .rs files.

@WardenGnaw

Copy link
Copy Markdown
Member

languages those languages for which the debug extension could be considered the "default debugger"

The languages contribute seems to be specific to debugging which we are allowing.

https://code.visualstudio.com/api/references/contribution-points#contributes.debuggers

@chuckries

Copy link
Copy Markdown
Member Author

Andrew Wang (@WardenGnaw) updated to contribute languages for rust

@WardenGnaw

Andrew Wang (WardenGnaw) commented Jun 21, 2022

Copy link
Copy Markdown
Member

@sean-mcmanus Sean McManus (sean-mcmanus) added this to the 1.11.1 milestone Jun 21, 2022
@gregg-miskelly

Copy link
Copy Markdown
Member

Do we want to set contributes.debugger.languages: [ ..., "rust"] to both debuggers?

I think so.

@WardenGnaw

Copy link
Copy Markdown
Member

Also add "onLanguage:rust", so the extension activates when selecting a rust file.

"onLanguage:cuda-cpp",

@gregg-miskelly

Copy link
Copy Markdown
Member

Also add "onLanguage:rust", so the extension activates when selecting a rust file.

"onLanguage:cuda-cpp",

Is there a reason we need to? I didn't see any issues without this.

@chuckries

Copy link
Copy Markdown
Member Author

Gregg Miskelly (@gregg-miskelly) at least from my experience, the debugger wouldn't activate if only viewing rust files, which prevented C++ from showing up as a launch.json template source. I'd need to test again to confirm.

@chuckries

Copy link
Copy Markdown
Member Author

Gregg Miskelly (@gregg-miskelly) selecting Run and Debug with a .rs file active:
image

selecting it with a .cpp file active:
image

I'm not actually sure what the correct fix is here. I thought it was an issue of extension activation but it appears based on the active editor. C++ doesn't show up for the .rs file even after opening a .cpp file.

@chuckries

Copy link
Copy Markdown
Member Author

Gregg Miskelly (@gregg-miskelly) Andrew Wang (@WardenGnaw) even if I can get the C++ options to pop up from Run and Debug and I select C++ (Windows), then select Default Configuration, I get this:
image

I'm not sure how far we want to go at this point, given that a lot of this starts to get C++ specific. It'd be nice to get a default config working for Rust, but I feel like its probably non trivial to stand up and support?

@WardenGnaw

Copy link
Copy Markdown
Member

I believe this is due to the changes of Run and Debug by Elaheh Rashedi (@elahehrashedi) .

A lot of the config generation is done by the C++ language service now.

@chuckries

Copy link
Copy Markdown
Member Author

Gregg Miskelly (@gregg-miskelly) I'm curious how you started debugging rust if at all? Did you manually create a launch.json? Were you just using the inline hints provided by rust-analyzer?

@gregg-miskelly

Copy link
Copy Markdown
Member

Gregg Miskelly (@gregg-miskelly) at least from my experience, the debugger wouldn't activate if only viewing rust files, which prevented C++ from showing up as a launch.json template source. I'd need to test again to confirm.

That is what I saw too. But I wasn't sure if we would want the C++ templates to show up or not. If we do want it, I wonder if a better option is to activate on onDebugInitialConfigurations, which is what the C# extension does (see here).

The reason we might NOT want the C++ templates to show up is that the rust-analyze extension does offer their own templates through the 'Rust Analyzer: Debug' command.

@gregg-miskelly

Gregg Miskelly (gregg-miskelly) commented Jun 23, 2022

Copy link
Copy Markdown
Member

Gregg Miskelly (@gregg-miskelly) I'm curious how you started debugging rust if at all? Did you manually create a launch.json? Were you just using the inline hints provided by rust-analyzer?

I tried it three different ways --

  1. I manually created a launch.json before I read the docs.
  2. I used 'Rust Analyzer: Debug' to generate a launch.json for me. That was fine, except it didn't add "preLaunchTask": "rust: cargo build" like I wanted.
  3. I used 'Rust Analyzer: Debug' to debug without a launch.json

@WardenGnaw
Andrew Wang (WardenGnaw) force-pushed the patch-1 branch 2 times, most recently from 88feb13 to 650fe77 Compare June 28, 2022 18:46
Since rust code can be debugged with this extension, contribute breakpoints for the "rust" language such that the workaround of "allow breakpoints in all files" is no longer required.
Sean McManus (sean-mcmanus) pushed a commit that referenced this pull request Jun 29, 2022
* Contribute breakpoints for the "rust" language

Since rust code can be debugged with this extension, contribute breakpoints for the "rust" language such that the workaround of "allow breakpoints in all files" is no longer required.
@sean-mcmanus

Copy link
Copy Markdown
Contributor

This change is available in 1.11.2 (pre-release): https://github.com/microsoft/vscode-cpptools/releases

@sean-mcmanus

Copy link
Copy Markdown
Contributor

It's actually in 1.10.8 (release) too: https://github.com/microsoft/vscode-cpptools/releases/tag/v1.10.8

@github-actions github-actions Bot locked and limited conversation to collaborators Aug 13, 2022
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.

4 participants