diff --git a/extensions/vscode/src/activation/activate.ts b/extensions/vscode/src/activation/activate.ts index 8aef69fdcf6..c166bd3517f 100644 --- a/extensions/vscode/src/activation/activate.ts +++ b/extensions/vscode/src/activation/activate.ts @@ -39,29 +39,29 @@ export async function activateExtension(context: vscode.ExtensionContext) { } // Register config.yaml schema by removing old entries and adding new one (uri.fsPath changes with each version) - const yamlMatcher = ".continue/**/*.yaml"; - const yamlConfig = vscode.workspace.getConfiguration("yaml"); - const yamlSchemas = yamlConfig.get("schemas", {}); + const yamlExtension = vscode.extensions.getExtension("redhat.vscode-yaml"); + if (yamlExtension) { + const yamlMatcher = ".continue/**/*.yaml"; + const yamlConfig = vscode.workspace.getConfiguration("yaml"); + const yamlSchemas = yamlConfig.get("schemas", {}); - const newPath = vscode.Uri.joinPath( - context.extension.extensionUri, - "config-yaml-schema.json", - ).toString(); + const newPath = vscode.Uri.joinPath( + context.extension.extensionUri, + "config-yaml-schema.json", + ).toString(); - try { - await yamlConfig.update( - "schemas", - { - ...yamlSchemas, - [newPath]: [yamlMatcher], - }, - vscode.ConfigurationTarget.Global, - ); - } catch (error) { - console.error( - "Failed to register Continue config.yaml schema, most likely, YAML extension is not installed", - error, - ); + try { + await yamlConfig.update( + "schemas", + { + ...yamlSchemas, + [newPath]: [yamlMatcher], + }, + vscode.ConfigurationTarget.Global, + ); + } catch (error) { + console.error("Failed to register Continue config.yaml schema", error); + } } const api = new VsCodeContinueApi(vscodeExtension);