Fix stale rejected custom editor model cache on reopen#293395
Fix stale rejected custom editor model cache on reopen#293395murataslan1 wants to merge 1 commit intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes issue #268301 where custom editors would cache rejected model creation promises and never retry, even after the underlying issue (e.g., missing file) was resolved.
Changes:
- Modified
CustomEditorModelManager.add()to clear cached model entries when model creation promises reject - Added a regression test verifying that rejected models can be recreated on subsequent open attempts
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/vs/workbench/contrib/customEditor/common/customEditorModelManager.ts | Adds error handling to clear rejected model entries from the cache |
| src/vs/workbench/contrib/customEditor/test/common/customEditorModelManager.test.ts | Adds a new test suite with regression test for reject-then-recover behavior |
| if (retained) { | ||
| await assert.rejects(retained, error); | ||
| } |
There was a problem hiding this comment.
The test logic is inconsistent. Lines 62-64 check if retained exists and then assert it rejects, but line 65 then asserts that retained is undefined. If retained is undefined (line 65), then lines 62-64 will never execute. The assertion on line 65 should come first, or the entire if block should be removed since we expect retained to be undefined after the model is cleared from the cache.
| if (retained) { | |
| await assert.rejects(retained, error); | |
| } |
f4af514 to
fd12abe
Compare
|
Rebased/refreshed this PR and force-pushed the branch to current main. Still contains the same intended fix:
Please re-review when convenient. |
|
Friendly follow-up — this PR fixes stale rejected custom editor model cache on reopen. Would appreciate a review when available. |
Fixes #268301.
Summary
CustomEditorModelManager.addTest Plan
npx tsx ./node_modules/mocha/bin/mocha --ui tdd src/vs/workbench/contrib/customEditor/test/common/customEditorModelManager.test.ts --timeout 10000