diff options
| author | Jackson Ray Hamilton | 2019-02-11 03:00:34 -0800 |
|---|---|---|
| committer | Jackson Ray Hamilton | 2019-04-08 22:48:21 -0700 |
| commit | be86ece42cbb6204480c794d018b02fbda74689b (patch) | |
| tree | a4734ce3c80cfc605851c11c320f544135c4d968 /test | |
| parent | 27e9bce77db54464737aa5be1ce7142b55f25952 (diff) | |
| download | emacs-be86ece42cbb6204480c794d018b02fbda74689b.tar.gz emacs-be86ece42cbb6204480c794d018b02fbda74689b.zip | |
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 | |||
| 15 | // Don’t even misinterpret unary operators as JSX. | 15 | // Don’t even misinterpret unary operators as JSX. |
| 16 | if (foo < await bar) void 0 | 16 | if (foo < await bar) void 0 |
| 17 | while (await foo > bar) void 0 | 17 | while (await foo > bar) void 0 |
| 18 | |||
| 19 | // Allow unary keyword names as null-valued JSX attributes. | ||
| 20 | // (As if this will EVER happen…) | ||
| 21 | <Foo yield> | ||
| 22 | <Bar void> | ||
| 23 | <Baz | ||
| 24 | zorp | ||
| 25 | typeof> | ||
| 26 | <Please do_n0t delete this_stupidTest > | ||
| 27 | How would we ever live without unary support | ||
| 28 | </Please> | ||
| 29 | </Baz> | ||
| 30 | </Bar> | ||
| 31 | </Foo> | ||