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

punctuation.definition.attrset-or-function.nix doesn't allow antiquotation as first key #189

Closed
lilyball opened this issue Jan 1, 2022 · 1 comment

Comments

@lilyball
Copy link

lilyball commented Jan 1, 2022

If I have an attrset with a newline after the { in a position that admits functions, this is scoped as punctuation.definition.attrset-or-function.nix. In this context, if the first key is an antiquotation, it flags this as a syntax error. Besides being an incorrect error, this can cause the rest of the file to tokenize incorrectly as well.

As an example, see lib/generators.nix in nixpkgs. This also highlights incorrectly in GitHub of course. Sample extract:

{
  # …
  recurse = path: value:
    # …
    if length path > 1 then {
      ${concatStringsSep "." (lib.reverseList (tail path))}.${head path} = value;
    } else {
      ${head path} = value;
    };
}

In this example, the rest of the line ends up being treated as inside a double-quoted string, and so the rest of the file is highlighted incorrectly.

This particular issue is actually something I fixed in my vscode-nix fork a year ago, see lilyball/vscode-nix@2a7db0f, but I'm not in a position to port this to vscode-nix-ide or open any PRs at the moment.

@jnoortheen
Copy link
Collaborator

Thanks for the input @lilyball

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants