mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: remove useless wastyle
This commit is contained in:
1 parent
fda667c424
commit
a93ff2a3d8
4 files changed
+11
-52
No files matched your search
@@ -1,6 +1,4 @@
|
||||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
||||
import loadFormatter from 'vj/components/wastyle/index';
|
||||
import Notification from 'vj/components/notification';
|
||||
import './monaco.css';
|
||||
|
||||
export default monaco;
|
||||
@@ -31,23 +29,8 @@ export function registerAction(editor, model, element) {
|
||||
editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyMod.Shift | monaco.KeyCode.KeyP, () => {
|
||||
editor.getAction('editor.action.quickCommand').run();
|
||||
});
|
||||
loadFormatter().then(([loaded, format]) => {
|
||||
if (!loaded) return;
|
||||
editor.addAction({
|
||||
id: 'hydro.format',
|
||||
label: 'Format Code',
|
||||
contextMenuOrder: 0,
|
||||
contextMenuGroupId: 'operation',
|
||||
keybindings: [monaco.KeyMod.Alt | monaco.KeyMod.Shift | monaco.KeyCode.KeyF],
|
||||
run: () => {
|
||||
if (!['cpp', 'c'].includes(model._languageIdentifier.language)) return;
|
||||
const [success, result] = format(editor.getValue(), `${UserContext.astyleOptions.trim()} mode=c`);
|
||||
if (success) editor.setValue(result);
|
||||
else Notification.warn(result);
|
||||
},
|
||||
});
|
||||
editor.addCommand(monaco.KeyMod.Alt | monaco.KeyMod.Shift | monaco.KeyCode.KeyF, () => {
|
||||
editor.getAction('hydro.format').run();
|
||||
});
|
||||
editor.addCommand(monaco.KeyMod.Alt | monaco.KeyMod.Shift | monaco.KeyCode.KeyF, () => {
|
||||
const action = editor.getAction('editor.action.format') || editor.getAction('editor.action.formatDocument');
|
||||
if (action) action.run();
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user