Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions extensions/vscode/src/activation/activate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<object>("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<object>("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);
Expand Down
Loading