Skip to content

Feature proposal: pass arguments to overriden commands in a json to make them more flexible and use other rust-analyzer settings #13258

Closed
@IceTDrinker

Description

@IceTDrinker

Hello,

My proposal is something that would break existing overriden command which I believe take the repo root as sole argument.

The use case is the following:

rust-analyzer.cargo.buildScripts.overrideCommand cannot use other settings from rust analyzer (like enabled features e.g.) as the overrideCommand will be executed as is and will only get the root of the current repository as argument.

My proposal is to pass all the arguments that rust analyzer would usually use for building its own build script command (or even dumping it's whole settings as json, unsure if it's useful) as a json to the custom command.

This allows the user writing a custom command to write a sort of generic entry point that can use settings from rust-analyzer.

Schematically:

current:

rust-analyzer.cargo.buildScripts.overrideCommand = ["my_command"]

would launch my_command /path/to/repo/root

proposal:

rust-analyzer.cargo.buildScripts.overrideCommand = ["my_command"]

would launch something like my_command '{"enabled_features": ["feature_1", "feature_2"], "repo_root": "/path/to/repo/root"}' leaving the choice to my_command to parse the json and build a custom command that could be closer to the default rust-analyzer command in terms of configuratibility/versatility.

Don't know if there is a big need for this, but it feels like overriden command could benefit from more flexibility at this level 🙂 also if people go to the length of writing custom commands giving them the choice to do more with their custom commands does not feel out of place.

Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions