-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingThe issue relates to error messagingGood First IssueWell scoped, documented and has the green lightWell scoped, documented and has the green lightHelp WantedYou can do thisYou can do this
Milestone
Description
TS Template added by @mjbvz
TypeScript Version: 4.5.0-dev.20211028
Search Terms
- javascript
- checkjs
- strict
See #46570 (comment) for more minimal repro
In minimal-hello-world extension sample, using this code:
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
const vscode = require('vscode');
// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
/**
* @param {vscode.ExtensionContext} context
*/
function activate(context) {
// Use the console to output diagnostic information (console.log) and errors (console.error)
// This line of code will only be executed once when your extension is activated
console.log('Congratulations, your extension "helloworld-minimal-sample" is now active!');
// The command has been defined in the package.json file
// Now provide the implementation of the command with registerCommand
// The commandId parameter must match the command field in package.json
let disposable = vscode.commands.registerCommand('extension.helloWorld', async () => {
// The code you place here will be executed every time your command is executed
const quickpick = vscode.window.createQuickPick();
quickpick.items = [{ label: 'step 1' }];
void (await new Promise(resolve => {
quickpick.onDidAccept(() => {
console.log(quickpick.selectedItems.map(i => i.label).join(', '));
if (quickpick.selectedItems.length === 0) return;
if (quickpick.selectedItems[0].label === 'step 1') {
quickpick.value = '';
quickpick.canSelectMany = true;
quickpick.items = [{ label: 'a' }, { label: 'b' }, { label: 'c' }];
// If I uncomment this it will fix the bug
// quickpick.selectedItems = [];
}
else {
resolve();
}
});
quickpick.show();
}));
quickpick.hide();
});
context.subscriptions.push(disposable);
}
// this method is called when your extension is deactivated
function deactivate() {}
// eslint-disable-next-line no-undef
module.exports = {
activate,
deactivate
}
This isn't really something we should be warning about in JS.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingThe issue relates to error messagingGood First IssueWell scoped, documented and has the green lightWell scoped, documented and has the green lightHelp WantedYou can do thisYou can do this