Skip to content

Commit

Permalink
update rust-analyzer to 2024-09-23 (#135)
Browse files Browse the repository at this point in the history
Co-authored-by: rchl <[email protected]>
Co-authored-by: Rafal Chlodnicki <[email protected]>
  • Loading branch information
3 people authored Sep 24, 2024
1 parent 1f80a6c commit 4bfb347
Show file tree
Hide file tree
Showing 3 changed files with 245 additions and 150 deletions.
220 changes: 153 additions & 67 deletions LSP-rust-analyzer.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
// Placeholder expression to use for missing expressions in assists.
// possible values: todo, default
"rust-analyzer.assist.expressionFillDefault": "todo",
// Term search fuel in "units of work" for assists (Defaults to 400).
"rust-analyzer.assist.termSearch.fuel": 400,
// Enable borrow checking for term search code assists. If set to false, also there will be more suggestions,
// but some of them may not borrow-check.
"rust-analyzer.assist.termSearch.borrowcheck": true,
// Term search fuel in "units of work" for assists (Defaults to 1800).
"rust-analyzer.assist.termSearch.fuel": 1800,
// Warm up caches on project load.
"rust-analyzer.cachePriming.enable": true,
// How many worker threads to handle priming caches. The default `0` means to pick automatically.
Expand All @@ -29,27 +32,25 @@
"rust-analyzer.cargo.autoreload": true,
// Run build scripts (`build.rs`) for more precise code analysis.
"rust-analyzer.cargo.buildScripts.enable": true,
// Specifies the working directory for running build scripts.
// - "workspace": run build scripts for a workspace in the workspace’s root directory.
// This is incompatible with rust-analyzer.cargo.buildScripts.invocationStrategy set to once.
// - "root": run build scripts in the project’s root directory.
// This config only has an effect when rust-analyzer.cargo.buildScripts.overrideCommand is set.
"rust-analyzer.cargo.buildScripts.invocationLocation": "workspace",
// Specifies the invocation strategy to use when running the build scripts command.
// If `per_workspace` is set, the command will be executed for each workspace.
// If `once` is set, the command will be executed once.
// This config only has an effect when rust-analyzer.cargo.buildScripts.overrideCommand is set.
// If `per_workspace` is set, the command will be executed for each Rust workspace with the
// workspace as the working directory.
// If `once` is set, the command will be executed once with the opened project as the
// working directory.
// This config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#` is set.
"rust-analyzer.cargo.buildScripts.invocationStrategy": "per_workspace",
// Override the command rust-analyzer uses to run build scripts and
// build procedural macros. The command is required to output json
// and should therefore include `--message-format=json` or a similar
// option.
// and should therefore include `--message-format=json` or a similar option.
// If there are multiple linked projects/workspaces, this command is invoked for
// each of them, with the working directory being the workspace root
// (i.e., the folder containing the `Cargo.toml`). This can be overwritten
// by changing `#rust-analyzer.cargo.buildScripts.invocationStrategy#`.
// By default, a cargo invocation will be constructed for the configured
// targets and features, with the following base command line:
// ```bash
// cargo check --quiet --workspace --message-format=json --all-targets
// cargo check --quiet --workspace --message-format=json --all-targets --keep-going
// ```
// .
"rust-analyzer.cargo.buildScripts.overrideCommand": null,
// Rerun proc-macros building/build-scripts running when proc-macro
// or build-script sources change and are saved.
Expand Down Expand Up @@ -79,11 +80,6 @@
// Relative path to the sysroot, or "discover" to try to automatically find
// it via "rustc --print sysroot". Unsetting this disables sysroot loading.
"rust-analyzer.cargo.sysroot": "discover",
// Whether to run cargo metadata on the sysroot library allowing rust-analyzer to analyze
// third-party dependencies of the standard libraries.
// This will cause `cargo` to create a lockfile in your sysroot directory. rust-analyzer
// will attempt to clean up afterwards, but nevertheless requires the location to be writable to.
"rust-analyzer.cargo.sysrootQueryMetadata": false,
// Relative path to the sysroot library sources. If left unset, this will default to
// `{cargo.sysroot}/lib/rustlib/src/rust/library`.
//
Expand All @@ -93,8 +89,6 @@
"rust-analyzer.cargo.sysrootSrc": null,
// Compilation target override (target triple).
"rust-analyzer.cargo.target": null,
// Custom cargo runner extension ID.
"rust-analyzer.cargoRunner": null,
// Optional path to a rust-analyzer specific target directory.
// This prevents rust-analyzer's `cargo check` and initial build-script and proc-macro
// building from locking the `Cargo.lock` at the expense of duplicating build artifacts.
Expand All @@ -119,12 +113,6 @@
// List of `cargo check` (or other command specified in `check.command`) diagnostics to ignore.
// For example for `cargo check`: `dead_code`, `unused_imports`, `unused_variables`,...
"rust-analyzer.check.ignore": [],
// Specifies the working directory for running checks.
// - "workspace": run checks for workspaces in the corresponding workspaces' root directories.
// This falls back to "root" if `rust-analyzer.check.invocationStrategy` is set to `once`.
// - "root": run checks in the project's root directory.
// This config only has an effect when `rust-analyzer.check.overrideCommand` is set.
"rust-analyzer.check.invocationLocation": "workspace",
// Specifies the invocation strategy to use when running the check command.
// If `per_workspace` is set, the command will be executed for each workspace.
// If `once` is set, the command will be executed once.
Expand All @@ -137,23 +125,18 @@
// should therefore include `--message-format=json` or a similar option
// (if your client supports the `colorDiagnosticOutput` experimental
// capability, you can use `--message-format=json-diagnostic-rendered-ansi`).
//
// If you're changing this because you're using some tool wrapping
// Cargo, you might also want to change `rust-analyzer.cargo.buildScripts.overrideCommand`.
//
// Cargo, you might also want to change
// `#rust-analyzer.cargo.buildScripts.overrideCommand#`.
// If there are multiple linked projects/workspaces, this command is invoked for
// each of them, with the working directory being the workspace root
// (i.e., the folder containing the `Cargo.toml`). This can be overwritten
// by changing `rust-analyzer.check.invocationStrategy` and
// `rust-analyzer.check.invocationLocation`.
//
// by changing `#rust-analyzer.check.invocationStrategy#`.
// If `$saved_file` is part of the command, rust-analyzer will pass
// the absolute path of the saved file to the provided command. This is
// intended to be used with non-Cargo build systems.
// Note that `$saved_file` is experimental and may be removed in the future.
//
// An example command would be:
//
// ```bash
// cargo check --workspace --message-format=json --all-targets
// ```
Expand All @@ -166,6 +149,10 @@
// Whether `--workspace` should be passed to `cargo check`.
// If false, `-p <package>` will be passed instead.
"rust-analyzer.check.workspace": true,
// Whether to automatically add a semicolon when completing unit-returning functions.
//
// In `match` arms it completes a comma instead.
"rust-analyzer.completion.addSemicolonToUnit": true,
// Toggles the additional completions that automatically add imports when completed.
// Note that your client must specify the `additionalTextEdits` LSP client capability to truly have this feature enabled.
"rust-analyzer.completion.autoimport.enable": true,
Expand All @@ -177,6 +164,8 @@
"rust-analyzer.completion.callable.snippets": "fill_arguments",
// Whether to show full function/method signatures in completion docs.
"rust-analyzer.completion.fullFunctionSignatures.enable": false,
// Whether to omit deprecated items from autocompletion. By default they are marked as deprecated but not hidden.
"rust-analyzer.completion.hideDeprecated": false,
// Maximum number of completions to return. If `null`, the limit is infinite.
//
// For a maximum of 5, use:
Expand All @@ -192,50 +181,50 @@
"rust-analyzer.completion.privateEditable.enable": false,
// Custom completion snippets.
"rust-analyzer.completion.snippets.custom": {
"Box::pin": {
"postfix": "pinbox",
"requires": "std::boxed::Box",
"body": "Box::pin(${receiver})",
"description": "Put the expression into a pinned `Box`",
"scope": "expr"
},
"Some": {
"postfix": "some",
"body": "Some(${receiver})",
"description": "Wrap the expression in an `Option::Some`",
"Arc::new": {
"body": "Arc::new(${receiver})",
"description": "Put the expression into an `Arc`",
"postfix": "arc",
"requires": "std::sync::Arc",
"scope": "expr"
},
"Rc::new": {
"postfix": "rc",
"requires": "std::rc::Rc",
"body": "Rc::new(${receiver})",
"description": "Put the expression into an `Rc`",
"postfix": "rc",
"requires": "std::rc::Rc",
"scope": "expr"
},
"Ok": {
"postfix": "ok",
"body": "Ok(${receiver})",
"description": "Wrap the expression in a `Result::Ok`",
"Box::pin": {
"body": "Box::pin(${receiver})",
"description": "Put the expression into a pinned `Box`",
"postfix": "pinbox",
"requires": "std::boxed::Box",
"scope": "expr"
},
"Err": {
"postfix": "err",
"body": "Err(${receiver})",
"description": "Wrap the expression in a `Result::Err`",
"postfix": "err",
"scope": "expr"
},
"Arc::new": {
"postfix": "arc",
"requires": "std::sync::Arc",
"body": "Arc::new(${receiver})",
"description": "Put the expression into an `Arc`",
"Some": {
"body": "Some(${receiver})",
"description": "Wrap the expression in an `Option::Some`",
"postfix": "some",
"scope": "expr"
},
"Ok": {
"body": "Ok(${receiver})",
"description": "Wrap the expression in a `Result::Ok`",
"postfix": "ok",
"scope": "expr"
}
},
// Whether to enable term search based snippets like `Some(foo.bar().baz())`.
"rust-analyzer.completion.termSearch.enable": false,
// Term search fuel in "units of work" for autocompletion (Defaults to 200).
"rust-analyzer.completion.termSearch.fuel": 200,
// Term search fuel in "units of work" for autocompletion (Defaults to 1000).
"rust-analyzer.completion.termSearch.fuel": 1000,
// List of rust-analyzer diagnostics to disable.
"rust-analyzer.diagnostics.disabled": [],
// Whether to show native rust-analyzer diagnostics.
Expand Down Expand Up @@ -329,6 +318,8 @@
// The path structure for newly inserted paths to use.
// possible values: plain, self, crate
"rust-analyzer.imports.prefix": "plain",
// Whether to prefix external (including std, core) crate imports with `::`. e.g. "use ::std::io::Read;".
"rust-analyzer.imports.prefixExternPrelude": false,
// Whether to show inlay type hints for binding modes.
"rust-analyzer.inlayHints.bindingModeHints.enable": false,
// Whether to show inlay type hints for method chains.
Expand All @@ -353,6 +344,12 @@
"rust-analyzer.inlayHints.expressionAdjustmentHints.hideOutsideUnsafe": false,
// Whether to show inlay hints as postfix ops (`.*` instead of `*`, etc).
"rust-analyzer.inlayHints.expressionAdjustmentHints.mode": "prefix",
// Whether to show const generic parameter name inlay hints.
"rust-analyzer.inlayHints.genericParameterHints.const.enable": true,
// Whether to show generic lifetime parameter name inlay hints.
"rust-analyzer.inlayHints.genericParameterHints.lifetime.enable": false,
// Whether to show generic type parameter name inlay hints.
"rust-analyzer.inlayHints.genericParameterHints.type.enable": false,
// Whether to show implicit drop hints.
"rust-analyzer.inlayHints.implicitDrops.enable": false,
// Whether to show inlay type hints for elided lifetimes in function signatures.
Expand Down Expand Up @@ -392,9 +389,6 @@
"rust-analyzer.lens.debug.enable": false,
// Whether to show CodeLens in Rust files.
"rust-analyzer.lens.enable": true,
// Internal config: use custom client-side commands even when the
// client doesn't set the corresponding capability.
"rust-analyzer.lens.forceCustomCommands": true,
// Whether to show `Implementations` lens. Only applies when `rust-analyzer.lens.enable` is set.
"rust-analyzer.lens.implementations.enable": true,
// Where to render annotations.
Expand Down Expand Up @@ -422,8 +416,6 @@
"rust-analyzer.lru.query.capacities": {},
// Whether to show `can't find Cargo.toml` error message.
"rust-analyzer.notifications.cargoTomlNotFound": true,
// Whether to send an UnindexedProject notification to the client.
"rust-analyzer.notifications.unindexedProject": false,
// How many worker threads in the main loop. The default `null` means to pick automatically.
"rust-analyzer.numThreads": null,
// Expand attribute macros. Requires `rust-analyzer.procMacro.enable` to be set.
Expand Down Expand Up @@ -511,6 +503,100 @@
"rust-analyzer.signatureInfo.documentation.enable": true,
// Whether to insert closing angle brackets when typing an opening angle bracket of a generic argument list.
"rust-analyzer.typing.autoClosingAngleBrackets.enable": false,
// Enables automatic discovery of projects using [`DiscoverWorkspaceConfig::command`].
//
// [`DiscoverWorkspaceConfig`] also requires setting `progress_label` and `files_to_watch`.
// `progress_label` is used for the title in progress indicators, whereas `files_to_watch`
// is used to determine which build system-specific files should be watched in order to
// reload rust-analyzer.
//
// Below is an example of a valid configuration:
// ```json
// "rust-analyzer.workspace.discoverConfig": {
// "command": [
// "rust-project",
// "develop-json"
// ],
// "progressLabel": "rust-analyzer",
// "filesToWatch": [
// "BUCK"
// ]
// }
// ```
//
// ## On `DiscoverWorkspaceConfig::command`
//
// **Warning**: This format is provisional and subject to change.
//
// [`DiscoverWorkspaceConfig::command`] *must* return a JSON object
// corresponding to `DiscoverProjectData::Finished`:
//
// ```norun
// #[derive(Debug, Clone, Deserialize, Serialize)]
// #[serde(tag = "kind")]
// #[serde(rename_all = "snake_case")]
// enum DiscoverProjectData {
// Finished { buildfile: Utf8PathBuf, project: ProjectJsonData },
// Error { error: String, source: Option<String> },
// Progress { message: String },
// }
// ```
//
// As JSON, `DiscoverProjectData::Finished` is:
//
// ```json
// {
// // the internally-tagged representation of the enum.
// "kind": "finished",
// // the file used by a non-Cargo build system to define
// // a package or target.
// "buildfile": "rust-analyzer/BUILD",
// // the contents of a rust-project.json, elided for brevity
// "project": {
// "sysroot": "foo",
// "crates": []
// }
// }
//```
//
// It is encouraged, but not required, to use the other variants on
// `DiscoverProjectData` to provide a more polished end-user experience.
//
// `DiscoverWorkspaceConfig::command` may *optionally* include an `{arg}`,
// which will be substituted with the JSON-serialized form of the following
// enum:
//
// ```norun
// #[derive(PartialEq, Clone, Debug, Serialize)]
// #[serde(rename_all = "camelCase")]
// pub enum DiscoverArgument {
// Path(AbsPathBuf),
// Buildfile(AbsPathBuf),
// }
// ```
//
// The JSON representation of `DiscoverArgument::Path` is:
//
// ```json
// {
// "path": "src/main.rs"
// }
// ```
//
// Similarly, the JSON representation of `DiscoverArgument::Buildfile` is:
//
// ```
// {
// "buildfile": "BUILD"
// }
// ```
//
// `DiscoverArgument::Path` is used to find and generate a `rust-project.json`,
// and therefore, a workspace, whereas `DiscoverArgument::buildfile` is used to
// to update an existing workspace. As a reference for implementors,
// buck2's `rust-project` will likely be useful:
// https://github.com/facebook/buck2/tree/main/integrations/rust-project.
"rust-analyzer.workspace.discoverConfig": null,
// Whether to prefix newlines after comments with the corresponding comment prefix.
"rust-analyzer.typing.continueCommentsOnNewline": true,
// Workspace symbol search kind.
Expand All @@ -529,4 +615,4 @@
"command": [
"${storage_path}/LSP-rust-analyzer/rust-analyzer"
],
}
}
2 changes: 1 addition & 1 deletion plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

SESSION_NAME = "rust-analyzer"

TAG = "2024-06-24"
TAG = "2024-09-23"
"""
Update this single git tag to download a newer version.
After changing this tag, go through the server settings again to see
Expand Down
Loading

0 comments on commit 4bfb347

Please sign in to comment.