aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShuiRuTian <[email protected]>2021-01-10 06:15:59 +0000
committerShuiRuTian <[email protected]>2021-01-10 06:15:59 +0000
commitf5a6fda3273ca9ee789479c3e1151a406c6b5b22 (patch)
tree8ea25ccb5790dbd7e139973a5c805c0b626609d5
parent09ed9d044495971c143dc8c9879dd92d3989976f (diff)
update format.
-rw-r--r--editors/code/src/client.ts17
1 files changed, 9 insertions, 8 deletions
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
51 'Rust Analyzer Language Server Trace', 51 'Rust Analyzer Language Server Trace',
52 ); 52 );
53 53
54 const workspace:lc.WorkspaceMiddleware = { 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 ){ 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: 56 // why add this function rather than default:
57 // 1. change `url` parameter to happy format for url crate. (folder should end with '/') 57 // 1. change `url` parameter to happy format for url crate. (folder should end with '/')
58 // 2. filter some change in here. 58 // 2. filter some change in here.
59 // 2.1 rename from or to `mod.rs` should be special. 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. 60 // 2.2 not all folder change should be cared, only those have files with ".rs" postfix.
61 let newFiles = data.files.map((file)=>{ 61 const newFiles = data.files.map((file) => {
62 const isFolder = !file.oldUri.path.endsWith(".rs"); 62 const isFolder = !file.oldUri.path.endsWith(".rs");
63 return !isFolder ? file : { 63 return !isFolder ? file : {
64 oldUri:vscode.Uri.file(file.oldUri.path+'/'), 64 oldUri: vscode.Uri.file(file.oldUri.path + '/'),
65 newUri:vscode.Uri.file(file.newUri.path+'/') 65 newUri: vscode.Uri.file(file.newUri.path + '/')
66 }}); 66 };
67 data = {...data, files:newFiles}; 67 });
68 data = { ...data, files: newFiles };
68 return next(data); 69 return next(data);
69 } 70 }
70 } 71 };
71 72
72 const clientOptions: lc.LanguageClientOptions = { 73 const clientOptions: lc.LanguageClientOptions = {
73 documentSelector: [{ scheme: 'file', language: 'rust' }], 74 documentSelector: [{ scheme: 'file', language: 'rust' }],