Skip to content

Commit 8884ca8

Browse files
author
Justin Chen
committed
fixing microsoft#145058 and code clean up
1 parent b5f77d1 commit 8884ca8

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

src/vs/editor/contrib/codeAction/browser/codeActionMenu.ts

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -279,17 +279,13 @@ export class CodeActionMenu extends Disposable implements IEditorContribution {
279279
this.codeActionList.value?.layout(height, maxWidth);
280280

281281
// List selection
282-
this.focusedEnabledItem = 0;
283-
this.currSelectedItem = this.viewItems[0].index;
284-
this.codeActionList.value.setFocus([this.currSelectedItem]);
285-
286-
287-
// const focusTracker = this._register(dom.trackFocus(element));
288-
// this._register(focusTracker.onDidBlur(() => {
289-
// if (dom.getActiveElement() === element || !dom.isAncestor(dom.getActiveElement(), element)) {
290-
// this.hideCodeActionWidget();
291-
// }
292-
// }));
282+
if (this.viewItems.length <= 1 && this.viewItems[0].title === 'Learn more about JS/TS refactorings') {
283+
this.currSelectedItem = 0;
284+
} else {
285+
this.focusedEnabledItem = 0;
286+
this.currSelectedItem = this.viewItems[0].index;
287+
this.codeActionList.value.setFocus([this.currSelectedItem]);
288+
}
293289

294290
// List Focus
295291
this.codeActionList.value.domFocus();
@@ -310,7 +306,7 @@ export class CodeActionMenu extends Disposable implements IEditorContribution {
310306
protected focusPrevious() {
311307
if (typeof this.focusedEnabledItem === 'undefined') {
312308
this.focusedEnabledItem = this.viewItems[0].index;
313-
} else if (this.viewItems.length <= 1) {
309+
} else if (this.viewItems.length <= 1 && this.viewItems[0].title !== 'Learn more about JS/TS refactorings') {
314310
return false;
315311
}
316312

@@ -333,7 +329,7 @@ export class CodeActionMenu extends Disposable implements IEditorContribution {
333329
protected focusNext() {
334330
if (typeof this.focusedEnabledItem === 'undefined') {
335331
this.focusedEnabledItem = this.viewItems.length - 1;
336-
} else if (this.viewItems.length <= 1) {
332+
} else if (this.viewItems.length <= 1 && this.viewItems[0].title !== 'Learn more about JS/TS refactorings') {
337333
return false;
338334
}
339335

0 commit comments

Comments
 (0)