fix: highlighting issue happening due to state reuse#2180
Conversation
Greptile SummaryThis PR addresses a syntax-highlighting regression caused by CodeMirror editor state being reused across file switches without re-applying the language compartment. It adds explicit language-extension re-configuration in the reusable-state path of
Confidence Score: 3/5The The core Both changed files need attention: Important Files Changed
Sequence DiagramsequenceDiagram
participant EF as EditorFile.load()
participant EM as editorManager
participant AFE as applyFileToEditor()
participant CM as CodeMirror editor
EF->>EF: "session = EditorState.create({doc})"
EF->>EF: "__cmSessionReady = false"
EF->>EF: markLoaded()
EF->>EM: switchFile(this.id)
EM-->>EF: early return (file already active — no-op)
Note over CM: Editor still shows old/stale state
EM->>AFE: switchFile called from tab click
AFE->>AFE: isReusableEditorState?
alt state reusable
AFE->>CM: editor.setState(session)
AFE->>CM: languageCompartment.reconfigure(langExt) NEW
else state not reusable
AFE->>CM: editor.setState(new full state)
end
Reviews (1): Last reviewed commit: "fix: highlighting issue happening due to..." | Re-trigger Greptile |
No description provided.