Skip to content

Commit 796d527

Browse files
authored
Move hover action ids into a separate file (microsoft#210449)
moving hover action ids into a separate file
1 parent 31fba19 commit 796d527

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
export const SHOW_OR_FOCUS_HOVER_ACTION_ID = 'editor.action.showHover';
7+
export const SHOW_DEFINITION_PREVIEW_HOVER_ACTION_ID = 'editor.action.showDefinitionPreviewHover';
8+
export const SCROLL_UP_HOVER_ACTION_ID = 'editor.action.scrollUpHover';
9+
export const SCROLL_DOWN_HOVER_ACTION_ID = 'editor.action.scrollDownHover';
10+
export const SCROLL_LEFT_HOVER_ACTION_ID = 'editor.action.scrollLeftHover';
11+
export const SCROLL_RIGHT_HOVER_ACTION_ID = 'editor.action.scrollRightHover';
12+
export const PAGE_UP_HOVER_ACTION_ID = 'editor.action.pageUpHover';
13+
export const PAGE_DOWN_HOVER_ACTION_ID = 'editor.action.pageDownHover';
14+
export const GO_TO_TOP_HOVER_ACTION_ID = 'editor.action.goToTopHover';
15+
export const GO_TO_BOTTOM_HOVER_ACTION_ID = 'editor.action.goToBottomHover';

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

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

6+
import { GO_TO_BOTTOM_HOVER_ACTION_ID, GO_TO_TOP_HOVER_ACTION_ID, PAGE_DOWN_HOVER_ACTION_ID, PAGE_UP_HOVER_ACTION_ID, SCROLL_DOWN_HOVER_ACTION_ID, SCROLL_LEFT_HOVER_ACTION_ID, SCROLL_RIGHT_HOVER_ACTION_ID, SCROLL_UP_HOVER_ACTION_ID, SHOW_DEFINITION_PREVIEW_HOVER_ACTION_ID, SHOW_OR_FOCUS_HOVER_ACTION_ID } from 'vs/editor/contrib/hover/browser/hoverActionIds';
67
import { KeyChord, KeyCode, KeyMod } from 'vs/base/common/keyCodes';
78
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
89
import { EditorAction, ServicesAccessor } from 'vs/editor/browser/editorExtensions';
@@ -27,7 +28,7 @@ export class ShowOrFocusHoverAction extends EditorAction {
2728

2829
constructor() {
2930
super({
30-
id: 'editor.action.showHover',
31+
id: SHOW_OR_FOCUS_HOVER_ACTION_ID,
3132
label: nls.localize({
3233
key: 'showOrFocusHover',
3334
comment: [
@@ -109,7 +110,7 @@ export class ShowDefinitionPreviewHoverAction extends EditorAction {
109110

110111
constructor() {
111112
super({
112-
id: 'editor.action.showDefinitionPreviewHover',
113+
id: SHOW_DEFINITION_PREVIEW_HOVER_ACTION_ID,
113114
label: nls.localize({
114115
key: 'showDefinitionPreviewHover',
115116
comment: [
@@ -153,7 +154,7 @@ export class ScrollUpHoverAction extends EditorAction {
153154

154155
constructor() {
155156
super({
156-
id: 'editor.action.scrollUpHover',
157+
id: SCROLL_UP_HOVER_ACTION_ID,
157158
label: nls.localize({
158159
key: 'scrollUpHover',
159160
comment: [
@@ -186,7 +187,7 @@ export class ScrollDownHoverAction extends EditorAction {
186187

187188
constructor() {
188189
super({
189-
id: 'editor.action.scrollDownHover',
190+
id: SCROLL_DOWN_HOVER_ACTION_ID,
190191
label: nls.localize({
191192
key: 'scrollDownHover',
192193
comment: [
@@ -219,7 +220,7 @@ export class ScrollLeftHoverAction extends EditorAction {
219220

220221
constructor() {
221222
super({
222-
id: 'editor.action.scrollLeftHover',
223+
id: SCROLL_LEFT_HOVER_ACTION_ID,
223224
label: nls.localize({
224225
key: 'scrollLeftHover',
225226
comment: [
@@ -252,7 +253,7 @@ export class ScrollRightHoverAction extends EditorAction {
252253

253254
constructor() {
254255
super({
255-
id: 'editor.action.scrollRightHover',
256+
id: SCROLL_RIGHT_HOVER_ACTION_ID,
256257
label: nls.localize({
257258
key: 'scrollRightHover',
258259
comment: [
@@ -285,7 +286,7 @@ export class PageUpHoverAction extends EditorAction {
285286

286287
constructor() {
287288
super({
288-
id: 'editor.action.pageUpHover',
289+
id: PAGE_UP_HOVER_ACTION_ID,
289290
label: nls.localize({
290291
key: 'pageUpHover',
291292
comment: [
@@ -319,7 +320,7 @@ export class PageDownHoverAction extends EditorAction {
319320

320321
constructor() {
321322
super({
322-
id: 'editor.action.pageDownHover',
323+
id: PAGE_DOWN_HOVER_ACTION_ID,
323324
label: nls.localize({
324325
key: 'pageDownHover',
325326
comment: [
@@ -353,7 +354,7 @@ export class GoToTopHoverAction extends EditorAction {
353354

354355
constructor() {
355356
super({
356-
id: 'editor.action.goToTopHover',
357+
id: GO_TO_TOP_HOVER_ACTION_ID,
357358
label: nls.localize({
358359
key: 'goToTopHover',
359360
comment: [
@@ -388,7 +389,7 @@ export class GoToBottomHoverAction extends EditorAction {
388389

389390
constructor() {
390391
super({
391-
id: 'editor.action.goToBottomHover',
392+
id: GO_TO_BOTTOM_HOVER_ACTION_ID,
392393
label: nls.localize({
393394
key: 'goToBottomHover',
394395
comment: [

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +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';
67
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
78
import { KeyCode } from 'vs/base/common/keyCodes';
89
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
@@ -332,7 +333,7 @@ export class HoverController extends Disposable implements IEditorContribution {
332333
const mightTriggerFocus = (
333334
resolvedKeyboardEvent.kind === ResultKind.MoreChordsNeeded ||
334335
(resolvedKeyboardEvent.kind === ResultKind.KbFound
335-
&& resolvedKeyboardEvent.commandId === 'editor.action.showHover'
336+
&& resolvedKeyboardEvent.commandId === SHOW_OR_FOCUS_HOVER_ACTION_ID
336337
&& this._contentWidget?.isVisible
337338
)
338339
);

0 commit comments

Comments
 (0)