Closed noklam closed 2 days ago
amazing!
I think my wish of having a status bar you can select is pretty straight forward to do given you have everything you need here:
https://github.com/microsoft/vscode-extension-samples/tree/main/statusbar-sample
and here is a short ChatGPT example:
import * as vscode from 'vscode';
export function activate(context: vscode.ExtensionContext) {
// Create a status bar item
const statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 100);
statusBarItem.text = 'Select Option';
statusBarItem.command = 'extension.showComboBox';
statusBarItem.show();
context.subscriptions.push(statusBarItem);
// Register the command
const disposable = vscode.commands.registerCommand('extension.showComboBox', async () => {
const options = ['Option 1', 'Option 2', 'Option 3'];
const selectedOption = await vscode.window.showQuickPick(options, {
placeHolder: 'Select an option',
});
if (selectedOption) {
vscode.window.showInformationMessage(`You selected: ${selectedOption}`);
statusBarItem.text = selectedOption;
}
});
context.subscriptions.push(disposable);
}
export function deactivate() {}
@noklam In terms of code, all good, but I tested it locally with debugger and on selecting command I am getting two options base
and local
, by selecting local
I am getting error Error: Pending response rejected since connection got disposed
and server stoped in restartServer
function at await newLSClient.start();
. same with base
.
@jitu5 I see, I test it in this way:
1. make build
2. Install the .vsix (right click on it in VSCode)
3. Open a spaceflights project to test
Debug mode doesn't work because every time a configuration change, the server is restarted (maybe there is a lighter way to do this?). You will experience the same if you do kedro: restart server
. For now I reuse the TS function startServer
. Maybe there is a way to register command on the server side, which may be better.
@jitu5 Have you tried to use the build? does it work?
@jitu5 Have you tried to use the build? does it work?
@noklam Not yet I will try this today with below steps.
- make build
- Install the .vsix (right click on it in VSCode)
- Open a spaceflights project to test
@jitu5 Have you tried to use the build? does it work?
@noklam I followed your steps and now its working without debugger also select environment from command. 👍🏼
Thank you, I merge this now!
Context
Implement a VSCode command to change configuration
For reviewer: I'd appreciate feedback specifically on the TS logic since I am relatively new to TS.