Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tsx syntax highlighting and folding broken when function default arguments are objects #187

Open
felamaslen opened this issue May 15, 2020 · 0 comments
Labels
ArrowFunc The fundamental difficulty

Comments

@felamaslen
Copy link

I reproduced this in neovim v0.4.3.

Steps to reproduce:

  1. Create basic init.vim:
cat > init.vim <<EOF
call plug#begin()
Plug 'HerringtonDarkholme/yats.vim'
call plug#end()
set foldmethod=syntax
EOF
  1. 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
  1. nvim -u init.vim break-yats.tsx

Observe that the folding is as follows:

image

Also observe that the syntax highlighting is as follows:

image

Expected behaviour:

The folding should look like this:

image

Also the syntax highlighting should be as follows:

image

@HerringtonDarkholme HerringtonDarkholme added the ArrowFunc The fundamental difficulty label Jun 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ArrowFunc The fundamental difficulty
Projects
None yet
Development

No branches or pull requests

2 participants