1
- import { logger } from "@coder/logger" ;
2
1
import { IDisposable } from "vs/base/common/lifecycle" ;
3
2
import { Registry } from "vs/platform/registry/common/platform" ;
4
3
import { IWorkbenchActionRegistry , Extensions } from "vs/workbench/common/actions" ;
5
4
import { SyncActionDescriptor } from "vs/platform/actions/common/actions" ;
6
5
import { ContextKeyExpr } from "vs/platform/contextkey/common/contextkey" ;
7
6
import { ToggleDevToolsAction } from "vs/workbench/electron-browser/actions/developerActions" ;
8
7
import { TerminalPasteAction } from "vs/workbench/contrib/terminal/browser/terminalActions" ;
8
+ import { CloseCurrentWindowAction , NewWindowAction , ShowAboutDialogAction , ZoomInAction , ZoomOutAction , ZoomResetAction } from "vs/workbench/electron-browser/actions/windowActions" ;
9
+ import { REVEAL_IN_OS_COMMAND_ID } from "vs/workbench/contrib/files/browser/fileCommands" ;
10
+ import { OpenProcessExplorer } from "vs/workbench/contrib/issue/electron-browser/issueActions" ;
11
+ import { OpenPrivacyStatementUrlAction , OpenRequestFeatureUrlAction , OpenTwitterUrlAction } from "vs/workbench/electron-browser/actions/helpActions" ;
12
+ import { CloseWorkspaceAction } from "vs/workbench/browser/actions/workspaceActions" ;
9
13
import { KEYBINDING_CONTEXT_TERMINAL_FOCUS } from "vs/workbench/contrib/terminal/common/terminal" ;
10
14
import { KeyCode , KeyMod } from "vs/base/common/keyCodes" ;
11
15
import { workbench } from "../workbench" ;
12
16
13
17
// Intercept adding workbench actions so we can skip actions that won't work or
14
18
// modify actions that need different conditions, keybindings, etc.
19
+ const toSkip = [
20
+ ToggleDevToolsAction . ID ,
21
+ OpenTwitterUrlAction . ID ,
22
+ OpenPrivacyStatementUrlAction . ID ,
23
+ ShowAboutDialogAction . ID ,
24
+ ZoomInAction . ID ,
25
+ ZoomOutAction . ID ,
26
+ ZoomResetAction . ID ,
27
+ OpenProcessExplorer . ID ,
28
+ OpenRequestFeatureUrlAction . ID ,
29
+ NewWindowAction . ID ,
30
+ CloseCurrentWindowAction . ID ,
31
+ CloseWorkspaceAction . ID ,
32
+ REVEAL_IN_OS_COMMAND_ID ,
33
+ ] ;
34
+
15
35
const registry = Registry . as < IWorkbenchActionRegistry > ( Extensions . WorkbenchActions ) ;
16
36
const originalRegister = registry . registerWorkbenchAction . bind ( registry ) ;
17
37
registry . registerWorkbenchAction = ( descriptor : SyncActionDescriptor , alias : string , category ?: string , when ?: ContextKeyExpr ) : IDisposable => {
18
38
switch ( descriptor . id ) {
19
- case ToggleDevToolsAction . ID : // There appears to be no way to toggle this programmatically.
20
- logger . debug ( `Skipping unsupported workbench action ${ descriptor . id } ` ) ;
21
-
22
- return {
23
- dispose : ( ) : void => undefined ,
24
- } ;
25
-
26
39
case TerminalPasteAction . ID : // Modify the Windows keybinding and add our context key.
27
40
// tslint:disable-next-line no-any override private
28
41
( descriptor as any ) . _keybindings = {
@@ -33,6 +46,15 @@ registry.registerWorkbenchAction = (descriptor: SyncActionDescriptor, alias: str
33
46
} ;
34
47
// tslint:disable-next-line no-any override private
35
48
( descriptor as any ) . _keybindingContext = ContextKeyExpr . and ( KEYBINDING_CONTEXT_TERMINAL_FOCUS , workbench . clipboardContextKey ) ;
49
+
50
+ default : // Dispose of non-working actions
51
+ for ( let i = 0 ; i < toSkip . length ; i ++ ) {
52
+ if ( descriptor . id === toSkip [ i ] ) {
53
+ return {
54
+ dispose : ( ) : void => undefined ,
55
+ } ;
56
+ }
57
+ }
36
58
}
37
59
38
60
return originalRegister ( descriptor , alias , category , when ) ;
0 commit comments