history: fix layer breaker

Fixes #140856
This commit is contained in:
Connor Peet 2022-02-07 11:49:39 -08:00
parent 13b4243e76
commit 84642bf493
No known key found for this signature in database
GPG key ID: CF8FD2EA0DBC61BD
2 changed files with 6 additions and 5 deletions

View file

@ -25,9 +25,10 @@ import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { LanguageFeatureRegistry } from 'vs/editor/common/languageFeatureRegistry';
import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { historyNavigationVisible } from 'vs/platform/history/browser/contextScopedHistoryWidget';
export const Context = {
Visible: new RawContextKey<boolean>('suggestWidgetVisible', false, localize('suggestWidgetVisible', "Whether suggestion are visible")),
Visible: historyNavigationVisible,
DetailsVisible: new RawContextKey<boolean>('suggestWidgetDetailsVisible', false, localize('suggestWidgetDetailsVisible', "Whether suggestion details are visible")),
MultipleSuggestions: new RawContextKey<boolean>('suggestWidgetMultipleSuggestions', false, localize('suggestWidgetMultipleSuggestions', "Whether there are multiple suggestions to pick from")),
MakesTextEdit: new RawContextKey('suggestionMakesTextEdit', true, localize('suggestionMakesTextEdit', "Whether inserting the current suggestion yields in a change or has everything already been typed")),

View file

@ -11,9 +11,9 @@ import { HistoryInputBox, IHistoryInputOptions } from 'vs/base/browser/ui/inputb
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { ContextKeyExpr, IContextKey, IContextKeyService, IContextKeyServiceTarget, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { localize } from 'vs/nls';
// TODO@Connor: this constant is duplicated here to avoid a layer breaker import
const suggestWidgetVisibleContext = 'suggestWidgetVisible';
export const historyNavigationVisible = new RawContextKey<boolean>('suggestWidgetVisible', false, localize('suggestWidgetVisible', "Whether suggestion are visible"));
export const HistoryNavigationWidgetContext = 'historyNavigationWidget';
const HistoryNavigationForwardsEnablementContext = 'historyNavigationForwardsEnabled';
@ -95,7 +95,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
when: ContextKeyExpr.and(
ContextKeyExpr.has(HistoryNavigationWidgetContext),
ContextKeyExpr.equals(HistoryNavigationBackwardsEnablementContext, true),
ContextKeyExpr.equals(suggestWidgetVisibleContext, false),
historyNavigationVisible.isEqualTo(false),
),
primary: KeyCode.UpArrow,
secondary: [KeyMod.Alt | KeyCode.UpArrow],
@ -114,7 +114,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
when: ContextKeyExpr.and(
ContextKeyExpr.has(HistoryNavigationWidgetContext),
ContextKeyExpr.equals(HistoryNavigationForwardsEnablementContext, true),
ContextKeyExpr.equals(suggestWidgetVisibleContext, false),
historyNavigationVisible.isEqualTo(false),
),
primary: KeyCode.DownArrow,
secondary: [KeyMod.Alt | KeyCode.DownArrow],