Skip to content

Commit

Permalink
Make js/ts quickfix-all action last item in group
Browse files Browse the repository at this point in the history
  • Loading branch information
mjbvz committed Sep 20, 2018
1 parent c0d1f91 commit df411e9
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions extensions/typescript-language-features/src/features/quickFix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,22 +131,25 @@ class DiagnosticsSet {
}

class CodeActionSet {
private _actions: vscode.CodeAction[] = [];
private _fixAllActions = new Set<{}>();
private _actions = new Set<vscode.CodeAction>();
private _fixAllActions = new Map<{}, vscode.CodeAction>();

public get values() {
public get values(): Iterable<vscode.CodeAction> {
return this._actions;
}

public addAction(action: vscode.CodeAction) {
this._actions.push(action);
this._actions.add(action);
}

public addFixAllAction(fixId: {}, action: vscode.CodeAction) {
if (!this.hasFixAllAction(fixId)) {
this.addAction(action);
this._fixAllActions.add(fixId);
const existing = this._fixAllActions.get(fixId);
if (existing) {
// reinsert action at back
this._actions.delete(existing);
}
this.addAction(action);
this._fixAllActions.set(fixId, action);
}

public hasFixAllAction(fixId: {}) {
Expand Down

0 comments on commit df411e9

Please sign in to comment.