Make config.rs a single source of truth for configuration.

Configuration is editor-independent. For this reason, we pick
JSON-schema as the repr of the source of truth. We do specify it using
rust-macros and some quick&dirty hackery though.

The idea for syncing truth with package.json is to just do that
manually, but there's a test to check that they are actually synced.

There's CLI to print config's json schema:

    $ rust-analyzer --print-config-schema

We go with a CLI rather than LSP request/response to make it easier to
incorporate the thing into extension's static config. This is roughtly
how we put the thing in package.json.
This commit is contained in:
Aleksey Kladov
2020-12-02 17:31:24 +03:00
parent e2e6b709e6
commit 2544abbf86
7 changed files with 674 additions and 447 deletions

View File

@@ -31,6 +31,9 @@ fn try_main() -> Result<()> {
setup_logging(args.log_file)?;
match args.command {
args::Command::RunServer => run_server()?,
args::Command::PrintConfigSchema => {
println!("{:#}", Config::json_schema());
}
args::Command::ProcMacro => proc_macro_srv::cli::run()?,
args::Command::Parse { no_dump } => cli::parse(no_dump)?,