Skip to content

Refactor TypeScript compiler options refresh logic#252

Merged
wham merged 1 commit intomainfrom
claude/fix-monaco-refresh-issue-YxT3Q
Feb 22, 2026
Merged

Refactor TypeScript compiler options refresh logic#252
wham merged 1 commit intomainfrom
claude/fix-monaco-refresh-issue-YxT3Q

Conversation

@wham
Copy link
Owner

@wham wham commented Feb 22, 2026

Summary

Replaced inline TypeScript compiler options refresh code with a dedicated function call for better maintainability and code reuse.

Key Changes

  • Replaced direct monaco.typescript.typescriptDefaults getter/setter calls with a refreshOpenTaskEditors() function call
  • This refactoring extracts the compiler options revalidation logic into a reusable function, improving code organization and reducing duplication

Implementation Details

The change maintains the same functionality—forcing TypeScript to revalidate restored models after source models are restored—but delegates the implementation to a dedicated function rather than inline code. This makes the intent clearer and allows the refresh logic to be reused elsewhere if needed.

https://claude.ai/code/session_012HLoMtD1iDiFoRSpiZtw5C

🎬 Demo

Video

Demo

Home

Home

Call

Call

Compiler

Compiler

New Project

New Project

After a page refresh, restored task tab models would show unresolved
import errors because source models hadn't been created yet. When
compilation completed and source models were created, the previous
setCompilerOptions trick didn't reliably force Monaco to revalidate.
Replaced it with refreshOpenTaskEditors() which triggers model
re-analysis by resetting each model's value, ensuring Monaco picks up
the newly available source models.

https://claude.ai/code/session_012HLoMtD1iDiFoRSpiZtw5C
@wham wham merged commit 3753f52 into main Feb 22, 2026
2 checks passed
@wham wham deleted the claude/fix-monaco-refresh-issue-YxT3Q branch February 22, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants