From 0d86e222297233387ad4abc2796dfd27c5333aaa Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Sun, 10 Jan 2021 01:29:08 +0800 Subject: beta version for folder rename --- editors/code/src/client.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'editors/code') diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts index 539e487ec..2a8f2deb4 100644 --- a/editors/code/src/client.ts +++ b/editors/code/src/client.ts @@ -51,12 +51,24 @@ export function createClient(serverPath: string, cwd: string, extraEnv: Env): lc 'Rust Analyzer Language Server Trace', ); + const workspace:lc.WorkspaceMiddleware = { + willRenameFiles:function

>(this: void, data: P, next:(data: P) => R ){ + // why add this function rather than default: + // 1. change `url` parameter to happy format for url crate. (folder should end with '/') + // 2. filter some change in here. + // 2.1 rename from or to `mod.rs` should be special. + // 2.2 not all folder change should be cared, only those have files with ".rs" postfix. + return next(data); + } + } + const clientOptions: lc.LanguageClientOptions = { documentSelector: [{ scheme: 'file', language: 'rust' }], initializationOptions: vscode.workspace.getConfiguration("rust-analyzer"), diagnosticCollectionName: "rustc", traceOutputChannel, middleware: { + workspace, provideDocumentSemanticTokens(document: vscode.TextDocument, token: vscode.CancellationToken, next: DocumentSemanticsTokensSignature): vscode.ProviderResult { return semanticHighlightingWorkaround(next, document, token); }, -- cgit v1.2.3