You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to use js2-refactor in web-mode(html file) and were told to just turn on js2-minor-mode but the file content has to be just js code.
The common situation where I want to use web-mode: an html or server side template file, with javascript codes wrapped in <script> tags. js2/js2r doesn't work unless we extract the js codes for js2-mode to parse them alone, not the whole buffer. Is it a good idea to maybe have some configs like (setq js2-js-code-surrounding-tags '("<script>" "</script>"))(setq js2-js-code-matcher "<script>\\(.+\\)<\\/script>") (don't mind my elisp regex error if there's any), so users can easily use all js2 and js2r goodies in html files and so?
This feature shouldn't be too hard to implement with some with-temp-buffer thing I guess? But still a bit beyond my reach and it may fit in js2 so here's this issue. Also this may not cover all server side template files like var <?=$name?> = "<?=$value?>"; (<?=$var?> is the .php file interpolation syntax) as js2 will have parse errors on them, but covering html files should still be quite a step forward.
This idea came up when I read this js2-refactor issue where I duplicated most of the above comment.
The text was updated successfully, but these errors were encountered:
I tried to use js2-refactor in web-mode(html file) and were told to just turn on
js2-minor-mode
but the file content has to be just js code.The common situation where I want to use web-mode: an html or server side template file, with javascript codes wrapped in
<script>
tags. js2/js2r doesn't work unless we extract the js codes for js2-mode to parse them alone, not the whole buffer. Is it a good idea to maybe have some configs like(setq js2-js-code-surrounding-tags '("<script>" "</script>"))
(setq js2-js-code-matcher "<script>\\(.+\\)<\\/script>")
(don't mind my elisp regex error if there's any), so users can easily use all js2 and js2r goodies in html files and so?This feature shouldn't be too hard to implement with some
with-temp-buffer
thing I guess? But still a bit beyond my reach and it may fit in js2 so here's this issue. Also this may not cover all server side template files likevar <?=$name?> = "<?=$value?>";
(<?=$var?>
is the.php
file interpolation syntax) as js2 will have parse errors on them, but covering html files should still be quite a step forward.This idea came up when I read this js2-refactor issue where I duplicated most of the above comment.
The text was updated successfully, but these errors were encountered: