]> git.lizzy.rs Git - rust.git/commitdiff
update format.
authorShuiRuTian <158983297@qq.com>
Sun, 10 Jan 2021 06:15:59 +0000 (14:15 +0800)
committerShuiRuTian <158983297@qq.com>
Sun, 10 Jan 2021 06:15:59 +0000 (14:15 +0800)
editors/code/src/client.ts

index fb8cd4873ce1379ba11cbe531dc00a0eaf9bbe88..772892b079ba2016677d7dcaaaf36e1ab9b4cc7d 100644 (file)
@@ -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<P extends vscode.FileRenameEvent,R extends Thenable<vscode.WorkspaceEdit | null | undefined>>(this: void, data: P, next:(data: P) => R ){
+    const workspace: lc.WorkspaceMiddleware = {
+        willRenameFiles: function <P extends vscode.FileRenameEvent, R extends Thenable<vscode.WorkspaceEdit | null | undefined>>(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' }],