From b32528659a64f74da4b652c44b9fb47844899809 Mon Sep 17 00:00:00 2001 From: Urban Dove Date: Sat, 25 Jul 2020 22:16:35 -0400 Subject: try select correct workspace in vscode multi workspace --- editors/code/src/debug.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'editors/code') diff --git a/editors/code/src/debug.ts b/editors/code/src/debug.ts index bd92c5b6d..1427ecf9a 100644 --- a/editors/code/src/debug.ts +++ b/editors/code/src/debug.ts @@ -87,9 +87,18 @@ async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise 1; + const firstWorkspace = vscode.workspace.workspaceFolders![0]; // folder exists or RA is not active. + const workspace = !isMultiFolderWorkspace || !runnable.args.workspaceRoot ? + firstWorkspace : + vscode.workspace.workspaceFolders!.find(w => runnable.args.workspaceRoot?.includes(w.uri.fsPath)) || firstWorkspace; + + const wsFolder = path.normalize(workspace.uri.fsPath); + const workspaceQualifier = isMultiFolderWorkspace ? `:${workspace.name}` : ''; function simplifyPath(p: string): string { - return path.normalize(p).replace(wsFolder, '${workspaceRoot}'); + // see https://github.com/rust-analyzer/rust-analyzer/pull/5513#issuecomment-663458818 for why this is needed + return path.normalize(p).replace(wsFolder, '${workspaceFolder' + workspaceQualifier + '}'); } const executable = await getDebugExecutable(runnable); -- cgit v1.2.3 From a85e64770d13598103c9122c6514ec3d5a3b0d53 Mon Sep 17 00:00:00 2001 From: Urban Dove Date: Sun, 26 Jul 2020 13:42:17 -0400 Subject: delete empty line --- editors/code/src/debug.ts | 1 - 1 file changed, 1 deletion(-) (limited to 'editors/code') diff --git a/editors/code/src/debug.ts b/editors/code/src/debug.ts index 1427ecf9a..925126a16 100644 --- a/editors/code/src/debug.ts +++ b/editors/code/src/debug.ts @@ -87,7 +87,6 @@ async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise 1; const firstWorkspace = vscode.workspace.workspaceFolders![0]; // folder exists or RA is not active. const workspace = !isMultiFolderWorkspace || !runnable.args.workspaceRoot ? -- cgit v1.2.3 From c04b2e39dacfea5c6ba158d842fb3b7f3e0db12b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Herrmann?= Date: Sat, 8 Aug 2020 11:57:54 +0200 Subject: Fix typo in settings description Remove a duplicate word from the description of the `warningsAsHint` setting. --- editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'editors/code') diff --git a/editors/code/package.json b/editors/code/package.json index 1adf055d0..ee5f96bf3 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -607,7 +607,7 @@ "items": { "type": "string" }, - "description": "List of warnings warnings that should be displayed with hint severity.\nThe warnings will be indicated by faded text or three dots in code and will not show up in the problems panel.", + "description": "List of warnings that should be displayed with hint severity.\nThe warnings will be indicated by faded text or three dots in code and will not show up in the problems panel.", "default": [] } } -- cgit v1.2.3 From e43811c1645f78818d5d7fe0054b54a462145847 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 8 Aug 2020 21:53:38 +0300 Subject: Fix no inlay hints / unresolved tokens until manual edit No we return ContentModified during the workspace loading. This signifies the language client to retry the operation (i.e. the client will continue polling the server while it returns ContentModified). I believe that there might be cases of overly big projects where the backoff logic we have setup in `sendRequestWithRetry` (which we use for inlay hints) might bail too early (currently the largest retry standby time is 10 seconds). However, I've tried on one of my project with 500+ dependencies and it is still enough. --- editors/code/src/util.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'editors/code') diff --git a/editors/code/src/util.ts b/editors/code/src/util.ts index 970fedb37..49d2d1c6f 100644 --- a/editors/code/src/util.ts +++ b/editors/code/src/util.ts @@ -64,7 +64,8 @@ export async function sendRequestWithRetry( param: TParam, token?: vscode.CancellationToken, ): Promise { - for (const delay of [2, 4, 6, 8, 10, null]) { + // The sequence is `10 * (2 ** (2 * n))` where n is 1, 2, 3... + for (const delay of [40, 160, 640, 2560, 10240, null]) { try { return await (token ? client.sendRequest(reqType, param, token) @@ -84,8 +85,7 @@ export async function sendRequestWithRetry( log.warn("LSP request failed", { method: reqType.method, param, error }); throw error; } - - await sleep(10 * (1 << delay)); + await sleep(delay); } } throw 'unreachable'; -- cgit v1.2.3 From 7252babc136b351d5011a78878607c7aaeea5ed8 Mon Sep 17 00:00:00 2001 From: Jeremy Kolb Date: Sun, 9 Aug 2020 17:57:27 -0400 Subject: Remove workaround for semantic token flickering See: https://github.com/microsoft/vscode-languageserver-node/issues/576#issuecomment-593384479 This has been fixed since vscode 1.44 --- editors/code/src/client.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'editors/code') diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts index 18948cb3c..bd7a150f0 100644 --- a/editors/code/src/client.ts +++ b/editors/code/src/client.ts @@ -4,7 +4,7 @@ import * as ra from '../src/lsp_ext'; import * as Is from 'vscode-languageclient/lib/utils/is'; import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; -import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed'; +import { SemanticTokensFeature } from 'vscode-languageclient/lib/semanticTokens.proposed'; import { assert } from './util'; function renderCommand(cmd: ra.CommandLink) { @@ -44,12 +44,6 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient diagnosticCollectionName: "rustc", traceOutputChannel, middleware: { - // Workaround for https://github.com/microsoft/vscode-languageserver-node/issues/576 - async provideDocumentSemanticTokens(document: vscode.TextDocument, token: vscode.CancellationToken, next: DocumentSemanticsTokensSignature) { - const res = await next(document, token); - if (res === undefined) throw new Error('busy'); - return res; - }, async provideHover(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken, _next: lc.ProvideHoverSignature) { return client.sendRequest(lc.HoverRequest.type, client.code2ProtocolConverter.asTextDocumentPositionParams(document, position), token).then( (result) => { -- cgit v1.2.3 From 58c97bdcbf6d7df218028f75373cfc4916043693 Mon Sep 17 00:00:00 2001 From: Jeremy Kolb Date: Sun, 9 Aug 2020 18:09:27 -0400 Subject: Remove 'as any' --- editors/code/src/client.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'editors/code') diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts index bd7a150f0..f5db55b8c 100644 --- a/editors/code/src/client.ts +++ b/editors/code/src/client.ts @@ -129,7 +129,7 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient ); } - } as any + } }; const client = new lc.LanguageClient( -- cgit v1.2.3 From 13f736d4a13bdf5af2cdd6a4832a41470431a70b Mon Sep 17 00:00:00 2001 From: Igor Aleksanov Date: Wed, 12 Aug 2020 16:06:55 +0300 Subject: Add a configuration option for the vscode extension --- editors/code/package.json | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'editors/code') diff --git a/editors/code/package.json b/editors/code/package.json index 1adf055d0..86584c071 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -609,6 +609,15 @@ }, "description": "List of warnings warnings that should be displayed with hint severity.\nThe warnings will be indicated by faded text or three dots in code and will not show up in the problems panel.", "default": [] + }, + "rust-analyzer.analysis.disabledDiagnostics": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string" + }, + "description": "List of rust-analyzer diagnostics to disable", + "default": [] } } }, @@ -904,4 +913,4 @@ ] } } -} +} \ No newline at end of file -- cgit v1.2.3 From 8d34262956059aca7e6fded351a9299b3581a5cf Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 12 Aug 2020 16:52:28 +0200 Subject: Rename ra_toolchain -> toolchain --- editors/code/src/toolchain.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'editors/code') diff --git a/editors/code/src/toolchain.ts b/editors/code/src/toolchain.ts index 80a7915e9..a5dc3cf0c 100644 --- a/editors/code/src/toolchain.ts +++ b/editors/code/src/toolchain.ts @@ -121,12 +121,12 @@ export class Cargo { } } -/** Mirrors `ra_toolchain::cargo()` implementation */ +/** Mirrors `toolchain::cargo()` implementation */ export function cargoPath(): string { return getPathForExecutable("cargo"); } -/** Mirrors `ra_toolchain::get_path_for_executable()` implementation */ +/** Mirrors `toolchain::get_path_for_executable()` implementation */ export const getPathForExecutable = memoize( // We apply caching to decrease file-system interactions (executableName: "cargo" | "rustc" | "rustup"): string => { -- cgit v1.2.3 From 3c018bf84de5c693b5ee1c6bec0fed3b201c2060 Mon Sep 17 00:00:00 2001 From: Igor Aleksanov Date: Thu, 13 Aug 2020 06:58:26 +0300 Subject: Restore final newline in package.json --- editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'editors/code') diff --git a/editors/code/package.json b/editors/code/package.json index d186d1474..429ff5def 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -913,4 +913,4 @@ ] } } -} \ No newline at end of file +} -- cgit v1.2.3 From 951fc3f65ac023ef61d3a447399e1432e38700fa Mon Sep 17 00:00:00 2001 From: xiaofa Date: Sun, 16 Aug 2020 23:28:26 +0800 Subject: Fix eslint errors on .eslintrc.js and rollup.config.js --- editors/code/.eslintignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 editors/code/.eslintignore (limited to 'editors/code') diff --git a/editors/code/.eslintignore b/editors/code/.eslintignore new file mode 100644 index 000000000..3df5c860b --- /dev/null +++ b/editors/code/.eslintignore @@ -0,0 +1,3 @@ +node_modules +.eslintrc.js +rollup.config.js \ No newline at end of file -- cgit v1.2.3 From 1eed036a6e68aee6128d099e3a8f2c06a90b846b Mon Sep 17 00:00:00 2001 From: vsrs Date: Mon, 17 Aug 2020 14:56:27 +0300 Subject: Fix StatusNotification --- editors/code/src/ctx.ts | 2 +- editors/code/src/lsp_ext.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'editors/code') diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts index 6e767babf..543f7e02e 100644 --- a/editors/code/src/ctx.ts +++ b/editors/code/src/ctx.ts @@ -36,7 +36,7 @@ export class Ctx { res.pushCleanup(client.start()); await client.onReady(); - client.onNotification(ra.status, (status) => res.setStatus(status)); + client.onNotification(ra.status, (params) => res.setStatus(params.status)); return res; } diff --git a/editors/code/src/lsp_ext.ts b/editors/code/src/lsp_ext.ts index 494d51c83..8663737a6 100644 --- a/editors/code/src/lsp_ext.ts +++ b/editors/code/src/lsp_ext.ts @@ -8,7 +8,10 @@ export const analyzerStatus = new lc.RequestType("rust-analy export const memoryUsage = new lc.RequestType("rust-analyzer/memoryUsage"); export type Status = "loading" | "ready" | "invalid" | "needsReload"; -export const status = new lc.NotificationType("rust-analyzer/status"); +export interface StatusParams { + status: Status; +} +export const status = new lc.NotificationType("rust-analyzer/status"); export const reloadWorkspace = new lc.RequestType("rust-analyzer/reloadWorkspace"); -- cgit v1.2.3 From 0866b1be894b9148cf69897a1e1aa70e3c416e29 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 18 Aug 2020 16:03:15 +0200 Subject: Align diagnostics config with the rest of rust-analyzer --- editors/code/package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'editors/code') diff --git a/editors/code/package.json b/editors/code/package.json index 429ff5def..f079f73b8 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -592,31 +592,31 @@ "default": true, "markdownDescription": "Whether to show experimental rust-analyzer diagnostics that might have more false positives than usual." }, - "rust-analyzer.diagnostics.warningsAsInfo": { + "rust-analyzer.diagnostics.disabled": { "type": "array", "uniqueItems": true, "items": { "type": "string" }, - "description": "List of warnings that should be displayed with info severity.\nThe warnings will be indicated by a blue squiggly underline in code and a blue icon in the problems panel.", + "description": "List of rust-analyzer diagnostics to disable", "default": [] }, - "rust-analyzer.diagnostics.warningsAsHint": { + "rust-analyzer.diagnostics.warningsAsInfo": { "type": "array", "uniqueItems": true, "items": { "type": "string" }, - "description": "List of warnings that should be displayed with hint severity.\nThe warnings will be indicated by faded text or three dots in code and will not show up in the problems panel.", + "description": "List of warnings that should be displayed with info severity.\nThe warnings will be indicated by a blue squiggly underline in code and a blue icon in the problems panel.", "default": [] }, - "rust-analyzer.analysis.disabledDiagnostics": { + "rust-analyzer.diagnostics.warningsAsHint": { "type": "array", "uniqueItems": true, "items": { "type": "string" }, - "description": "List of rust-analyzer diagnostics to disable", + "description": "List of warnings that should be displayed with hint severity.\nThe warnings will be indicated by faded text or three dots in code and will not show up in the problems panel.", "default": [] } } -- cgit v1.2.3 From 54d4bc2622bea8c56a36a300ffa9793525ee5d7a Mon Sep 17 00:00:00 2001 From: Veetaha Date: Fri, 21 Aug 2020 21:14:40 +0300 Subject: Dont ask me why... --- editors/code/src/util.ts | 1 - 1 file changed, 1 deletion(-) (limited to 'editors/code') diff --git a/editors/code/src/util.ts b/editors/code/src/util.ts index 49d2d1c6f..ec2087502 100644 --- a/editors/code/src/util.ts +++ b/editors/code/src/util.ts @@ -25,7 +25,6 @@ export const log = new class { debug(...msg: [unknown, ...unknown[]]): void { if (!log.enabled) return; log.write("DEBUG", ...msg); - log.output.toString(); } info(...msg: [unknown, ...unknown[]]): void { -- cgit v1.2.3