bug: Calling vscode.window.tabGroups.close in the deactivate function is ineffective
Does this issue occur when all extensions are disabled?: No
- VS Code Version: 1.98.0
- OS Version: Darwin arm64 24.3.0
Steps to Reproduce:
- F5 Start debugger extension
- Close the new window opened by the extension
https://github.com/user-attachments/assets/16052b61-b60d-4ba1-b28f-82e1f7374791
export async function deactivate() {
try {
const tabs = vscode.window.tabGroups.all.flatMap((it) => it.tabs)
console.info('close all tabs')
await vscode.window.tabGroups.close(tabs)
console.info('close all tabs done')
await wait(1000)
} catch (err) {
console.error(err)
}
}
Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.98.0. Please try upgrading to the latest version and checking whether this issue remains.
Happy Coding!
The same error exists in version 1.98.0.
Please see https://github.com/microsoft/vscode/issues/144118#issuecomment-2164664814
Please see #144118 (comment)
Okay, so there are some vscode APIs that cannot be used in deactivate, so how should I close some tabs with open temporary files when the vscode window closes? Currently, I can delete the files, but when reopening the window, the tabs with non-existent files still remain.
so how should I close some tabs with open temporary files when the vscode window closes?
Are you deleting the files in deactivate?
so how should I close some tabs with open temporary files when the vscode window closes?
Are you deleting the files in deactivate?
Yes, I have deleted the file, but the corresponding tab is still there. My current approach is to check the tabs when reopening the workspace and close all invalid tabs.
That seems fine as we do not support async apis in deactivate and do not plan to support them.