mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-07-04 00:41:00 +02:00
feat: re-add GitHub Copilot settings and enhance integration checks
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
### 🐞 Fixes
|
||||
|
||||
- [#1023](https://github.com/estruyf/vscode-front-matter/issues/1023): Fix validation errors for image, file, and keywords fields
|
||||
- [#1024](https://github.com/estruyf/vscode-front-matter/issues/1024): Re-add the `frontMatter.copilot.enabled` setting to allow users to disable the GitHub Copilot integration
|
||||
|
||||
## [10.10.0] - 2026-04-03 - [Release notes](https://beta.frontmatter.codes/updates/v10.10.0)
|
||||
|
||||
|
||||
@@ -2128,6 +2128,11 @@
|
||||
"type": "string",
|
||||
"default": "gpt-4o-mini",
|
||||
"markdownDescription": "%setting.frontMatter.copilot.family.markdownDescription%"
|
||||
},
|
||||
"frontMatter.copilot.enabled": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"markdownDescription": "%setting.frontMatter.copilot.enabled.markdownDescription%"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
+2
-1
@@ -292,5 +292,6 @@
|
||||
|
||||
"setting.frontMatter.git.disableOnBranches.markdownDescription": "Specify the branches on which you want to disable the Git actions. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.git.disableonbranches) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.git.disableonbranches%22%5D)",
|
||||
"setting.frontMatter.git.requiresCommitMessage.markdownDescription": "Specify if you want to require a commit message when publishing your changes for a specified branch. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.git.requirescommitmessage) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.git.requirescommitmessage%22%5D)",
|
||||
"setting.frontMatter.copilot.family.markdownDescription": "Specify the LLM family of the Copilot you want to use. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.copilot.family) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.copilot.family%22%5D)"
|
||||
"setting.frontMatter.copilot.family.markdownDescription": "Specify the LLM family of the Copilot you want to use. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.copilot.family) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.copilot.family%22%5D)",
|
||||
"setting.frontMatter.copilot.enabled.markdownDescription": "Specify if you want to enable GitHub Copilot AI suggestions (requires GitHub Copilot extension). [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.copilot.enabled) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.copilot.enabled%22%5D)"
|
||||
}
|
||||
|
||||
@@ -117,6 +117,7 @@ export const SETTING_SNIPPETS_WRAPPER = 'snippets.wrapper.enabled';
|
||||
export const SETTING_WEBSITE_URL = 'website.host';
|
||||
|
||||
export const SETTING_COPILOT_FAMILY = 'copilot.family';
|
||||
export const SETTING_COPILOT_ENABLED = 'copilot.enabled';
|
||||
|
||||
export const SETTING_LOGGING = 'logging';
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import {
|
||||
SETTING_GLOBAL_TIMEZONE,
|
||||
SETTING_PANEL_ACTIONS_DISABLED,
|
||||
SETTING_WEBSITE_URL
|
||||
SETTING_WEBSITE_URL,
|
||||
SETTING_COPILOT_ENABLED
|
||||
} from './../constants/settings';
|
||||
import { workspace } from 'vscode';
|
||||
import { ContentType, Extension, Logger, Settings, TaxonomyHelper } from '.';
|
||||
@@ -51,6 +52,7 @@ export class PanelSettings {
|
||||
|
||||
try {
|
||||
return {
|
||||
aiEnabled: Settings.get<boolean>(SETTING_COPILOT_ENABLED) !== false,
|
||||
copilotEnabled: await Copilot.isInstalled(),
|
||||
git: await GitListener.getSettings(),
|
||||
seo: {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { QuickPickItem, QuickPickItemKind, window } from 'vscode';
|
||||
import { Folders } from '../commands/Folders';
|
||||
import { SETTING_COPILOT_ENABLED } from '../constants';
|
||||
import { ContentType } from './ContentType';
|
||||
import { Notifications } from './Notifications';
|
||||
import { Logger } from './Logger';
|
||||
import { Settings } from './SettingsHelper';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../localization';
|
||||
import { ContentFolder } from '../models';
|
||||
@@ -37,12 +39,14 @@ export class Questions {
|
||||
* @returns
|
||||
*/
|
||||
public static async ContentTitle(showWarning = true): Promise<string | undefined> {
|
||||
const copilotEnabled = Settings.get<boolean>(SETTING_COPILOT_ENABLED) !== false;
|
||||
let title: string | undefined = '';
|
||||
const isCopilotInstalled = await Copilot.isInstalled();
|
||||
|
||||
let aiTitles: string[] | undefined;
|
||||
|
||||
if (isCopilotInstalled) {
|
||||
// Only show AI suggestions if both the setting is enabled and Copilot is installed
|
||||
if (copilotEnabled && isCopilotInstalled) {
|
||||
title = await window.showInputBox({
|
||||
title: l10n.t(LocalizationKey.helpersQuestionsContentTitleAiInputTitle),
|
||||
prompt: l10n.t(LocalizationKey.helpersQuestionsContentTitleAiInputPrompt),
|
||||
|
||||
@@ -26,7 +26,8 @@ import {
|
||||
SETTING_DATE_FORMAT,
|
||||
SETTING_GLOBAL_ACTIVE_MODE,
|
||||
SETTING_GLOBAL_MODES,
|
||||
SETTING_TAXONOMY_CONTENT_TYPES
|
||||
SETTING_TAXONOMY_CONTENT_TYPES,
|
||||
SETTING_COPILOT_ENABLED
|
||||
} from '../../constants';
|
||||
import { Article, Preview } from '../../commands';
|
||||
import { FrontMatterParser, ParsedFrontMatter } from '../../parsers';
|
||||
@@ -124,6 +125,15 @@ export class DataListener extends BaseListener {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if Copilot is enabled and installed
|
||||
const copilotEnabled = Settings.get<boolean>(SETTING_COPILOT_ENABLED) !== false;
|
||||
const isCopilotInstalled = await Copilot.isInstalled();
|
||||
|
||||
if (!copilotEnabled || !isCopilotInstalled) {
|
||||
this.sendRequestError(command, requestId, 'Copilot is not enabled or installed');
|
||||
return;
|
||||
}
|
||||
|
||||
const aiTitles = await Copilot.suggestTitles(title);
|
||||
title = await Questions.pickTitleSuggestions(title, aiTitles || [], true);
|
||||
|
||||
@@ -145,6 +155,21 @@ export class DataListener extends BaseListener {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if Copilot is enabled and installed
|
||||
const copilotEnabled = Settings.get<boolean>(SETTING_COPILOT_ENABLED) !== false;
|
||||
const isCopilotInstalled = await Copilot.isInstalled();
|
||||
|
||||
if (!copilotEnabled || !isCopilotInstalled) {
|
||||
const extPath = Extension.getInstance().extensionPath;
|
||||
const panel = PanelProvider.getInstance(extPath);
|
||||
panel.getWebview()?.postMessage({
|
||||
command,
|
||||
requestId,
|
||||
error: l10n.t(LocalizationKey.servicesCopilotGetChatResponseError)
|
||||
} as MessageHandlerData<string>);
|
||||
return;
|
||||
}
|
||||
|
||||
const article = ArticleHelper.getActiveFile();
|
||||
if (!article) {
|
||||
return;
|
||||
|
||||
@@ -4,6 +4,7 @@ import { BaseListener } from './BaseListener';
|
||||
import { authentication, window } from 'vscode';
|
||||
import { ArticleHelper, Extension, Settings, TaxonomyHelper } from '../../helpers';
|
||||
import { BlockFieldData, CustomTaxonomyData, PostMessageData, TaxonomyType } from '../../models';
|
||||
import { SETTING_COPILOT_ENABLED } from '../../constants';
|
||||
import { DataListener } from '.';
|
||||
import { SettingsListener as PanelSettingsListener } from '.';
|
||||
import { SettingsListener as DashboardSettingsListener } from '../dashboard';
|
||||
@@ -84,6 +85,21 @@ export class TaxonomyListener extends BaseListener {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if Copilot is enabled and installed
|
||||
const copilotEnabled = Settings.get<boolean>(SETTING_COPILOT_ENABLED) !== false;
|
||||
const isCopilotInstalled = await Copilot.isInstalled();
|
||||
|
||||
if (!copilotEnabled || !isCopilotInstalled) {
|
||||
const extPath = Extension.getInstance().extensionPath;
|
||||
const panel = PanelProvider.getInstance(extPath);
|
||||
panel.getWebview()?.postMessage({
|
||||
command,
|
||||
requestId,
|
||||
error: l10n.t(LocalizationKey.servicesCopilotGetChatResponseError)
|
||||
} as MessageHandlerData<string[]>);
|
||||
return;
|
||||
}
|
||||
|
||||
const article = ArticleHelper.getActiveFile();
|
||||
if (!article) {
|
||||
return;
|
||||
|
||||
@@ -28,6 +28,7 @@ export interface PanelSettings {
|
||||
dataTypes: DataType[] | undefined;
|
||||
fieldGroups: FieldGroup[] | undefined;
|
||||
commaSeparatedFields: string[];
|
||||
aiEnabled: boolean;
|
||||
copilotEnabled: boolean;
|
||||
contentFolders: ContentFolder[];
|
||||
websiteUrl: string;
|
||||
|
||||
Reference in New Issue
Block a user