дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 11:15:40 +02:00
feat(plugins): group a plugin's context menu entries under a submenu (#1671)
Context menu entries of a plugin can name a submenu on [[contributes.menus]] (editor, Project view, editor tab and view item menus; API 1.3): entries with the same submenu are grouped under it, a submenu with one visible entry stays a plain entry, and the label goes through the plugin's translations. Opt-in rather than by command category, since the category is the Find Action/keymap prefix and many plugins share one across all commands. Co-authored-by: lidwt721 <[email protected]>
Цей коміт міститься в:
1 джерело
adc308eb99
коміт
e68b35f534
7 files changed
+161
-5
No files matched your search
@@ -75,6 +75,7 @@ export function usePluginT(pluginId: string): PluginTranslate {
|
||||
/** The keys of each point's declaration that are shown text; ids, names of secrets and option values are not. */
|
||||
const TEXT_KEYS: Record<string, readonly string[]> = {
|
||||
commands: ["title", "category"],
|
||||
menus: ["submenu"],
|
||||
views: ["title"],
|
||||
customEditors: ["title"],
|
||||
statusBar: ["text", "tooltip"],
|
||||
@@ -102,7 +103,9 @@ export function localizeContributions(
|
||||
if (Object.keys(catalogs).length === 0) return items;
|
||||
const localized = items.map((item) => {
|
||||
const keys = TEXT_KEYS[item.point];
|
||||
return keys && ownEntry(catalogs, item.pluginId)
|
||||
const decl = item.decl as Record<string, unknown> | null;
|
||||
const hasText = !!decl && (keys?.some((k) => typeof decl[k] === "string") || Array.isArray(decl.properties));
|
||||
return keys && hasText && ownEntry(catalogs, item.pluginId)
|
||||
? { ...item, decl: localizeDecl(item.decl, keys, translatorOf(catalogs, item.pluginId)) }
|
||||
: item;
|
||||
});
|
||||
|
||||
Reference in new issue
Заблокувати користувача