diff options
author | Jackson Ray Hamilton <jackson@jacksonrayhamilton.com> | 2019-02-11 03:00:34 -0800 |
---|---|---|
committer | Jackson Ray Hamilton <jackson@jacksonrayhamilton.com> | 2019-04-08 22:48:21 -0700 |
commit | be86ece42cbb6204480c794d018b02fbda74689b (patch) | |
tree | a4734ce3c80cfc605851c11c320f544135c4d968 /test | |
parent | 27e9bce77db54464737aa5be1ce7142b55f25952 (diff) | |
download | emacs-be86ece42cbb6204480c794d018b02fbda74689b.tar.gz |
js-syntax-propertize: Disambiguate JS from JSX, fixing some indents
Fix some JSX indentation bugs:
- Bug#24896 / https://github.com/mooz/js2-mode/issues/389
- Bug#30225
- https://github.com/mooz/js2-mode/issues/459
* lisp/progmodes/js.el (js--dotted-captured-name-re)
(js--unary-keyword-re, js--unary-keyword-p)
(js--disambiguate-beginning-of-jsx-tag)
(js--disambiguate-end-of-jsx-tag)
(js--disambiguate-js-from-jsx): New variables and functions.
(js-syntax-propertize): Additionally clarify when syntax is JS so that
‘(with-syntax-table sgml-mode-syntax-table …)’ does not mistake some
JS punctuation syntax for SGML parenthesis syntax, namely ‘<’ and ‘>’.
* test/manual/indent/js-jsx-unclosed-2.js: Add additional test for
unary operator parsing.
Diffstat (limited to 'test')
-rw-r--r-- | test/manual/indent/js-jsx-unclosed-2.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/manual/indent/js-jsx-unclosed-2.js b/test/manual/indent/js-jsx-unclosed-2.js index 2d42cf70f84..8b6f33325d7 100644 --- a/test/manual/indent/js-jsx-unclosed-2.js +++ b/test/manual/indent/js-jsx-unclosed-2.js @@ -15,3 +15,17 @@ if (foo > bar) void 0 // Don’t even misinterpret unary operators as JSX. if (foo < await bar) void 0 while (await foo > bar) void 0 + +// Allow unary keyword names as null-valued JSX attributes. +// (As if this will EVER happen…) +<Foo yield> + <Bar void> + <Baz + zorp + typeof> + <Please do_n0t delete this_stupidTest > + How would we ever live without unary support + </Please> + </Baz> + </Bar> +</Foo> |