修改格式化快捷键为Ctrl+Alt+L

This commit is contained in:
mxd
2021-08-13 21:36:40 +08:00
parent 99776e1d7f
commit cc6bd02da9

View File

@@ -74,6 +74,7 @@ import {Parser} from '@/scripts/parsing/parser.js'
import tokenizer from '@/scripts/parsing/tokenizer.js'
import {TokenStream} from '@/scripts/parsing/index.js'
import RequestParameter from '@/scripts/editor/request-parameter.js';
import { CommandsRegistry } from 'monaco-editor/esm/vs/platform/commands/common/commands'
export default {
name: 'MagicScriptEditor',
@@ -131,6 +132,11 @@ export default {
},
'!findWidgetVisible && !inreferenceSearchEditor && !editorHasSelection'
)
this.editor._standaloneKeybindingService.addDynamicKeybinding(`-editor.action.formatDocument`, undefined, () => {})
const { handler, when } = CommandsRegistry.getCommand('editor.action.formatDocument') ?? {}
if (handler) {
this.editor._standaloneKeybindingService.addDynamicKeybinding('editor.action.formatDocument', monaco.KeyMod.CtrlCmd | monaco.KeyMod.Alt | monaco.KeyCode.KEY_L, handler, when)
}
this.editor.onMouseDown(e => {
if (e.target.element.classList.contains('codicon')) {
return