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

VsCode: generate configuration for debugging #3441

Closed
yoshuawuyts opened this issue Mar 4, 2020 · 3 comments · Fixed by #4448
Closed

VsCode: generate configuration for debugging #3441

yoshuawuyts opened this issue Mar 4, 2020 · 3 comments · Fixed by #4448

Comments

@yoshuawuyts
Copy link
Member

This is a feature request. VS Code has built-in support for debugging through CodeLLDB and VS Code cpptools. These extensions can generate configuration for launch.json through a menu that looks like this:

Slice 1

Getting the configuration right for Rust projects is a bit of a tricky one, with some nuance on how to properly target binaries, libraries, and tests across all major platforms. Since rust-analyzer is providing a premier Rust experience in VS Code, this might be an interesting feature to add.

References

  • I believe this section outlines how to add this functionality to VS Code extensions.
  • This post shares a basic debugging setup for VS Code.
@Veetaha
Copy link
Contributor

Veetaha commented Mar 5, 2020

Isn't this the domain of vscode-lldb extension?

@matklad
Copy link
Member

matklad commented Mar 5, 2020 via email

@vsrs
Copy link
Contributor

vsrs commented May 8, 2020

#4366 already has the code to generate launch configurations, so I'll start work on this issue.

@bors bors bot closed this as completed in d51c1f6 May 15, 2020
@bors bors bot closed this as completed in #4448 May 15, 2020
matklad pushed a commit to matklad/vscode-rust that referenced this issue Jul 13, 2020
4448: Generate configuration for launch.json r=vsrs a=vsrs

This PR adds two new commands: `"rust-analyzer.debug"` and `"rust-analyzer.newDebugConfig"`. The former is a supplement to the existing `"rust-analyzer.run"` command and works the same way: asks for a runnable and starts new debug session. The latter allows adding a new configuration to **launch.json** (or to update an existing one).

If the new option `"rust-analyzer.debug.useLaunchJson"` is set to true then `"rust-analyzer.debug"` and Debug Lens will first look for existing debug configuration in **launch.json**. That is, it has become possible to specify startup arguments, env variables, etc.

`"rust-analyzer.debug.useLaunchJson"` is false by default, but it might be worth making true the default value. Personally I prefer true, but I'm not sure if it is good for all value.

----
I think that this PR also solves rust-lang/rust-analyzer#3441.
Both methods to update launch.json mentioned in the issue do not work:
1. Menu. It is only possible to add a launch.json configuration template via a debug adapter. And anyway it's only a template and it is impossible to specify arguments from an extension.

2. DebugConfigurationProvider. The exact opposite situation: it is possible to specify all debug session settings, but it is impossible to export these settings to launch.json.

Separate `"rust-analyzer.newDebugConfig"` command looks better for me.

----
Fixes #4450
Fixes #3441

Co-authored-by: vsrs <vit@conrlab.com>
Co-authored-by: vsrs <62505555+vsrs@users.noreply.github.com>
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this issue Apr 27, 2024
shims/unix: split general FD management from FS access

`fd.rs` was a mix of general file descriptor infrastructure and file system access. Split those things up properly.

Also add a `socket.rs` file where support for sockets can go eventually. For now it just contains the socketpair stub.
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 a pull request may close this issue.

4 participants