⬆️ rust-analyzer

This commit is contained in:
Laurențiu Nicola 2022-09-20 17:39:17 +03:00
parent 459bbb4222
commit f5fde4df43
76 changed files with 1613 additions and 654 deletions

View file

@ -206,11 +206,6 @@
"title": "Show RA Version",
"category": "rust-analyzer"
},
{
"command": "rust-analyzer.toggleInlayHints",
"title": "Toggle inlay hints",
"category": "rust-analyzer"
},
{
"command": "rust-analyzer.openDocs",
"title": "Open docs under cursor",
@ -442,6 +437,11 @@
"default": true,
"type": "boolean"
},
"rust-analyzer.cargo.extraEnv": {
"markdownDescription": "Extra environment variables that will be set when running cargo, rustc\nor other commands within the workspace. Useful for setting RUSTFLAGS.",
"default": {},
"type": "object"
},
"rust-analyzer.cargo.features": {
"markdownDescription": "List of features to activate.\n\nSet this to `\"all\"` to pass `--all-features` to cargo.",
"default": [],
@ -514,6 +514,11 @@
"type": "string"
}
},
"rust-analyzer.checkOnSave.extraEnv": {
"markdownDescription": "Extra environment variables that will be set when running `cargo check`.",
"default": {},
"type": "object"
},
"rust-analyzer.checkOnSave.features": {
"markdownDescription": "List of features to activate. Defaults to\n`#rust-analyzer.cargo.features#`.\n\nSet to `\"all\"` to pass `--all-features` to Cargo.",
"default": null,
@ -803,6 +808,11 @@
"default": true,
"type": "boolean"
},
"rust-analyzer.imports.prefer.no.std": {
"markdownDescription": "Prefer to unconditionally use imports of the core and alloc crate, over the std crate.",
"default": false,
"type": "boolean"
},
"rust-analyzer.imports.prefix": {
"markdownDescription": "The path structure for newly inserted paths to use.",
"default": "plain",
@ -963,6 +973,19 @@
"default": true,
"type": "boolean"
},
"rust-analyzer.lens.location": {
"markdownDescription": "Where to render annotations.",
"default": "above_name",
"type": "string",
"enum": [
"above_name",
"above_whole_item"
],
"enumDescriptions": [
"Render annotations above the name of the item.",
"Render annotations above the whole item, including documentation comments and attributes."
]
},
"rust-analyzer.lens.references.adt.enable": {
"markdownDescription": "Whether to show `References` lens for Struct, Enum, and Union.\nOnly applies when `#rust-analyzer.lens.enable#` is set.",
"default": false,
@ -1036,6 +1059,11 @@
"string"
]
},
"rust-analyzer.references.excludeImports": {
"markdownDescription": "Exclude imports from find-all-references.",
"default": false,
"type": "boolean"
},
"rust-analyzer.runnables.command": {
"markdownDescription": "Command to be executed instead of 'cargo' for runnables.",
"default": null,
@ -1633,10 +1661,6 @@
"command": "rust-analyzer.serverVersion",
"when": "inRustProject"
},
{
"command": "rust-analyzer.toggleInlayHints",
"when": "inRustProject"
},
{
"command": "rust-analyzer.openDocs",
"when": "inRustProject"

View file

@ -321,30 +321,6 @@ export function serverVersion(ctx: Ctx): Cmd {
};
}
export function toggleInlayHints(_ctx: Ctx): Cmd {
return async () => {
const config = vscode.workspace.getConfiguration("editor.inlayHints", {
languageId: "rust",
});
const value = config.get("enabled");
let stringValue;
if (typeof value === "string") {
stringValue = value;
} else {
stringValue = value ? "on" : "off";
}
const nextValues: Record<string, string> = {
on: "off",
off: "on",
onUnlessPressed: "offUnlessPressed",
offUnlessPressed: "onUnlessPressed",
};
const nextValue = nextValues[stringValue] ?? "on";
await config.update("enabled", nextValue, vscode.ConfigurationTarget.Global);
};
}
// Opens the virtual file that will show the syntax tree
//
// The contents of the file come from the `TextDocumentContentProvider`

View file

@ -180,7 +180,6 @@ async function initCommonContext(context: vscode.ExtensionContext, ctx: Ctx) {
ctx.registerCommand("ssr", commands.ssr);
ctx.registerCommand("serverVersion", commands.serverVersion);
ctx.registerCommand("toggleInlayHints", commands.toggleInlayHints);
// Internal commands which are invoked by the server.
ctx.registerCommand("runSingle", commands.runSingle);