配置命令提示符.

This commit is contained in:
lijiahang
2024-04-10 16:43:05 +08:00
parent 3f1d56a8c2
commit 31af860d7b
7 changed files with 21 additions and 20 deletions

View File

@@ -1,3 +1,12 @@
// 触发提示前缀
export const triggerPrefix = '_';
// 触发提示前缀
export const templatePrefix = '@{{ ';
// 触发提示后缀
export const templateSuffix = ' }}';
// 模板参数
export interface TemplateParam {
name?: string;

View File

@@ -12,7 +12,7 @@
<script lang="ts" setup>
import type { TemplateParam } from './const';
import { onMounted, onUnmounted, ref } from 'vue';
import { builtinsParams } from './const';
import { builtinsParams, templatePrefix, templateSuffix, triggerPrefix } from './const';
import * as monaco from 'monaco-editor';
import { language } from 'monaco-editor/esm/vs/basic-languages/shell/shell.js';
@@ -48,9 +48,9 @@
// 内置参数提示
builtinsParams.forEach(s => {
suggestions.push({
label: '_' + s.name,
label: triggerPrefix + s.name,
kind: monaco.languages.CompletionItemKind.Variable,
insertText: `@{{ ${s.name} }}`,
insertText: templatePrefix + s.name + templateSuffix,
detail: s.desc || '',
documentation: s.desc || '',
});
@@ -61,9 +61,9 @@
return;
}
suggestions.push({
label: '_' + s.name,
label: triggerPrefix + s.name,
kind: monaco.languages.CompletionItemKind.Field,
insertText: `@{{ ${s.name} }}`,
insertText: templatePrefix + s.name + templateSuffix,
detail: s.desc || '',
documentation: s.desc || '',
});