(context)
| 20 | } |
| 21 | |
| 22 | function activate(context) { |
| 23 | createStatusBarItem(); |
| 24 | showStatusBarItem(); |
| 25 | |
| 26 | // Register command to open settings |
| 27 | let disposable = vscode.commands.registerCommand('codexpert.openSettings', () => { |
| 28 | // Options for the quick pick menu |
| 29 | const options = { |
| 30 | placeHolder: 'Change Settings', |
| 31 | matchOnDetail: true, |
| 32 | matchOnDescription: true |
| 33 | }; |
| 34 | |
| 35 | // Items for the quick pick menu |
| 36 | const items = [ |
| 37 | { label: 'Change Mode light/full', detail: 'Change the mode value (l or f)' }, |
| 38 | { label: 'Change Server url', detail: 'Enter the url of your own Code Xpert server' }, |
| 39 | { label: 'Change Shortcut Key', detail: 'Change the shortcut key' } |
| 40 | ]; |
| 41 | |
| 42 | // Show the quick pick menu |
| 43 | vscode.window.showQuickPick(items, options) |
| 44 | .then(selectedItem => { |
| 45 | if (!selectedItem) return; |
| 46 | // Handle user selection |
| 47 | if (selectedItem.label === 'Change Mode light/full') { |
| 48 | vscode.window.showInputBox({ placeHolder: 'Enter mode value (l or f)' }) |
| 49 | .then(value => { |
| 50 | if (value && (value === 'l' || value === 'f')) { |
| 51 | // Save the mode value |
| 52 | vscode.workspace.getConfiguration().update('codexpert.mode', value, vscode.ConfigurationTarget.Global); |
| 53 | vscode.window.showInformationMessage(`Mode changed to ${value}`); |
| 54 | } else { |
| 55 | vscode.window.showWarningMessage('Invalid mode value. Please enter l or f.'); |
| 56 | } |
| 57 | }); |
| 58 | } else if (selectedItem.label === 'Change Shortcut Key') { |
| 59 | vscode.window.showInputBox({ placeHolder: 'Enter new shortcut key' }) |
| 60 | .then(value => { |
| 61 | if (value) { |
| 62 | // Save the new shortcut key |
| 63 | vscode.workspace.getConfiguration().update('extension.shortcutKey', value, vscode.ConfigurationTarget.Global); |
| 64 | vscode.window.showInformationMessage(`Shortcut key changed to ${value}`); |
| 65 | } |
| 66 | }); |
| 67 | } else if (selectedItem.label === 'Change Server url') { |
| 68 | vscode.window.showInputBox({ placeHolder: 'Enter The Server URL Like : https://mrali-codexpert.hf.space/api OR leave empty to use the default free server' }) |
| 69 | .then(value => { |
| 70 | if (value) { |
| 71 | // Save the url value |
| 72 | vscode.workspace.getConfiguration().update('codexpert.serverurl', value, vscode.ConfigurationTarget.Global); |
| 73 | vscode.window.showInformationMessage(`Server changed to ${value}`); |
| 74 | } |
| 75 | }); |
| 76 | } |
| 77 | }); |
| 78 | }); |
| 79 |
nothing calls this directly
no test coverage detected