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

Generate better cargo check command for vscode #203

Closed
tomasol opened this issue Jan 10, 2024 · 1 comment · Fixed by #205
Closed

Generate better cargo check command for vscode #203

tomasol opened this issue Jan 10, 2024 · 1 comment · Fixed by #205

Comments

@tomasol
Copy link
Contributor

tomasol commented Jan 10, 2024

I propose replacing the contents of .vscode/settings.json

{
    "rust-analyzer.check.overrideCommand": ["cargo", "component", "check", "--message-format=json"]
}

with

{
    "rust-analyzer.check.overrideCommand": [
        "cargo",
        "component",
        "check",
        "--workspace",
        "--all-targets",
        "--message-format=json"
    ],
}

This works well even if the project is not part of a workspace, and the parameters are mentioned in the User Maunal as the default:

By default, a cargo invocation will be constructed for the configured targets and features, with the following base command line:
cargo check --quiet --workspace --message-format=json --all-targets

The main benefit is that the current setting skips checking tests, benches etc.

@tomasol tomasol changed the title Generate better cargo check command Generate better cargo check command for vscode Jan 10, 2024
@peterhuene
Copy link
Member

peterhuene commented Jan 10, 2024

@tomasol Thanks for the suggestion! That sounds like what we should be using then.

Would you be up for changing it to your suggestion in create_editor_settings_file from src/commands/new.rs (for both the VS Code and Emacs) and submit a 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 a pull request may close this issue.

2 participants