Skip to content

Commit e5faffe

Browse files
authored
Keep hover open when increase hover verbosity or decrease hover verbosity actions are triggered (microsoft#211331)
* checking that the increase or decrease actions are not called either * renaming the variable to better represent its meaning
1 parent 34e1f76 commit e5faffe

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/vs/editor/contrib/hover/browser/hoverController.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { SHOW_OR_FOCUS_HOVER_ACTION_ID } from 'vs/editor/contrib/hover/browser/hoverActionIds';
6+
import { DECREASE_HOVER_VERBOSITY_ACTION_ID, INCREASE_HOVER_VERBOSITY_ACTION_ID, SHOW_OR_FOCUS_HOVER_ACTION_ID } from 'vs/editor/contrib/hover/browser/hoverActionIds';
77
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
88
import { KeyCode } from 'vs/base/common/keyCodes';
99
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
@@ -332,10 +332,12 @@ export class HoverController extends Disposable implements IEditorContribution {
332332
// If the beginning of a multi-chord keybinding is pressed,
333333
// or the command aims to focus the hover,
334334
// set the variable to true, otherwise false
335-
const mightTriggerFocus = (
335+
const shouldKeepHoverVisible = (
336336
resolvedKeyboardEvent.kind === ResultKind.MoreChordsNeeded ||
337337
(resolvedKeyboardEvent.kind === ResultKind.KbFound
338-
&& resolvedKeyboardEvent.commandId === SHOW_OR_FOCUS_HOVER_ACTION_ID
338+
&& (resolvedKeyboardEvent.commandId === SHOW_OR_FOCUS_HOVER_ACTION_ID
339+
|| resolvedKeyboardEvent.commandId === INCREASE_HOVER_VERBOSITY_ACTION_ID
340+
|| resolvedKeyboardEvent.commandId === DECREASE_HOVER_VERBOSITY_ACTION_ID)
339341
&& this._contentWidget?.isVisible
340342
)
341343
);
@@ -345,7 +347,7 @@ export class HoverController extends Disposable implements IEditorContribution {
345347
|| e.keyCode === KeyCode.Alt
346348
|| e.keyCode === KeyCode.Meta
347349
|| e.keyCode === KeyCode.Shift
348-
|| mightTriggerFocus
350+
|| shouldKeepHoverVisible
349351
) {
350352
// Do not hide hover when a modifier key is pressed
351353
return;

0 commit comments

Comments
 (0)