Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
/**
* Menu item is hidden if this expression returns false.
*/
?
:
;
?
:
'navigation'
|
string
;
?
:
number
;
?
:
boolean
;
}
export
interface
ISubmenuItem
{
:
string
|
;
:
;
?
:
;
?
:
;
?
:
'navigation'
|
string
;
?
:
number
;
?
:
boolean
;
/**
* A split button shows the first action
* as primary action and the rest of the
* actions in a dropdown.
*
* Use `togglePrimaryAction` to promote
* the action that was last used to be
* the primary action and remember that
* choice.
*/
?
:
boolean
|
{
/**
* Will update the primary action based
* on the action that was last run.
*/
:
true
;
/**
* Restricts which submenu commands can become the primary action.
* Running an eligible command outside the submenu also updates the primary action.
*/
?
:
readonly
string
[
]
;
}
;
}
export
function
isIMenuItem
(
:
unknown
)
:
is
{
return
(
as
)
.
!==
undefined
;
}
export
function
isISubmenuItem
(
:
unknown
)
:
is
{
return
(
as
)
.
!==
undefined
;
}
export
class
MenuId
{
private
static
readonly
=
new
Map<string, MenuId>
(
)
;
static
readonly
=
new
MenuId
(
'CommandPalette'
)
;
static
readonly
=
new
MenuId
(
'DebugBreakpointsContext'
)
;
static
readonly
=
new
MenuId
(
'DebugCallStackContext'
)
;
static
readonly
=
new
MenuId
(
'DebugConsoleContext'
)
;
static
readonly
=
new
MenuId
(
'DebugVariablesContext'
)
;
static
readonly
=
new
MenuId
(
'NotebookVariablesContext'
)
;
static
readonly
=
new
MenuId
(
'DebugHoverContext'
)
;
static
readonly
=
new
MenuId
(
'DebugWatchContext'
)
;
static
readonly
=
new
MenuId
(
'DebugToolBar'
)
;
static
readonly
=
new
MenuId
(
'DebugToolBarStop'
)
;
static
readonly
=
new
MenuId
(
'DebugDisassemblyContext'
)
;
static
readonly
=
new
MenuId
(
'DebugCallStackToolbar'
)
;
static
readonly
=
new
MenuId
(
'DebugCreateConfiguration'
)
;
static
readonly
=
new
MenuId
(
'DebugScopesContext'
)
;
static
readonly
=
new
MenuId
(
'EditorContext'
)
;
static
readonly
=
new
MenuId
(
'SimpleEditorContext'
)
;
static
readonly
=
new
MenuId
(
'EditorContent'
)
;
static
readonly
=
new
MenuId
(
'EditorLineNumberContext'
)
;
static
readonly
=
new
MenuId
(
'EditorContextCopy'
)
;
static
readonly
=
new
MenuId
(
'EditorContextPeek'
)
;
static
readonly
=
new
MenuId
(
'EditorContextShare'
)
;
static
readonly
=
new
MenuId
(
'EditorTitle'
)
;
static
readonly
=
new
MenuId
(
'EditorTitleLayout'
)
;
static
readonly
=
new
MenuId
(
'ModalEditorTitle'
)
;
static
readonly
=
new
MenuId
(
'ModalEditorTitleContext'
)
;
static
readonly
=
new
MenuId
(
'ModalEditorEditorTitle'
)
;
static
readonly
=
new
MenuId
(
'CompactWindowEditorTitle'
)
;
static
readonly
=
new
MenuId
(
'EditorTitleRun'
)
;
static
readonly
=
new
MenuId
(
'EditorTitleContext'
)
;
static
readonly
=
new
MenuId
(
'EditorTitleContextShare'
)
;
static
readonly
=
new
MenuId
(
'EmptyEditorGroup'
)
;
static
readonly
=
new
MenuId
(
'EmptyEditorGroupContext'
)
;
static
readonly
=
new
MenuId
(
'EditorGroupWatermarkToolbar'
)
;
static
readonly
=
new
MenuId
(
'EditorTabsBarContext'
)
;
static
readonly
=
new
MenuId
(
'EditorTabsBarShowTabsSubmenu'
)
;
static
readonly
=
new
MenuId
(
'EditorTabsBarShowTabsZenModeSubmenu'
)
;
static
readonly
=
new
MenuId
(
'EditorActionsPositionSubmenu'
)
;
static
readonly
=
new
MenuId
(
'EditorRenderWhitespaceSubmenu'
)
;
static
readonly
=
new
MenuId
(
'EditorSplitMoveSubmenu'
)
;
static
readonly
=
new
MenuId
(
'ExplorerContext'
)
;
static
readonly
=
new
MenuId
(
'ExplorerContextShare'
)
;
static
readonly
=
new
MenuId
(
'ExtensionContext'
)
;
static
readonly
=
new
MenuId
(
'ExtensionEditorContextMenu'
)
;
static
readonly
=
new
MenuId
(
'GlobalActivity'
)
;
static
readonly
=
new
MenuId
(
'CommandCenter'
)
;
static
readonly
=
new
MenuId
(
'CommandCenterCenter'
)
;
static
readonly
=
new
MenuId
(
'LayoutControlMenuSubmenu'
)
;
static
readonly
=
new
MenuId
(
'LayoutControlMenu'
)
;
static
readonly
=
new
MenuId
(
'MenubarMainMenu'
)
;
static
readonly
=
new
MenuId
(
'MenubarAppearanceMenu'
)
;
static
readonly
=
new
MenuId
(
'MenubarDebugMenu'
)
;
static
readonly
=
new
MenuId
(
'MenubarEditMenu'
)
;
static
readonly
=
new
MenuId
(
'MenubarCopy'
)
;
static
readonly
=
new
MenuId
(
'MenubarFileMenu'
)
;
static
readonly
=
new
MenuId
(
'MenubarGoMenu'
)
;
static
readonly
=
new
MenuId
(
'MenubarHelpMenu'
)
;
static
readonly
=
new
MenuId
(
'MenubarLayoutMenu'
)
;
static
readonly
=
new
MenuId
(
'MenubarNewBreakpointMenu'
)
;
static
readonly
=
new
MenuId
(
'PanelAlignmentMenu'
)
;
static
readonly
=
new
MenuId
(
'PanelPositionMenu'
)
;
static
readonly
=
new
MenuId
(
'ActivityBarPositionMenu'
)
;
static
readonly
=
new
MenuId
(
'NotificationsCenterPositionMenu'
)
;
static
readonly
=
new
MenuId
(
'MenubarPreferencesMenu'
)
;
static
readonly
=
new
MenuId
(
'MenubarRecentMenu'
)
;
static
readonly
=
new
MenuId
(
'MenubarSelectionMenu'
)
;
static
readonly
=
new
MenuId
(
'MenubarShare'
)
;
static
readonly
=
new
MenuId
(
'MenubarSwitchEditorMenu'
)
;
static
readonly
=
new
MenuId
(
'MenubarSwitchGroupMenu'
)
;
static
readonly
=
new
MenuId
(
'MenubarTerminalMenu'
)
;
static
readonly
=
new
MenuId
(
'MenubarTerminalSuggestStatusMenu'
)
;
static
readonly
=
new
MenuId
(
'MenubarViewMenu'
)
;
static
readonly
=
new
MenuId
(
'MenubarHomeMenu'
)
;
static
readonly
=
new
MenuId
(
'OpenEditorsContext'
)
;
static
readonly
=
new
MenuId
(
'OpenEditorsContextShare'
)
;
static
readonly
=
new
MenuId
(
'ProblemsPanelContext'
)
;
static
readonly
=
new
MenuId
(
'SCMInputBox'
)
;
static
readonly
=
new
MenuId
(
'SCMChangeContext'
)
;
static
readonly
=
new
MenuId
(
'SCMResourceContext'
)
;
static
readonly
=
new
MenuId
(
'SCMResourceContextShare'
)
;
static
readonly
=
new
MenuId
(
'SCMResourceFolderContext'
)
;
static
readonly
=
new
MenuId
(
'SCMResourceGroupContext'
)
;
static
readonly
=
new
MenuId
(
'SCMSourceControl'
)
;
static
readonly
=
new
MenuId
(
'SCMSourceControlInline'
)
;
static
readonly
=
new
MenuId
(
'SCMSourceControlTitle'
)
;
static
readonly
=
new
MenuId
(
'SCMHistoryTitle'
)
;
static
readonly
=
new
MenuId
(
'SCMHistoryItemContext'
)
;
static
readonly
=
new
MenuId
(
'SCMHistoryItemChangeContext'
)
;
static
readonly
=
new
MenuId
(
'SCMHistoryItemRefContext'
)
;
static
readonly
=
new
MenuId
(
'SCMArtifactGroupContext'
)
;
static
readonly
=
new
MenuId
(
'SCMArtifactContext'
)
;
static
readonly
=
new
MenuId
(
'SCMQuickDiffDecorations'
)
;
static
readonly
=
new
MenuId
(
'SCMTitle'
)
;
static
readonly
=
new
MenuId
(
'SearchContext'
)
;
static
readonly
=
new
MenuId
(
'SearchActionContext'
)
;
static
readonly
=
new
MenuId
(
'StatusBarWindowIndicatorMenu'
)
;
static
readonly
=
new
MenuId
(
'StatusBarRemoteIndicatorMenu'
)
;
static
readonly
=
new
MenuId
(
'StickyScrollContext'
)
;
static
readonly
=
new
MenuId
(
'TestItem'
)
;
static
readonly
=
new
MenuId
(
'TestItemGutter'
)
;
static
readonly
=
new
MenuId
(
'TestProfilesContext'
)
;
static
readonly
=
new
MenuId
(
'TestMessageContext'
)
;
static
readonly
=
new
MenuId
(
'TestMessageContent'
)
;
static
readonly
=
new
MenuId
(
'TestPeekElement'
)
;
static
readonly
=
new
MenuId
(
'TestPeekTitle'
)
;
static
readonly
=
new
MenuId
(
'TestCallStack'
)
;
static
readonly
=
new
MenuId
(
'TestCoverageFilterItem'
)
;
static
readonly
=
new
MenuId
(
'TouchBarContext'
)
;
static
readonly
=
new
MenuId
(
'TitleBar'
)
;
static
readonly
=
new
MenuId
(
'TitleBarAdjacentCenter'
)
;
static
readonly
=
new
MenuId
(
'TitleBarUpdate'
)
;
static
readonly
=
new
MenuId
(
'TitleBarContext'
)
;
static
readonly
=
new
MenuId
(
'TitleBarTitleContext'
)
;
static
readonly
=
new
MenuId
(
'TunnelContext'
)
;
static
readonly
=
new
MenuId
(
'TunnelPrivacy'
)
;
static
readonly
=
new
MenuId
(
'TunnelProtocol'
)
;
static
readonly
=
new
MenuId
(
'TunnelInline'
)
;
static
readonly
=
new
MenuId
(
'TunnelTitle'
)
;
static
readonly
=
new
MenuId
(
'TunnelLocalAddressInline'
)
;
static
readonly
=
new
MenuId
(
'TunnelOriginInline'
)
;
static
readonly
=
new
MenuId
(
'ViewItemContext'
)
;
static
readonly
=
new
MenuId
(
'ViewContainerTitle'
)
;
static
readonly
=
new
MenuId
(
'ViewContainerTitleContext'
)
;
static
readonly
=
new
MenuId
(
'ViewTitle'
)
;
static
readonly
=
new
MenuId
(
'ViewTitleContext'
)
;
static
readonly
=
new
MenuId
(
'CommentEditorActions'
)
;
static
readonly
=
new
MenuId
(
'CommentThreadTitle'
)
;
static
readonly
=
new
MenuId
(
'CommentThreadActions'
)
;
static
readonly
=
new
MenuId
(
'CommentThreadAdditionalActions'
)
;
static
readonly
=
new
MenuId
(
'CommentThreadTitleContext'
)
;
static
readonly
=
new
MenuId
(
'CommentThreadCommentContext'
)
;
static
readonly
=
new
MenuId
(
'CommentTitle'
)
;
static
readonly
=
new
MenuId
(
'CommentActions'
)
;
static
readonly
=
new
MenuId
(
'CommentsViewThreadActions'
)
;
static
readonly
=
new
MenuId
(
'InteractiveToolbar'
)
;
static
readonly
=
new
MenuId
(
'InteractiveCellTitle'
)
;
static
readonly
=
new
MenuId
(
'InteractiveCellDelete'
)
;
static
readonly
=
new
MenuId
(
'InteractiveCellExecute'
)
;
static
readonly
=
new
MenuId
(
'InteractiveInputExecute'
)
;
static
readonly
=
new
MenuId
(
'InteractiveInputConfig'
)
;
static
readonly
=
new
MenuId
(
'ReplInputExecute'
)
;
static
readonly
=
new
MenuId
(
'IssueReporter'
)
;
static
readonly
=
new
MenuId
(
'NotebookToolbar'
)
;
static
readonly
=
new
MenuId
(
'NotebookToolbarContext'
)
;
static
readonly
=
new
MenuId
(
'NotebookStickyScrollContext'
)
;
static
readonly
=
new
MenuId
(
'NotebookCellTitle'
)
;
static
readonly
=
new
MenuId
(
'NotebookCellDelete'
)
;
static
readonly
=
new
MenuId
(
'NotebookCellInsert'
)
;
static
readonly
=
new
MenuId
(
'NotebookCellBetween'
)
;
static
readonly
=
new
MenuId
(
'NotebookCellTop'
)
;
static
readonly
=
new
MenuId
(
'NotebookCellExecute'
)
;
static
readonly
=
new
MenuId
(
'NotebookCellExecuteGoTo'
)
;
static
readonly
=
new
MenuId
(
'NotebookCellExecutePrimary'
)
;
static
readonly
=
new
MenuId
(
'NotebookDiffCellInputTitle'
)
;
static
readonly
=
new
MenuId
(
'NotebookDiffDocumentMetadata'
)
;
static
readonly
=
new
MenuId
(
'NotebookDiffCellMetadataTitle'
)
;
static
readonly
=
new
MenuId
(
'NotebookDiffCellOutputsTitle'
)
;
static
readonly
=
new
MenuId
(
'NotebookOutputToolbar'
)
;
static
readonly
=
new
MenuId
(
'NotebookOutlineFilter'
)
;
static
readonly
=
new
MenuId
(
'NotebookOutlineActionMenu'
)
;
static
readonly
=
new
MenuId
(
'NotebookEditorLayoutConfigure'
)
;
static
readonly
=
new
MenuId
(
'NotebookKernelSource'
)
;
static
readonly
=
new
MenuId
(
'BulkEditTitle'
)
;
static
readonly
=
new
MenuId
(
'BulkEditContext'
)
;
static
readonly
=
new
MenuId
(
'TimelineItemContext'
)
;
static
readonly
=
new
MenuId
(
'TimelineTitle'
)
;
static
readonly
=
new
MenuId
(
'TimelineTitleContext'
)
;
static
readonly
=
new
MenuId
(
'TimelineFilterSubMenu'
)
;
static
readonly
=
new
MenuId
(
'AccountsContext'
)
;
static
readonly
=
new
MenuId
(
'SidebarTitle'
)
;
static
readonly
=
new
MenuId
(
'PanelTitle'
)
;
static
readonly
=
new
MenuId
(
'AuxiliaryBarTitle'
)
;
static
readonly
=
new
MenuId
(
'TerminalInstanceContext'
)
;
static
readonly
=
new
MenuId
(
'TerminalEditorInstanceContext'
)
;
static
readonly
=
new
MenuId
(
'TerminalNewDropdownContext'
)
;
static
readonly
=
new
MenuId
(
'TerminalTabContext'
)
;
static
readonly
=
new
MenuId
(
'TerminalTabEmptyAreaContext'
)
;
static
readonly
=
new
MenuId
(
'TerminalStickyScrollContext'
)
;
static
readonly
=
new
MenuId
(
'WebviewContext'
)
;
static
readonly
=
new
MenuId
(
'InlineCompletionsActions'
)
;
static
readonly
=
new
MenuId
(
'InlineEditsActions'
)
;
static
readonly
=
new
MenuId
(
'NewFile'
)
;
static
readonly
=
new
MenuId
(
'MergeToolbar1Toolbar'
)
;
static
readonly
=
new
MenuId
(
'MergeToolbar2Toolbar'
)
;
static
readonly
=
new
MenuId
(
'MergeBaseToolbar'
)
;
static
readonly
=
new
MenuId
(
'MergeToolbarResultToolbar'
)
;
static
readonly
=
new
MenuId
(
'InlineSuggestionToolbar'
)
;
static
readonly
=
new
MenuId
(
'InlineEditToolbar'
)
;
static
readonly
=
new
MenuId
(
'ChatContext'
)
;
static
readonly
=
new
MenuId
(
'ChatCodeblock'
)
;
static
readonly
=
new
MenuId
(
'ChatCompareBlock'
)
;
static
readonly
=
new
MenuId
(
'ChatMessageTitle'
)
;
static
readonly
=
new
MenuId
(
'ChatWelcomeContext'
)
;
static
readonly
=
new
MenuId
(
'ChatMessageFooter'
)
;
static
readonly
=
new
MenuId
(
'ChatSubagentContent'
)
;
static
readonly
=
new
MenuId
(
'ChatExecute'
)
;
static
readonly
=
new
MenuId
(
'ChatExecuteQueue'
)
;
static
readonly
=
new
MenuId
(
'ChatInput'
)
;
static
readonly
=
new
MenuId
(
'ChatInputSecondary'
)
;
static
readonly
=
new
MenuId
(
'ChatInputStatus'
)
;
static
readonly
=
new
MenuId
(
'ChatInputSide'
)
;
static
readonly
=
new
MenuId
(
'AutomationsDialogInput'
)
;
static
readonly
=
new
MenuId
(
'ChatModePicker'
)
;
static
readonly
=
new
MenuId
(
'ChatEditingWidgetToolbar'
)
;
static
readonly
=
new
MenuId
(
'ChatEditingSessionChangesToolbar'
)
;
static
readonly
=
new
MenuId
(
'ChatEditingSessionTitleToolbar'
)
;
static
readonly
=
new
MenuId
(
'ChatEditingSessionChangesVersionsSubmenu'
)
;
static
readonly
=
new
MenuId
(
'ChatEditingSessionChangesFileHeaderToolbar'
)
;
static
readonly
=
new
MenuId
(
'ChatEditingSessionChangesFileHeaderRightToolbar'
)
;
static
readonly
=
new
MenuId
(
'ChatEditingEditorContent'
)
;
static
readonly
=
new
MenuId
(
'ChatEditingEditorHunk'
)
;
static
readonly
=
new
MenuId
(
'ChatEditingDeletedNotebookCell'
)
;
static
readonly
=
new
MenuId
(
'ChatInputAttachmentToolbar'
)
;
static
readonly
=
new
MenuId
(
'ChatEditingWidgetModifiedFilesToolbar'
)
;
static
readonly
=
new
MenuId
(
'ChatInputResourceAttachmentContext'
)
;
static
readonly
=
new
MenuId
(
'ChatInputSymbolAttachmentContext'
)
;
static
readonly
=
new
MenuId
(
'ChatInlineResourceAnchorContext'
)
;
static
readonly
=
new
MenuId
(
'ChatInlineSymbolAnchorContext'
)
;
static
readonly
:
=
new
MenuId
(
'ChatMessageCheckpoint'
)
;
static
readonly
:
=
new
MenuId
(
'ChatMessageRestoreCheckpoint'
)
;
static
readonly
=
new
MenuId
(
'ChatNewMenu'
)
;
static
readonly
=
new
MenuId
(
'ChatEditingCodeBlockContext'
)
;
static
readonly
=
new
MenuId
(
'ChatTitleBarMenu'
)
;
static
readonly
=
new
MenuId
(
'ChatAttachmentsContext'
)
;
static
readonly
=
new
MenuId
(
'ChatTipContext'
)
;
static
readonly
=
new
MenuId
(
'ChatTipToolbar'
)
;
static
readonly
=
new
MenuId
(
'ChatToolOutputResourceToolbar'
)
;
static
readonly
=
new
MenuId
(
'ChatTextEditorMenu'
)
;
static
readonly
=
new
MenuId
(
'ChatToolOutputResourceContext'
)
;
static
readonly
=
new
MenuId
(
'ChatMultiDiffContext'
)
;
static
readonly
=
new
MenuId
(
'ChatConfirmationMenu'
)
;
static
readonly
=
new
MenuId
(
'ChatEditorInlineGutter'
)
;
static
readonly
=
new
MenuId
(
'ChatEditorInputExecute'
)
;
static
readonly
=
new
MenuId
(
'ChatEditorInputSide'
)
;
static
readonly
=
new
MenuId
(
'InlineChatEditorAffordance'
)
;
static
readonly
=
new
MenuId
(
'AccessibleView'
)
;
static
readonly
=
new
MenuId
(
'MultiDiffEditorContent'
)
;
static
readonly
=
new
MenuId
(
'MultiDiffEditorFileToolbar'
)
;
static
readonly
=
new
MenuId
(
'DiffEditorHunkToolbar'
)
;
static
readonly
=
new
MenuId
(
'DiffEditorSelectionToolbar'
)
;
static
readonly
=
new
MenuId
(
'BrowserNavigationToolbar'
)
;
static
readonly
=
new
MenuId
(
'BrowserActionsToolbar'
)
;
static
readonly
=
new
MenuId
(
'BrowserChatActionsMenu'
)
;
static
readonly
=
new
MenuId
(
'BrowserEmulationToolbar'
)
;
static
readonly
=
new
MenuId
(
'AgentSessionsViewerFilterSubMenu'
)
;
static
readonly
=
new
MenuId
(
'AgentSessionsExternalFilterSubMenu'
)
;
static
readonly
=
new
MenuId
(
'AgentSessionsContext'
)
;
static
readonly
=
new
MenuId
(
'AgentSessionSectionContext'
)
;
static
readonly
=
new
MenuId
(
'AgentSessionsCreateSubMenu'
)
;
static
readonly
=
new
MenuId
(
'AgentSessionsToolbar'
)
;
static
readonly
=
new
MenuId
(
'AgentSessionItemToolbar'
)
;
static
readonly
=
new
MenuId
(
'AgentSessionSectionToolbar'
)
;
static
readonly
=
new
MenuId
(
'SessionItemContextMenu'
)
;
static
readonly
=
new
MenuId
(
'SessionsSessionHeaderContext'
)
;
static
readonly
=
new
MenuId
(
'AgentsTitleBarControlMenu'
)
;
static
readonly
=
new
MenuId
(
'AgentsChangesToolbar'
)
;
static
readonly
=
new
MenuId
(
'AgentsChangesPrimaryActionSubMenu'
)
;
static
readonly
=
new
MenuId
(
'AgentsChangeInlineToolbar'
)
;
static
readonly
=
new
MenuId
(
'ChatViewSessionTitleNavigationToolbar'
)
;
static
readonly
=
new
MenuId
(
'ChatViewSessionTitleToolbar'
)
;
static
readonly
=
new
MenuId
(
'ChatContextUsageActions'
)
;
static
readonly
=
new
MenuId
(
'MarkerHoverParticipant.StatusBar'
)
;
/**
* Create or reuse a `MenuId` with the given identifier
*/
static
for
(
:
string
)
:
{
return
.
.
get
(
)
??
new
MenuId
(
)
;
}
readonly
:
string
;
/**
* Create a new `MenuId` with the unique identifier. Will throw if a menu
* with the identifier already exists, use `MenuId.for(ident)` or a unique
* identifier
*/
constructor
(
:
string
)
{
if
(
.
.
has
(
)
)
{
throw
new
TypeError
(
`MenuId with identifier '${identifier}' already exists. Use MenuId.for(ident) or a unique identifier`
)
;
}
.
.
set
(
,
this
)
;
this
.
=
;
}
}
export
interface
IMenuActionOptions
{
?
:
unknown
;
?
:
unknown
[
]
;
?
:
boolean
;
?
:
boolean
;
}
export
interface
IMenuChangeEvent
{
readonly
:
;
readonly
:
boolean
;
readonly
:
boolean
;
readonly
:
boolean
;
}
export
interface
IMenu
extends
IDisposable
{
readonly
:
<
>
;
getActions
(
?
:
)
:
[
string
,
Array
<
|
>
]
[
]
;
}
export
interface
IMenuData
{
:
<
string
>
;
:
[
string
,
Array
<
|
>
]
[
]
;
}
export
const
=
createDecorator<IMenuService>
(
'menuService'
)
;
export
interface
IMenuCreateOptions
{
?
:
boolean
;
?
:
number
;
}
export
interface
IMenuService
{
readonly
:
undefined
;
/**
* Consider using getMenuActions if you don't need to listen to events.
*
* Create a new menu for the given menu identifier. A menu sends events when it's entries
* have changed (placement, enablement, checked-state). By default it does not send events for
* submenu entries. That is more expensive and must be explicitly enabled with the
* `emitEventsForSubmenuChanges` flag.
*/
createMenu
(
:
,
:
,
?
:
)
:
;
/**
* Creates a new menu, gets the actions, and then disposes of the menu.
*/
getMenuActions
(
:
,
:
,
?
:
)
:
[
string
,
Array
<
|
>
]
[
]
;
/**
* Gets the names of the contexts that this menu listens on.
*/
getMenuContexts
(
:
)
:
<
string
>
;
/**
* Reset **all** menu item hidden states.
*/
resetHiddenStates
(
)
:
void
;
/**
* Reset the menu's hidden states.
*/
resetHiddenStates
(
:
readonly
[
]
|
undefined
)
:
void
;
}
type
ICommandsMap
=
<
string
,
>
;
export
interface
IMenuRegistryChangeEvent
{
has
(
:
)
:
boolean
;
}
class
MenuRegistryChangeEvent
{
private
static
=
new
Map<MenuId, MenuRegistryChangeEvent>
(
)
;
static
for
(
:
)
:
{
let
=
this
.
.
get
(
)
;
if
(
!
)
{
=
new
MenuRegistryChangeEvent
(
)
;
this
.
.
set
(
,
)
;
}
return
;
}
static
merge
(
:
[
]
)
:
{
const
=
new
Set<MenuId>
(
)
;
for
(
const
of
)
{
if
(
instanceof
MenuRegistryChangeEvent
)
{
.
add
(
.
)
;
}
}
return
;
}
readonly
has
:
(
:
)
=>
boolean
;
private
constructor
(
private
readonly
:
)
{
this
.
has
=
=>
===
;
}
}
export
interface
IMenuRegistry
{
readonly
:
<
>
;
addCommand
(
:
)
:
;
getCommand
(
:
string
)
:
|
undefined
;
getCommands
(
)
:
;
/**
* @deprecated Use `appendMenuItem` or most likely use `registerAction2` instead. There should be no strong
* reason to use this directly.
*/
appendMenuItems
(
:
<
{
:
;
:
|
}
>
)
:
;
appendMenuItem
(
:
,
:
|
)
:
;
getMenuItems
(
:
)
:
Array
<
|
>
;
}
export
const
:
=
new
class
implements
IMenuRegistry
{
private
readonly
=
new
Map<string, ICommandAction>
(
)
;
private
readonly
=
new
Map<MenuId, LinkedList<IMenuItem | ISubmenuItem>>
(
)
;
private
readonly
=
new
MicrotaskEmitter<IMenuRegistryChangeEvent>
(
{
:
.
}
)
;
readonly
:
<
>
=
this
.
.
;
addCommand
(
:
)
:
{
this
.
.
set
(
.
,
)
;
this
.
.
fire
(
.
for
(
.
)
)
;
return
markAsSingleton
(
toDisposable
(
(
)
=>
{
if
(
this
.
.
delete
(
.
)
)
{
this
.
.
fire
(
.
for
(
.
)
)
;
}
}
)
)
;
}
getCommand
(
:
string
)
:
|
undefined
{
return
this
.
.
get
(
)
;
}
getCommands
(
)
:
{
const
=
new
Map<string, ICommandAction>
(
)
;
this
.
.
forEach
(
(
,
)
=>
.
set
(
,
)
)
;
return
;
}
appendMenuItem
(
:
,
:
|
)
:
{
let
=
this
.
.
get
(
)
;
if
(
!
)
{
=
new
LinkedList
(
)
;
this
.
.
set
(
,
)
;
}
const
=
.
push
(
)
;
this
.
.
fire
(
.
for
(
)
)
;
return
markAsSingleton
(
toDisposable
(
(
)
=>
{
rm
(
)
;
this
.
.
fire
(
.
for
(
)
)
;
}
)
)
;
}
appendMenuItems
(
:
<
{
:
;
:
|
}
>
)
:
{
const
=
new
DisposableStore
(
)
;
for
(
const
{
,
}
of
)
{
.
add
(
this
.
appendMenuItem
(
,
)
)
;
}
return
;
}
getMenuItems
(
:
)
:
Array
<
|
>
{
let
:
Array
<
|
>
;
if
(
this
.
.
has
(
)
)
{
=
[
...
this
.
.
get
(
)
!
]
;
}
else
{
=
[
]
;
}
if
(
===
.
)
{
// CommandPalette is special because it shows
// all commands by default
this
.
_appendImplicitItems
(
)
;
}
return
;
}
private
_appendImplicitItems
(
:
Array
<
|
>
)
{
const
=
new
Set<string>
(
)
;
for
(
const
of
)
{
if
(
isIMenuItem
(
)
)
{
.
add
(
.
.
)
;
if
(
.
)
{
.
add
(
.
.
)
;
}
}
}
this
.
.
forEach
(
(
,
)
=>
{
if
(
!
.
has
(
)
)
{
.
push
(
{
}
)
;
}
}
)
;
}
}
;
export
class
SubmenuItemAction
extends
SubmenuAction
{
constructor
(
readonly
:
,
readonly
:
|
undefined
,
:
readonly
[
]
,
)
{
super
(
`submenuitem.${item.submenu.id}`
,
typeof
.
===
'string'
?
.
:
.
.
,
,
'submenu'
)
;
}
}
export
interface
IMenuItemHide
{
readonly
:
boolean
;
readonly
:
;
readonly
:
;
}
// implements IAction, does NOT extend Action, so that no one
// subscribes to events of Action or modified properties
export
class
MenuItemAction
implements
IAction
{
static
label
(
:
,
?
:
)
:
string
{
return
?.
&&
.
?
(
typeof
.
===
'string'
?
.
:
.
.
)
:
(
typeof
.
===
'string'
?
.
:
.
.
)
;
}
readonly
:
;
readonly
:
|
undefined
;
private
readonly
:
|
undefined
;
readonly
:
string
;
readonly
:
string
;
readonly
:
string
;
readonly
class
:
string
|
undefined
;
readonly
:
boolean
;
readonly
?
:
boolean
;
constructor
(
:
,
:
|
undefined
,
:
|
undefined
,
readonly
:
|
undefined
,
readonly
:
|
undefined
,
@IContextKeyService
:
,
@ICommandService
private
:
)
{
this
.
=
.
;
this
.
=
.
label
(
,
)
;
this
.
=
(
typeof
.
===
'string'
?
.
:
.
?.
)
??
''
;
this
.
=
!
.
||
.
contextMatchesRules
(
.
)
;
this
.
=
undefined
;
let
:
|
undefined
;
if
(
.
)
{
const
=
(
(
.
as
{
:
}
)
.
?
.
:
{
:
.
}
)
as
{
:
;
?
:
;
?
:
string
|
;
?
:
string
|
;
}
;
this
.
=
.
contextMatchesRules
(
.
)
;
if
(
this
.
&&
.
)
{
this
.
=
typeof
.
===
'string'
?
.
:
.
.
;
}
if
(
this
.
&&
.
isThemeIcon
(
.
)
)
{
=
.
;
}
if
(
this
.
&&
.
)
{
this
.
=
typeof
.
===
'string'
?
.
:
.
.
;
}
}
if
(
!
)
{
=
.
isThemeIcon
(
.
)
?
.
:
undefined
;
}
this
.
=
;
this
.
=
?
new
MenuItemAction
(
,
undefined
,
,
,
undefined
,
,
)
:
undefined
;
this
.
=
;
this
.
=
&&
.
asClassName
(
)
;
}
run
(
...
:
unknown
[
]
)
:
Promise
<
void
>
{
let
:
unknown
[
]
=
[
]
;
if
(
this
.
?.
)
{
=
[
...
,
...
this
.
.
]
;
}
else
if
(
this
.
?.
)
{
=
[
...
,
this
.
.
]
;
}
if
(
this
.
?.
)
{
=
[
...
,
...
]
;
}
return
this
.
.
executeCommand
(
this
.
,
...
)
;
}
}
//#region --- IAction2
type
OneOrN<T>
=
T
|
T
[
]
;
interface
IAction2CommonOptions
extends
ICommandAction
{
/**
* One or many menu items.
*/
?
:
<
{
:
;
?
:
null
}
&
<
,
'command'
>>
;
/**
* One keybinding.
*/
?
:
<
<
,
'id'
>>
;
}
interface
IBaseAction2Options
extends
IAction2CommonOptions
{
/**
* This type is used when an action is not going to show up in the command palette.
* In that case, it's able to use a string for the `title` and `category` properties.
*/
?
:
false
;
}
export
interface
ICommandPaletteOptions
extends
IAction2CommonOptions
{
/**
* The title of the command that will be displayed in the command palette after the category.
* This overrides {@link ICommandAction.title} to ensure a string isn't used so that the title
* includes the localized value and the original value for users using language packs.
*/
:
;
/**
* The category of the command that will be displayed in the command palette before the title suffixed.
* with a colon This overrides {@link ICommandAction.title} to ensure a string isn't used so that
* the title includes the localized value and the original value for users using language packs.
*/
?
:
keyof
typeof
|
;
/**
* Shorthand to add this command to the command palette. Note: this is not the only way to declare that
* a command should be in the command palette... however, enforcing ILocalizedString in the other scenarios
* is much more challenging and this gets us most of the way there.
*/
:
true
;
}
export
type
IAction2Options
=
|
;
export
interface
IAction2F1RequiredOptions
{
:
;
?
:
keyof
typeof
|
;
}
export
abstract
class
Action2
{
constructor
(
readonly
:
<
>
)
{
}
abstract
run
(
:
,
...
:
unknown
[
]
)
:
void
;
}
export
function
registerAction2
(
:
{
new
(
)
:
}
)
:
{
const
:
[
]
=
[
]
;
// not using `DisposableStore` to reduce startup perf cost
const
=
new
ctor
(
)
;
const
{
,
,
,
...
}
=
.
;
if
(
.
getCommand
(
.
)
)
{
throw
new
Error
(
`Cannot register two commands with the same id: ${command.id}`