[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: html, css, and js modes working together
From: |
Clément Pit-Claudel |
Subject: |
Re: html, css, and js modes working together |
Date: |
Wed, 1 Feb 2017 02:29:25 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
On 2017-01-31 15:34, Tom Tromey wrote:
> This patch changes the html, css, and js modes to work together a bit.
> With this, the contents of a <style> element are syntax-highlighted and
> indented according to css-mode rules, and the contents of a <script>
> element are syntax-highlighted and indented according to js-mode rules.
> I'd appreciate comments on this approach.
Hi Tom,
I haven't tried the patch, but I can offer a few comments:
I'm a bit wary of rules like the following:
"<script.*?>\\(\\(\n\\|.\\)*?\\)</script>"
Won't this pick up <script> tags in comments? And won't matching large
<script> tags going to be costly? An alternative would be to find the opening
tag, check the context that it appears in, and if it is indeed a proper
<script> tag search forward to find the closing tag.
I also don't think adding #'syntax-propertize-multiline to
'syntax-propertize-extend-region-functions is enough to ensure proper
syntax-propertization (this could miss large scripts — larger than a screenful,
couldn't it?).
Finally: how much of a performance impact does this have? Recomputing syntax
properties for entire <script> and <style> tags for every edit sounds a bit
costly.
Cheers,
Clément.
- Re: html, css, and js modes working together,
Clément Pit-Claudel <=
- Re: html, css, and js modes working together, Stefan Monnier, 2017/02/02
- Re: html, css, and js modes working together, Dmitry Gutov, 2017/02/05
- Re: html, css, and js modes working together, Tom Tromey, 2017/02/05
- Re: html, css, and js modes working together, Dmitry Gutov, 2017/02/05
- Re: html, css, and js modes working together, Clément Pit-Claudel, 2017/02/06
- Re: html, css, and js modes working together, Stefan Monnier, 2017/02/06
- Re: html, css, and js modes working together, Tom Tromey, 2017/02/06