yats.vim
yats.vim copied to clipboard
tsx syntax highlighting and folding broken when function default arguments are objects
I reproduced this in neovim v0.4.3.
Steps to reproduce:
- Create basic init.vim:
cat > init.vim <<EOF
call plug#begin()
Plug 'HerringtonDarkholme/yats.vim'
call plug#end()
set foldmethod=syntax
EOF
- Create test file:
cat > break-yats.tsx <<EOF
describe("this breaks", () => {
describe.each`
field | value | fieldValue
${"foo"} | ${"bar"} | ${undefined}
${"baz"} | ${"bak"} | ${{ some: "prop" }}
`(
"when making complex default parameters around a nested test",
({ field, value, fieldValue = { [field]: testValue } }) => {
it("breaks syntax highlighting in this test", () => {
expect(something).toStrictEqual({
boz: value,
...fieldValue,
});
});
}
);
describe("breakage", () => {
it("breaks syntax highlighting here", () => {
expect(syntaxHighlighting).toBeBroken();
});
it("breaks syntax folding here", () => {
expect(syntaxFolding).toBeBroken();
});
});
});
EOF
-
nvim -u init.vim break-yats.tsx
Observe that the folding is as follows:
Also observe that the syntax highlighting is as follows:
Expected behaviour:
The folding should look like this:
Also the syntax highlighting should be as follows: