diff options
author | ShuiRuTian <[email protected]> | 2021-01-09 17:29:08 +0000 |
---|---|---|
committer | ShuiRuTian <[email protected]> | 2021-01-09 17:29:08 +0000 |
commit | 0d86e222297233387ad4abc2796dfd27c5333aaa (patch) | |
tree | 740e53bdc4ab3b309dbf23471a01511d3ccd281a /editors | |
parent | c08391ce32c471d09fcc6fe48bd295bbb5a7de10 (diff) |
beta version for folder rename
Diffstat (limited to 'editors')
-rw-r--r-- | editors/code/src/client.ts | 12 |
1 files changed, 12 insertions, 0 deletions
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 | |||
51 | 'Rust Analyzer Language Server Trace', | 51 | 'Rust Analyzer Language Server Trace', |
52 | ); | 52 | ); |
53 | 53 | ||
54 | const workspace:lc.WorkspaceMiddleware = { | ||
55 | willRenameFiles:function<P extends vscode.FileRenameEvent,R extends Thenable<vscode.WorkspaceEdit | null | undefined>>(this: void, data: P, next:(data: P) => R ){ | ||
56 | // why add this function rather than default: | ||
57 | // 1. change `url` parameter to happy format for url crate. (folder should end with '/') | ||
58 | // 2. filter some change in here. | ||
59 | // 2.1 rename from or to `mod.rs` should be special. | ||
60 | // 2.2 not all folder change should be cared, only those have files with ".rs" postfix. | ||
61 | return next(data); | ||
62 | } | ||
63 | } | ||
64 | |||
54 | const clientOptions: lc.LanguageClientOptions = { | 65 | const clientOptions: lc.LanguageClientOptions = { |
55 | documentSelector: [{ scheme: 'file', language: 'rust' }], | 66 | documentSelector: [{ scheme: 'file', language: 'rust' }], |
56 | initializationOptions: vscode.workspace.getConfiguration("rust-analyzer"), | 67 | initializationOptions: vscode.workspace.getConfiguration("rust-analyzer"), |
57 | diagnosticCollectionName: "rustc", | 68 | diagnosticCollectionName: "rustc", |
58 | traceOutputChannel, | 69 | traceOutputChannel, |
59 | middleware: { | 70 | middleware: { |
71 | workspace, | ||
60 | provideDocumentSemanticTokens(document: vscode.TextDocument, token: vscode.CancellationToken, next: DocumentSemanticsTokensSignature): vscode.ProviderResult<vscode.SemanticTokens> { | 72 | provideDocumentSemanticTokens(document: vscode.TextDocument, token: vscode.CancellationToken, next: DocumentSemanticsTokensSignature): vscode.ProviderResult<vscode.SemanticTokens> { |
61 | return semanticHighlightingWorkaround(next, document, token); | 73 | return semanticHighlightingWorkaround(next, document, token); |
62 | }, | 74 | }, |