mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Apply the api design suggestions
This commit is contained in:
parent
73dc8b6f06
commit
78a21253b4
10 changed files with 97 additions and 59 deletions
|
@ -34,8 +34,20 @@ function showReferences(ctx: Ctx): Cmd {
|
|||
}
|
||||
|
||||
function applySourceChange(ctx: Ctx): Cmd {
|
||||
return async (change: sourceChange.SourceChange, alternativeChanges: sourceChange.SourceChange[] | undefined) => {
|
||||
sourceChange.applySourceChange(ctx, change, alternativeChanges);
|
||||
return async (change: sourceChange.SourceChange) => {
|
||||
sourceChange.applySourceChange(ctx, change);
|
||||
};
|
||||
}
|
||||
|
||||
function selectAndApplySourceChange(ctx: Ctx): Cmd {
|
||||
return async (changes: sourceChange.SourceChange[]) => {
|
||||
if (changes.length === 1) {
|
||||
await sourceChange.applySourceChange(ctx, changes[0]);
|
||||
} else if (changes.length > 0) {
|
||||
const selectedChange = await vscode.window.showQuickPick(changes);
|
||||
if (!selectedChange) return;
|
||||
await sourceChange.applySourceChange(ctx, selectedChange);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -59,5 +71,6 @@ export {
|
|||
runSingle,
|
||||
showReferences,
|
||||
applySourceChange,
|
||||
selectAndApplySourceChange,
|
||||
reload
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue