| 1 | import * as fs from "fs"; |
| 2 | |
| 3 | import { getConfigYamlPath } from "core/util/paths"; |
| 4 | import * as vscode from "vscode"; |
| 5 | |
| 6 | export 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 | } |