Fix bookmarks tree view registration error#4685
Conversation
|
@sean-mcmanus Hi! Thanks for filing #4683 - if you have time, I would appreciate if you can check if this approach fixes your issue, thanks! |
There was a problem hiding this comment.
Pull request overview
This pull request fixes a race condition error where the bookmarks tree view was being created before VS Code had properly registered the view contribution. The error "No view is registered with id: cmake.bookmarks" occurred because the view is conditionally contributed based on cmake:enableFullFeatureSet context, but the tree view was being eagerly created before this context was set to true.
Changes:
- Converted bookmarks tree view from eager initialization to lazy initialization
- Added lifecycle management to create the tree view only when the full feature set is enabled
- Added proper disposal when the feature set is disabled
- Implemented defensive checks including try-catch error handling and package.json contribution verification
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@hanniavalera I don't know what the repro is. I hit it a couple times. |
|
@sean-mcmanus No worries, thank you for getting back to me so promptly! |
d0a038f to
90dec50
Compare
Co-authored-by: snehara99 <113148726+snehara99@users.noreply.github.com>
This change addresses item #4683
This changes visible behavior
The following changes are proposed:
ExtensionManagerconstructorcmake:enableFullFeatureSetbecomestrueThe purpose of this change
After the bookmarks feature was introduced in #4539, users reported seeing the error:
This occurred because the
cmake.bookmarksview is contributed with"when": "cmake:enableFullFeatureSet"in package.json, meaning VS Code only registers the view container when that context istrue. However, the tree view was being created eagerly in theExtensionManagerconstructor before the context value was set, causing a race condition wherevscode.window.createTreeView()was called before VS Code had registered the view.The fix defers tree view creation until
enableFullFeatureSet(true)is called, ensuring the view container is properly registered by VS Code before we attempt to create the tree view.Other Notes/Information
isBookmarksViewContributed()