Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

HTML Live Preview stops updating after external changes #5336

Open
peterflynn opened this issue Sep 25, 2013 · 13 comments
Open

HTML Live Preview stops updating after external changes #5336

peterflynn opened this issue Sep 25, 2013 · 13 comments

Comments

@peterflynn
Copy link
Member

  1. Start Live Preview
  2. Open the HTML file in a different editor
  3. Make some changes, save, and close the file
  4. Switch back to Brackets
  5. Make some more changes

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.

@dangoor
Copy link
Contributor

dangoor commented Sep 25, 2013

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?

@njx
Copy link

njx commented Sep 25, 2013

I think that's right. If we detect that the file was changed externally, just reinstrument and reload.

@peterflynn
Copy link
Member Author

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?

@njx
Copy link

njx commented Sep 25, 2013

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.

@njx
Copy link

njx commented Sep 25, 2013

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.

@dangoor
Copy link
Contributor

dangoor commented Sep 26, 2013

Hmm... I hadn't thought of Cmd+A, Cmd+V. It seems like the code would naturally want to do something like "delete <html> element" and then add everything, and it's entirely possible that there's some undefined behavior there.

@njx
Copy link

njx commented Sep 26, 2013

Somehow when we fixed the "re-insert <body>" case, it didn't occur to me to handle the "delete <body>" case specially as well (and other cases like elementMove). For deletes, we should treat it as deleting all the children; for move, we should probably just ignore it.

@ghost ghost assigned njx Sep 30, 2013
@pthiess
Copy link
Contributor

pthiess commented Sep 30, 2013

assigned @njx, medium priority.

@njx
Copy link

njx commented Oct 24, 2013

Fixing delete/move of special tags doesn't seem to fix this problem, so there's something else going on here.

@peterflynn
Copy link
Member Author

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.

@peterflynn peterflynn added this to the Brackets 1.0 milestone Mar 28, 2014
@peterflynn peterflynn changed the title HTML Live Preview stops updating after syncing external changes HTML Live Preview stops updating after external changes Mar 28, 2014
@njx
Copy link

njx commented Apr 14, 2014

Reviewed, leaving open for 1.0.

@njx njx assigned dangoor and unassigned njx Jul 12, 2014
@njx
Copy link

njx commented Jul 12, 2014

To @dangoor

@pthiess
Copy link
Contributor

pthiess commented Aug 15, 2014

Reviewed - lowered priority on this one since it feels a bit like a corner case to edit outside of Brackets while doing Live Preview.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants