feat: 快速发送 shell 命令.
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
import { createDefaultOptions } from './core';
|
||||
import { onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||
import { useAppStore } from '@/store';
|
||||
import { language as shellLanguage } from 'monaco-editor/esm/vs/basic-languages/shell/shell.js';
|
||||
|
||||
const appStore = useAppStore();
|
||||
|
||||
@@ -83,48 +82,6 @@
|
||||
emits('update:modelValue', value);
|
||||
emits('change', value);
|
||||
});
|
||||
|
||||
// FIXME test containerClass
|
||||
// TODO
|
||||
// 代码提示
|
||||
monaco.languages.registerCompletionItemProvider('shell', {
|
||||
provideCompletionItems() {
|
||||
const suggestions: any = [];
|
||||
// 这个keywords就是java.java文件中有的
|
||||
shellLanguage.keywords?.forEach((item: any) => {
|
||||
suggestions.push({
|
||||
label: item,
|
||||
kind: monaco.languages.CompletionItemKind.Keyword,
|
||||
insertText: item,
|
||||
});
|
||||
});
|
||||
shellLanguage.operators?.forEach((item: any) => {
|
||||
suggestions.push({
|
||||
label: item,
|
||||
kind: monaco.languages.CompletionItemKind.Operator,
|
||||
insertText: item,
|
||||
});
|
||||
});
|
||||
shellLanguage.builtinFunctions?.forEach((item: any) => {
|
||||
suggestions.push({
|
||||
label: item,
|
||||
kind: monaco.languages.CompletionItemKind.Function,
|
||||
insertText: item,
|
||||
});
|
||||
});
|
||||
shellLanguage.builtinVariables?.forEach((item: any) => {
|
||||
suggestions.push({
|
||||
label: item,
|
||||
kind: monaco.languages.CompletionItemKind.Variable,
|
||||
insertText: item,
|
||||
});
|
||||
});
|
||||
return {
|
||||
suggestions,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
emits('editor-mounted', editor);
|
||||
};
|
||||
|
||||
@@ -166,10 +123,10 @@
|
||||
}
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
init();
|
||||
});
|
||||
// 初始化
|
||||
onMounted(init);
|
||||
|
||||
// 卸载
|
||||
onBeforeUnmount(() => {
|
||||
editor?.dispose();
|
||||
editor = undefined;
|
||||
|
||||
Reference in New Issue
Block a user