Skip to content

Incorrect parsing of code injection strings #139

@4jamesccraven

Description

@4jamesccraven

When using a comment based injection, it is typically shown using /* this comment syntax */, however the nixfmt rfc style formatter will change these to # this style of comment. When the comment is changed like that, the injections still function, but the first node inside the string is treated as part of the nix string before continuing. This breaks plugins like otter.nvim that allow lsp functionality inside of code injections. The formatter has an open issue on this (NixOS/nixfmt#179), but ideally the behaviour should not be dependent on comment style. Below is an example screenshot, you can see that the first node, in each case a comment, is green which the colour for a string with my particular theme. This is something I'd really like to get working as it would save me a lot of rebuilds on my neovim configurations. If I can help fix the issue I'm happy to contribute my time as well, I just need guidance on where to begin.

My neovim/nixos configs, for reference

Image

@cstrahan

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions