Skip to content

Unable to write into tasks configuration in a Multi root workspace #34571

@sandy081

Description

@sandy081
  • Create an extension that writes tasks configuration.
export function activate(context: vscode.ExtensionContext) {

	vscode.commands.registerCommand('extension.sayHello', async () => {
		if (!vscode.window.activeTextEditor) {
			vscode.window.showInformationMessage('Open an editor');
			return;
		}
		let config = vscode.workspace.getConfiguration(undefined, vscode.window.activeTextEditor.document.uri);
		try {
			await config.update('tasks', { 'abc': true }, vscode.ConfigurationTarget.WorkspaceFolder);
		} catch (e) {
			console.error(e);
		}
	});
}

Above code should write into the tasks file of the workspace folder of the current active editor in a multi root workspace. But it is throwing an error.

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugconfigVS Code configuration, settingsverifiedVerification succeeded

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions