From f5a6fda3273ca9ee789479c3e1151a406c6b5b22 Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Sun, 10 Jan 2021 14:15:59 +0800 Subject: update format. --- editors/code/src/client.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'editors/code/src') diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts index fb8cd4873..772892b07 100644 --- a/editors/code/src/client.ts +++ b/editors/code/src/client.ts @@ -51,23 +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 ){ + 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. - let newFiles = data.files.map((file)=>{ + const newFiles = data.files.map((file) => { const isFolder = !file.oldUri.path.endsWith(".rs"); return !isFolder ? file : { - oldUri:vscode.Uri.file(file.oldUri.path+'/'), - newUri:vscode.Uri.file(file.newUri.path+'/') - }}); - data = {...data, files:newFiles}; + oldUri: vscode.Uri.file(file.oldUri.path + '/'), + newUri: vscode.Uri.file(file.newUri.path + '/') + }; + }); + data = { ...data, files: newFiles }; return next(data); } - } + }; const clientOptions: lc.LanguageClientOptions = { documentSelector: [{ scheme: 'file', language: 'rust' }], -- cgit v1.2.3