-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Brackets throws exceptions on code with Mustache templates #2906
Comments
One other thought @njx... it seems like Editor.getModeForSelection() changing to sometimes return an object could potentially break a lot of people. In fact I think at one point on the v3 branch the API changed in a similar way by accident and a whole bunch of bugs cropped up as a result (hence the code now returning |
FWIW, I didn't actually change That said, I agree that it would make more sense to actually change |
To me for sprint 21. |
Right, sorry -- I didn't explain it very well. I think what's causing trouble is the change in EditorUtils. Previously all the "core" non-mixed modes were strings, so it was hard to hit cases where Editor.getModeForSelection() returned an object (JSON, and I suppose C/C++ et al... but that was it). Now that HTML files return an object mode, it's much easier to run into. |
Actually, all of these bugs reproduce in CMv2 as well (e.g. in dce04b6). It looks like the hack to make htmlmixed stay in HTML mode for the contents of a @redmunds, do you think you could look at this? It seems like just leaving the mode untouched initially doesn't work--there must be something else we have to do to get the html mode to "stick" for subsequent tags within the |
Hmm, weird -- I could swear the very earliest implementation worked since Mike & Ryan were using it... but even back in Sprint 14 it appears broken. Sorry for the confusion! |
It might not have been that likely to hit since it's probably pretty common for a template to just consist of one tag (plus its descendants). |
I'm seeing the same bug in the CodeMirror htmlmixed demo page, so I opened a CodeMirror bug, to get Marijn's advice on how best to fix. |
Marijn checked in a fix for this one: codemirror/codemirror5@c69ce2e |
Updated to latest CM master (which happens to be 3.1). FBNC @peterflynn |
|
Reviewed. |
Confirmed fixed. And I believe the language API changes resolve my concerns about Closing! |
Not sure if this regressed at the original CMv3 merge, or in the more recent pull #2904.
First bug:
Result: the second line of the template does not appear to be highlighted as HTML.
Second bug:
Result: exception thrown in JS code hinting code. Looking in the debugger, CM thinks the mode at that position is "javascript". (It should be "html").
Third bug:
Start with this HTML code:
And put this code on your clipboard:
</script>
Result: exception thrown in CodeHintManager. At this point, apparently the mode is null. (I assume it should be "html" here too -- is null ever a valid mode?).
The text was updated successfully, but these errors were encountered: