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