diff options
| author | Laurențiu Nicola <lnicola@dend.ro> | 2022-08-23 10:05:52 +0300 |
|---|---|---|
| committer | Laurențiu Nicola <lnicola@dend.ro> | 2022-08-23 10:05:52 +0300 |
| commit | b01b9447a8a66a2e737d7b261b1664fbed7c9f18 (patch) | |
| tree | a02713ce5033795fd1330c2cd4ca0bb8b56d2fa1 /src/tools/rust-analyzer/editors/code | |
| parent | 7e3e8a816f91fda5c6e05c659d7038747aff0b55 (diff) | |
| parent | a670ff888437f4b6a3d24cc2996e9f969a87cbae (diff) | |
:arrow_up: rust-analyzer
Diffstat (limited to 'src/tools/rust-analyzer/editors/code')
6 files changed, 38 insertions, 23 deletions
diff --git a/src/tools/rust-analyzer/editors/code/package.json b/src/tools/rust-analyzer/editors/code/package.json index fbdc69c8013..67eabc313c8 100644 --- a/src/tools/rust-analyzer/editors/code/package.json +++ b/src/tools/rust-analyzer/editors/code/package.json @@ -235,6 +235,11 @@ "command": "rust-analyzer.moveItemDown", "title": "Move item down", "category": "rust-analyzer" + }, + { + "command": "rust-analyzer.cancelFlycheck", + "title": "Cancel running flychecks", + "category": "rust-analyzer" } ], "keybindings": [ @@ -542,7 +547,7 @@ ] }, "rust-analyzer.checkOnSave.overrideCommand": { - "markdownDescription": "Override the command rust-analyzer uses instead of `cargo check` for\ndiagnostics on save. The command is required to output json and\nshould therefor include `--message-format=json` or a similar option.\n\nIf you're changing this because you're using some tool wrapping\nCargo, you might also want to change\n`#rust-analyzer.cargo.buildScripts.overrideCommand#`.\n\nAn example command would be:\n\n```bash\ncargo check --workspace --message-format=json --all-targets\n```\n.", + "markdownDescription": "Override the command rust-analyzer uses instead of `cargo check` for\ndiagnostics on save. The command is required to output json and\nshould therefor include `--message-format=json` or a similar option.\n\nIf you're changing this because you're using some tool wrapping\nCargo, you might also want to change\n`#rust-analyzer.cargo.buildScripts.overrideCommand#`.\n\nIf there are multiple linked projects, this command is invoked for\neach of them, with the working directory being the project root\n(i.e., the folder containing the `Cargo.toml`).\n\nAn example command would be:\n\n```bash\ncargo check --workspace --message-format=json --all-targets\n```\n.", "default": null, "type": [ "null", @@ -756,6 +761,11 @@ "default": true, "type": "boolean" }, + "rust-analyzer.hover.documentation.keywords.enable": { + "markdownDescription": "Whether to show keyword hover popups. Only applies when\n`#rust-analyzer.hover.documentation.enable#` is set.", + "default": true, + "type": "boolean" + }, "rust-analyzer.hover.links.enable": { "markdownDescription": "Use markdown syntax for links in hover.", "default": true, diff --git a/src/tools/rust-analyzer/editors/code/src/commands.ts b/src/tools/rust-analyzer/editors/code/src/commands.ts index 1b793bb0b15..a21b304bbda 100644 --- a/src/tools/rust-analyzer/editors/code/src/commands.ts +++ b/src/tools/rust-analyzer/editors/code/src/commands.ts @@ -433,7 +433,7 @@ export function syntaxTree(ctx: Ctx): Cmd { // The contents of the file come from the `TextDocumentContentProvider` export function viewHir(ctx: Ctx): Cmd { const tdcp = new (class implements vscode.TextDocumentContentProvider { - readonly uri = vscode.Uri.parse("rust-analyzer-hir://viewHir/hir.txt"); + readonly uri = vscode.Uri.parse("rust-analyzer-hir://viewHir/hir.rs"); readonly eventEmitter = new vscode.EventEmitter<vscode.Uri>(); constructor() { vscode.workspace.onDidChangeTextDocument( @@ -655,7 +655,7 @@ function crateGraph(ctx: Ctx, full: boolean): Cmd { html, body { margin:0; padding:0; overflow:hidden } svg { position:fixed; top:0; left:0; height:100%; width:100% } - /* Disable the graphviz backgroud and fill the polygons */ + /* Disable the graphviz background and fill the polygons */ .graph > polygon { display:none; } :is(.node,.edge) polygon { fill: white; } @@ -817,6 +817,12 @@ export function openDocs(ctx: Ctx): Cmd { }; } +export function cancelFlycheck(ctx: Ctx): Cmd { + return async () => { + await ctx.client.sendRequest(ra.cancelFlycheck); + }; +} + export function resolveCodeAction(ctx: Ctx): Cmd { const client = ctx.client; return async (params: lc.CodeAction) => { diff --git a/src/tools/rust-analyzer/editors/code/src/config.ts b/src/tools/rust-analyzer/editors/code/src/config.ts index 1c58040d58c..b83582a344a 100644 --- a/src/tools/rust-analyzer/editors/code/src/config.ts +++ b/src/tools/rust-analyzer/editors/code/src/config.ts @@ -5,8 +5,6 @@ import { log } from "./util"; export type UpdatesChannel = "stable" | "nightly"; -const NIGHTLY_TAG = "nightly"; - export type RunnableEnvCfg = | undefined | Record<string, string> @@ -175,10 +173,6 @@ export class Config { gotoTypeDef: this.get<boolean>("hover.actions.gotoTypeDef.enable"), }; } - - get currentExtensionIsNightly() { - return this.package.releaseTag === NIGHTLY_TAG; - } } export async function updateConfig(config: vscode.WorkspaceConfiguration) { diff --git a/src/tools/rust-analyzer/editors/code/src/lsp_ext.ts b/src/tools/rust-analyzer/editors/code/src/lsp_ext.ts index f80af78a74a..875261c48a6 100644 --- a/src/tools/rust-analyzer/editors/code/src/lsp_ext.ts +++ b/src/tools/rust-analyzer/editors/code/src/lsp_ext.ts @@ -75,6 +75,23 @@ export const expandMacro = new lc.RequestType<ExpandMacroParams, ExpandedMacro | "rust-analyzer/expandMacro" ); +export const relatedTests = new lc.RequestType<lc.TextDocumentPositionParams, TestInfo[], void>( + "rust-analyzer/relatedTests" +); + +export const cancelFlycheck = new lc.RequestType0<void, void>("rust-analyzer/cancelFlycheck"); + +// Experimental extensions + +export interface SsrParams { + query: string; + parseOnly: boolean; + textDocument: lc.TextDocumentIdentifier; + position: lc.Position; + selections: readonly lc.Range[]; +} +export const ssr = new lc.RequestType<SsrParams, lc.WorkspaceEdit, void>("experimental/ssr"); + export interface MatchingBraceParams { textDocument: lc.TextDocumentIdentifier; positions: lc.Position[]; @@ -127,19 +144,6 @@ export interface TestInfo { runnable: Runnable; } -export const relatedTests = new lc.RequestType<lc.TextDocumentPositionParams, TestInfo[], void>( - "rust-analyzer/relatedTests" -); - -export interface SsrParams { - query: string; - parseOnly: boolean; - textDocument: lc.TextDocumentIdentifier; - position: lc.Position; - selections: readonly lc.Range[]; -} -export const ssr = new lc.RequestType<SsrParams, lc.WorkspaceEdit, void>("experimental/ssr"); - export interface CommandLink extends lc.Command { /** * A tooltip for the command, when represented in the UI. diff --git a/src/tools/rust-analyzer/editors/code/src/main.ts b/src/tools/rust-analyzer/editors/code/src/main.ts index d78b711a47a..a9847dd2a65 100644 --- a/src/tools/rust-analyzer/editors/code/src/main.ts +++ b/src/tools/rust-analyzer/editors/code/src/main.ts @@ -163,6 +163,7 @@ async function initCommonContext(context: vscode.ExtensionContext, ctx: Ctx) { ctx.registerCommand("peekTests", commands.peekTests); ctx.registerCommand("moveItemUp", commands.moveItemUp); ctx.registerCommand("moveItemDown", commands.moveItemDown); + ctx.registerCommand("cancelFlycheck", commands.cancelFlycheck); defaultOnEnter.dispose(); ctx.registerCommand("onEnter", commands.onEnter); diff --git a/src/tools/rust-analyzer/editors/code/src/toolchain.ts b/src/tools/rust-analyzer/editors/code/src/toolchain.ts index bac163da9f3..e1ca4954280 100644 --- a/src/tools/rust-analyzer/editors/code/src/toolchain.ts +++ b/src/tools/rust-analyzer/editors/code/src/toolchain.ts @@ -158,7 +158,7 @@ export const getPathForExecutable = memoizeAsync( try { // hmm, `os.homedir()` seems to be infallible - // it is not mentioned in docs and cannot be infered by the type signature... + // it is not mentioned in docs and cannot be inferred by the type signature... const standardPath = vscode.Uri.joinPath( vscode.Uri.file(os.homedir()), ".cargo", |
