Elffuss BraidHub

kikocis/continue public

f34c6dd29412 · 795 BRawPermalink
1import * as fs from "fs";
2
3import { getConfigYamlPath } from "core/util/paths";
4import * as vscode from "vscode";
5
6export class ConfigJsonConverterCodeLensProvider
7 implements vscode.CodeLensProvider
8{
9 public provideCodeLenses(
10 document: vscode.TextDocument,
11 _: vscode.CancellationToken,
12 ): vscode.CodeLens[] | Thenable<vscode.CodeLens[]> {
13 if (
14 !document.uri.fsPath.includes(".continue") ||
15 !document.uri.fsPath.endsWith("config.json")
16 ) {
17 return [];
18 }
19
20 if (fs.existsSync(getConfigYamlPath())) {
21 return [];
22 }
23
24 return [
25 new vscode.CodeLens(new vscode.Range(0, 0, 0, 0), {
26 title: "config.json is being deprecated. Convert to config.yaml",
27 command: "continue.convertConfigJsonToConfigYaml",
28 }),
29 ];
30 }
31}