Skip to content

Commit 58ec27d

Browse files
committed
fix: moved CommonCommands to separate file
With CommandComamnds being part of the packages/core/src/browser/common-frontend-contribution.ts file we get circular dependencies. This leads to issues especially when running tests. The Commands are now moved to an own file. This is a breaking change for whoever does a deep import of the CommonCommands namespace.
1 parent 969039f commit 58ec27d

File tree

6 files changed

+291
-266
lines changed

6 files changed

+291
-266
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
- [Previous Changelogs](https://github.com/eclipse-theia/theia/tree/master/doc/changelogs/)
66

7+
## 1.67.0 - TBD
8+
9+
<a name="breaking_changes_1.67.0">[Breaking Changes:](#breaking_changes_1.67.0)</a>
10+
11+
- [core] `CommonCommands` has been extracted from `common-frontend-contribution.ts` into its own file `common-commands.ts`. This only affects code using deep imports: imports of `CommonCommands` from `@theia/core/lib/browser/common-frontend-contribution` should be updated to use the standard barrel export `@theia/core/lib/browser` instead.
12+
713
## 1.66.0 - 10/30/2025
814

915
- [ai-anthropic] allowed configuring proxy settings [#16453](https://github.com/eclipse-theia/theia/pull/16453)
Lines changed: 281 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,281 @@
1+
// *****************************************************************************
2+
// Copyright (C) 2017 TypeFox and others.
3+
//
4+
// This program and the accompanying materials are made available under the
5+
// terms of the Eclipse Public License v. 2.0 which is available at
6+
// http://www.eclipse.org/legal/epl-2.0.
7+
//
8+
// This Source Code may also be made available under the following Secondary
9+
// Licenses when the conditions for such availability set forth in the Eclipse
10+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
11+
// with the GNU Classpath Exception which is available at
12+
// https://www.gnu.org/software/classpath/license.html.
13+
//
14+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15+
// *****************************************************************************
16+
17+
import { Command } from '../common/command';
18+
import { nls } from '../common/nls';
19+
20+
export namespace CommonCommands {
21+
22+
export const FILE_CATEGORY = 'File';
23+
export const VIEW_CATEGORY = 'View';
24+
export const CREATE_CATEGORY = 'Create';
25+
export const PREFERENCES_CATEGORY = 'Preferences';
26+
export const MANAGE_CATEGORY = 'Manage';
27+
export const FILE_CATEGORY_KEY = nls.getDefaultKey(FILE_CATEGORY);
28+
export const VIEW_CATEGORY_KEY = nls.getDefaultKey(VIEW_CATEGORY);
29+
export const PREFERENCES_CATEGORY_KEY = nls.getDefaultKey(PREFERENCES_CATEGORY);
30+
31+
export const OPEN: Command = {
32+
id: 'core.open',
33+
};
34+
35+
export const CUT = Command.toDefaultLocalizedCommand({
36+
id: 'core.cut',
37+
label: 'Cut'
38+
});
39+
export const COPY = Command.toDefaultLocalizedCommand({
40+
id: 'core.copy',
41+
label: 'Copy'
42+
});
43+
export const PASTE = Command.toDefaultLocalizedCommand({
44+
id: 'core.paste',
45+
label: 'Paste'
46+
});
47+
48+
export const COPY_PATH = Command.toDefaultLocalizedCommand({
49+
id: 'core.copy.path',
50+
label: 'Copy Path'
51+
});
52+
53+
export const UNDO = Command.toDefaultLocalizedCommand({
54+
id: 'core.undo',
55+
label: 'Undo'
56+
});
57+
export const REDO = Command.toDefaultLocalizedCommand({
58+
id: 'core.redo',
59+
label: 'Redo'
60+
});
61+
export const SELECT_ALL = Command.toDefaultLocalizedCommand({
62+
id: 'core.selectAll',
63+
label: 'Select All'
64+
});
65+
66+
export const FIND = Command.toDefaultLocalizedCommand({
67+
id: 'core.find',
68+
label: 'Find'
69+
});
70+
export const REPLACE = Command.toDefaultLocalizedCommand({
71+
id: 'core.replace',
72+
label: 'Replace'
73+
});
74+
75+
export const NEXT_TAB = Command.toDefaultLocalizedCommand({
76+
id: 'core.nextTab',
77+
category: VIEW_CATEGORY,
78+
label: 'Show Next Tab'
79+
});
80+
export const PREVIOUS_TAB = Command.toDefaultLocalizedCommand({
81+
id: 'core.previousTab',
82+
category: VIEW_CATEGORY,
83+
label: 'Show Previous Tab'
84+
});
85+
export const NEXT_TAB_IN_GROUP = Command.toLocalizedCommand({
86+
id: 'core.nextTabInGroup',
87+
category: VIEW_CATEGORY,
88+
label: 'Switch to Next Tab in Group'
89+
}, 'theia/core/common/showNextTabInGroup', VIEW_CATEGORY_KEY);
90+
export const PREVIOUS_TAB_IN_GROUP = Command.toLocalizedCommand({
91+
id: 'core.previousTabInGroup',
92+
category: VIEW_CATEGORY,
93+
label: 'Switch to Previous Tab in Group'
94+
}, 'theia/core/common/showPreviousTabInGroup', VIEW_CATEGORY_KEY);
95+
export const NEXT_TAB_GROUP = Command.toLocalizedCommand({
96+
id: 'core.nextTabGroup',
97+
category: VIEW_CATEGORY,
98+
label: 'Switch to Next Tab Group'
99+
}, 'theia/core/common/showNextTabGroup', VIEW_CATEGORY_KEY);
100+
export const PREVIOUS_TAB_GROUP = Command.toLocalizedCommand({
101+
id: 'core.previousTabBar',
102+
category: VIEW_CATEGORY,
103+
label: 'Switch to Previous Tab Group'
104+
}, 'theia/core/common/showPreviousTabGroup', VIEW_CATEGORY_KEY);
105+
export const CLOSE_TAB = Command.toLocalizedCommand({
106+
id: 'core.close.tab',
107+
category: VIEW_CATEGORY,
108+
label: 'Close Tab'
109+
}, 'theia/core/common/closeTab', VIEW_CATEGORY_KEY);
110+
export const CLOSE_OTHER_TABS = Command.toLocalizedCommand({
111+
id: 'core.close.other.tabs',
112+
category: VIEW_CATEGORY,
113+
label: 'Close Other Tabs'
114+
}, 'theia/core/common/closeOthers', VIEW_CATEGORY_KEY);
115+
export const CLOSE_SAVED_TABS = Command.toDefaultLocalizedCommand({
116+
id: 'workbench.action.closeUnmodifiedEditors',
117+
category: VIEW_CATEGORY,
118+
label: 'Close Saved Editors in Group',
119+
});
120+
export const CLOSE_RIGHT_TABS = Command.toLocalizedCommand({
121+
id: 'core.close.right.tabs',
122+
category: VIEW_CATEGORY,
123+
label: 'Close Tabs to the Right'
124+
}, 'theia/core/common/closeRight', VIEW_CATEGORY_KEY);
125+
export const CLOSE_ALL_TABS = Command.toLocalizedCommand({
126+
id: 'core.close.all.tabs',
127+
category: VIEW_CATEGORY,
128+
label: 'Close All Tabs'
129+
}, 'theia/core/common/closeAll', VIEW_CATEGORY_KEY);
130+
export const CLOSE_MAIN_TAB = Command.toLocalizedCommand({
131+
id: 'core.close.main.tab',
132+
category: VIEW_CATEGORY,
133+
label: 'Close Tab in Main Area'
134+
}, 'theia/core/common/closeTabMain', VIEW_CATEGORY_KEY);
135+
export const CLOSE_OTHER_MAIN_TABS = Command.toLocalizedCommand({
136+
id: 'core.close.other.main.tabs',
137+
category: VIEW_CATEGORY,
138+
label: 'Close Other Tabs in Main Area'
139+
}, 'theia/core/common/closeOtherTabMain', VIEW_CATEGORY_KEY);
140+
export const CLOSE_ALL_MAIN_TABS = Command.toLocalizedCommand({
141+
id: 'core.close.all.main.tabs',
142+
category: VIEW_CATEGORY,
143+
label: 'Close All Tabs in Main Area'
144+
}, 'theia/core/common/closeAllTabMain', VIEW_CATEGORY_KEY);
145+
export const COLLAPSE_PANEL = Command.toLocalizedCommand({
146+
id: 'core.collapse.tab',
147+
category: VIEW_CATEGORY,
148+
label: 'Collapse Side Panel'
149+
}, 'theia/core/common/collapseTab', VIEW_CATEGORY_KEY);
150+
export const COLLAPSE_ALL_PANELS = Command.toLocalizedCommand({
151+
id: 'core.collapse.all.tabs',
152+
category: VIEW_CATEGORY,
153+
label: 'Collapse All Side Panels'
154+
}, 'theia/core/common/collapseAllTabs', VIEW_CATEGORY_KEY);
155+
export const TOGGLE_BOTTOM_PANEL = Command.toLocalizedCommand({
156+
id: 'core.toggle.bottom.panel',
157+
category: VIEW_CATEGORY,
158+
label: 'Toggle Bottom Panel'
159+
}, 'theia/core/common/collapseBottomPanel', VIEW_CATEGORY_KEY);
160+
export const TOGGLE_LEFT_PANEL = Command.toLocalizedCommand({
161+
id: 'core.toggle.left.panel',
162+
category: VIEW_CATEGORY,
163+
label: 'Toggle Left Panel'
164+
}, 'theia/core/common/collapseLeftPanel', VIEW_CATEGORY_KEY);
165+
export const TOGGLE_RIGHT_PANEL = Command.toLocalizedCommand({
166+
id: 'core.toggle.right.panel',
167+
category: VIEW_CATEGORY,
168+
label: 'Toggle Right Panel'
169+
}, 'theia/core/common/collapseRightPanel', VIEW_CATEGORY_KEY);
170+
export const TOGGLE_STATUS_BAR = Command.toDefaultLocalizedCommand({
171+
id: 'workbench.action.toggleStatusbarVisibility',
172+
category: VIEW_CATEGORY,
173+
label: 'Toggle Status Bar Visibility'
174+
});
175+
export const PIN_TAB = Command.toDefaultLocalizedCommand({
176+
id: 'workbench.action.pinEditor',
177+
category: VIEW_CATEGORY,
178+
label: 'Pin Editor'
179+
});
180+
export const UNPIN_TAB = Command.toDefaultLocalizedCommand({
181+
id: 'workbench.action.unpinEditor',
182+
category: VIEW_CATEGORY,
183+
label: 'Unpin Editor'
184+
});
185+
export const TOGGLE_MAXIMIZED = Command.toLocalizedCommand({
186+
id: 'core.toggleMaximized',
187+
category: VIEW_CATEGORY,
188+
label: 'Toggle Maximized'
189+
}, 'theia/core/common/toggleMaximized', VIEW_CATEGORY_KEY);
190+
export const OPEN_VIEW = Command.toDefaultLocalizedCommand({
191+
id: 'core.openView',
192+
category: VIEW_CATEGORY,
193+
label: 'Open View...'
194+
});
195+
export const SHOW_MENU_BAR = Command.toDefaultLocalizedCommand({
196+
id: 'window.menuBarVisibility',
197+
category: VIEW_CATEGORY,
198+
label: 'Toggle Menu Bar'
199+
});
200+
/**
201+
* Command Parameters:
202+
* - `fileName`: string
203+
* - `directory`: URI
204+
*/
205+
export const NEW_FILE = Command.toDefaultLocalizedCommand({
206+
id: 'workbench.action.files.newFile',
207+
category: FILE_CATEGORY
208+
});
209+
// This command immediately opens a new untitled text file
210+
// Some VS Code extensions use this command to create new files
211+
export const NEW_UNTITLED_TEXT_FILE = Command.toDefaultLocalizedCommand({
212+
id: 'workbench.action.files.newUntitledFile',
213+
category: FILE_CATEGORY,
214+
label: 'New Untitled Text File'
215+
});
216+
// This command opens a quick pick to select a file type to create
217+
export const PICK_NEW_FILE = Command.toDefaultLocalizedCommand({
218+
id: 'workbench.action.files.pickNewFile',
219+
category: CREATE_CATEGORY,
220+
label: 'New File...'
221+
});
222+
export const SAVE = Command.toDefaultLocalizedCommand({
223+
id: 'core.save',
224+
category: FILE_CATEGORY,
225+
label: 'Save',
226+
});
227+
export const SAVE_AS = Command.toDefaultLocalizedCommand({
228+
id: 'file.saveAs',
229+
category: FILE_CATEGORY,
230+
label: 'Save As...',
231+
});
232+
export const SAVE_WITHOUT_FORMATTING = Command.toDefaultLocalizedCommand({
233+
id: 'core.saveWithoutFormatting',
234+
category: FILE_CATEGORY,
235+
label: 'Save without Formatting',
236+
});
237+
export const SAVE_ALL = Command.toDefaultLocalizedCommand({
238+
id: 'core.saveAll',
239+
category: FILE_CATEGORY,
240+
label: 'Save All',
241+
});
242+
243+
export const AUTO_SAVE = Command.toDefaultLocalizedCommand({
244+
id: 'textEditor.commands.autosave',
245+
category: FILE_CATEGORY,
246+
label: 'Auto Save',
247+
});
248+
249+
export const ABOUT_COMMAND = Command.toDefaultLocalizedCommand({
250+
id: 'core.about',
251+
label: 'About'
252+
});
253+
254+
export const OPEN_PREFERENCES = Command.toDefaultLocalizedCommand({
255+
id: 'preferences:open',
256+
category: PREFERENCES_CATEGORY,
257+
label: 'Open Settings (UI)',
258+
});
259+
260+
export const SELECT_COLOR_THEME = Command.toDefaultLocalizedCommand({
261+
id: 'workbench.action.selectTheme',
262+
label: 'Color Theme',
263+
category: PREFERENCES_CATEGORY
264+
});
265+
export const SELECT_ICON_THEME = Command.toDefaultLocalizedCommand({
266+
id: 'workbench.action.selectIconTheme',
267+
label: 'File Icon Theme',
268+
category: PREFERENCES_CATEGORY
269+
});
270+
271+
export const CONFIGURE_DISPLAY_LANGUAGE = Command.toDefaultLocalizedCommand({
272+
id: 'workbench.action.configureLanguage',
273+
label: 'Configure Display Language'
274+
});
275+
276+
export const TOGGLE_BREADCRUMBS = Command.toDefaultLocalizedCommand({
277+
id: 'breadcrumbs.toggle',
278+
label: 'Toggle Breadcrumbs',
279+
category: VIEW_CATEGORY
280+
});
281+
}

0 commit comments

Comments
 (0)