-
Notifications
You must be signed in to change notification settings - Fork 7.6k
HTML Live Preview stops updating after external changes #5336
Comments
Ouch. Our diffing algorithm relies on the marks in CodeMirror to line things up. We undoubtedly could make this work by making the diffing more similar to that of the BULD paper, but that is likely a good deal of work. Another (easier) option would be to reload the page in the browser with freshly instrumented HTML. That seems like the better way to go for now to me. Do you agree, @njx? |
I think that's right. If we detect that the file was changed externally, just reinstrument and reload. |
What do we do if you Cmd+A, Cmd+V in a whole new glob of text? I think the change events you get from Document would be the same in that case too, so I assume it suffers from the same bug / benefits from the same fix? |
The difference is that anything surrounding the pasted text will still have the marks in the correct positions if you do it in Brackets, whereas if you do it in an external file we don't know how to update the marks. |
Oh, I misread your note. Yes, I'm not sure why that would be different. It seems like it should clear all the marks, but reloading the text from the external file should do the same, I think. So it might have the same bug. I'd need to actually try it out to see what's going on. |
Hmm... I hadn't thought of Cmd+A, Cmd+V. It seems like the code would naturally want to do something like "delete |
Somehow when we fixed the "re-insert |
assigned @njx, medium priority. |
Fixing delete/move of special tags doesn't seem to fix this problem, so there's something else going on here. |
As a workaround, I wonder if we should just trigger a reload of the Live Preview page whenever this happens. Otherwise the workflow for people using something like Jade is pretty janky. Nominating for 1.0 in case we want to do that low-hanging fruit work. |
Reviewed, leaving open for 1.0. |
To @dangoor |
Reviewed - lowered priority on this one since it feels a bit like a corner case to edit outside of Brackets while doing Live Preview. |
Result:
The Live Preview is frozen in whatever state it was in before step 4. It does not reflect the external changes or any subsequent changes you make within Brackets. Live Highlight also appears to stop functioning.
This only occurs for HTML files -- CSS files continue updating & highlighting just fine after steps like these.
The text was updated successfully, but these errors were encountered: