mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 15:15:24 +00:00
update format.
This commit is contained in:
parent
09ed9d0444
commit
f5a6fda327
1 changed files with 9 additions and 8 deletions
|
@ -51,23 +51,24 @@ export function createClient(serverPath: string, cwd: string, extraEnv: Env): lc
|
||||||
'Rust Analyzer Language Server Trace',
|
'Rust Analyzer Language Server Trace',
|
||||||
);
|
);
|
||||||
|
|
||||||
const workspace:lc.WorkspaceMiddleware = {
|
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 ){
|
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:
|
// why add this function rather than default:
|
||||||
// 1. change `url` parameter to happy format for url crate. (folder should end with '/')
|
// 1. change `url` parameter to happy format for url crate. (folder should end with '/')
|
||||||
// 2. filter some change in here.
|
// 2. filter some change in here.
|
||||||
// 2.1 rename from or to `mod.rs` should be special.
|
// 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.
|
// 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");
|
const isFolder = !file.oldUri.path.endsWith(".rs");
|
||||||
return !isFolder ? file : {
|
return !isFolder ? file : {
|
||||||
oldUri:vscode.Uri.file(file.oldUri.path+'/'),
|
oldUri: vscode.Uri.file(file.oldUri.path + '/'),
|
||||||
newUri:vscode.Uri.file(file.newUri.path+'/')
|
newUri: vscode.Uri.file(file.newUri.path + '/')
|
||||||
}});
|
};
|
||||||
data = {...data, files:newFiles};
|
});
|
||||||
|
data = { ...data, files: newFiles };
|
||||||
return next(data);
|
return next(data);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
const clientOptions: lc.LanguageClientOptions = {
|
const clientOptions: lc.LanguageClientOptions = {
|
||||||
documentSelector: [{ scheme: 'file', language: 'rust' }],
|
documentSelector: [{ scheme: 'file', language: 'rust' }],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue