diff --git a/src/renderer/others/setting-schema.ts b/src/renderer/others/setting-schema.ts index 7ebe246c..09bdea32 100644 --- a/src/renderer/others/setting-schema.ts +++ b/src/renderer/others/setting-schema.ts @@ -267,6 +267,14 @@ const schema: SettingSchema = ({ group: 'editor', required: true, }, + 'editor.enable-ai-copilot-action': { + defaultValue: true, + title: 'T_setting-panel.schema.editor.enable-ai-copilot-action', + type: 'boolean', + format: 'checkbox', + group: 'editor', + required: true, + }, 'render.md-html': { defaultValue: true, title: 'T_setting-panel.schema.render.md-html', diff --git a/src/renderer/plugins/ai-copilot.ts b/src/renderer/plugins/ai-copilot.ts index 6b077800..bc2efa3c 100644 --- a/src/renderer/plugins/ai-copilot.ts +++ b/src/renderer/plugins/ai-copilot.ts @@ -14,7 +14,8 @@ export default { provideCodeActions (): languages.CodeActionList { const actionTitle = ctx.i18n.t('edit-or-generate-text-using-ai') - if (!getInitialized() || checkExtensionLoaded()) { + const enabled = ctx.setting.getSetting('editor.enable-ai-copilot-action') + if (!getInitialized() || checkExtensionLoaded() || !enabled) { return { dispose: () => 0, actions: [] } } diff --git a/src/renderer/types.ts b/src/renderer/types.ts index d9d21ebd..b34dc8a6 100644 --- a/src/renderer/types.ts +++ b/src/renderer/types.ts @@ -334,6 +334,7 @@ export interface BuildInSettings { 'editor.minimap': boolean, 'editor.line-numbers': 'on' | 'off' | 'relative' | 'interval', 'editor.enable-preview': boolean, + 'editor.enable-ai-copilot-action': boolean, 'editor.font-family': string, 'editor.complete-emoji': boolean, 'editor.todo-with-time': boolean, diff --git a/src/share/i18n/languages/en.ts b/src/share/i18n/languages/en.ts index 9e208c19..d029729e 100644 --- a/src/share/i18n/languages/en.ts +++ b/src/share/i18n/languages/en.ts @@ -401,6 +401,7 @@ const data = { 'suggest-on-trigger-characters': 'Suggest on trigger characters - You can also use Ctrl+Space (depending on the shortcuts) to trigger', 'sticky-scroll-enabled': 'Enable Sticky Scroll - When the editor scrolls, the document title is fixed', 'quick-suggestions': 'Quick Suggestions - Suggest as you type', + 'enable-ai-copilot-action': 'Enable the AI Copilot Action - Show the AI Copilot Action lightbulb when available', }, 'render': { 'md-html': 'Enable HTML', diff --git a/src/share/i18n/languages/zh-CN.ts b/src/share/i18n/languages/zh-CN.ts index f8115f7b..aa69e887 100644 --- a/src/share/i18n/languages/zh-CN.ts +++ b/src/share/i18n/languages/zh-CN.ts @@ -392,6 +392,7 @@ const data: BaseLanguage = { 'suggest-on-trigger-characters': '自动提示 - 输入提示符时显示提示。如果禁用,仍可使用 Ctrl+Space (取决于快捷键配置) 触发', 'sticky-scroll-enabled': '启用粘性滚动 - 当编辑器滚动时,固定显示文档标题等', 'quick-suggestions': '快速提示 - 在输入文本时显示提示', + 'enable-ai-copilot-action': '启用 AI Copilot 操作 - 当可用时显示 AI Copilot 操作灯泡', }, 'render': { 'md-html': '启用 HTML', diff --git a/src/share/i18n/languages/zh-TW.ts b/src/share/i18n/languages/zh-TW.ts index 21625ec7..5418b7b0 100644 --- a/src/share/i18n/languages/zh-TW.ts +++ b/src/share/i18n/languages/zh-TW.ts @@ -392,6 +392,7 @@ const data: BaseLanguage = { 'suggest-on-trigger-characters': '自動提示 - 輸入提示符號時顯示提示。若停用,仍可使用 Ctrl+Space (依據快速鍵設定) 觸發', 'sticky-scroll-enabled': '啟用黏性捲動 - 當編輯器捲動時,固定顯示文件標題等', 'quick-suggestions': '快速提示 - 在輸入文字時顯示提示', + 'enable-ai-copilot-action': '啟用 AI Copilot 操作 - 當可用時顯示 AI Copilot 操作燈泡', }, 'render': { 'md-html': '啟用 HTML',