Skip to content

Common pattern for Neovim on Nix files to put language declarations as comments #471

@blackxored

Description

@blackxored

There's AFAIK this common pattern when you use Neovim with Nix files containing embedded strings to prefix the string with the language to get syntax highlighting of the embedded language, an example from my config:

      callback = lib.generators.mkLuaInline /* lua */ ''
        function(args)
      '';

I would prefer if alejandra didn't touch this, but here's what I get instead:

      callback =
        lib.generators.mkLuaInline
        /*
        lua
        */
        ''
          function(args)
        '';

Aside from my own suggested formatting (as I wrote it) I would not mind much if it just formatted like this (which might be easier to implement?):

      callback =
        lib.generators.mkLuaInline /* lua */
        ''
          function(args)
        '';

but I would definitely prefer the first option.

I have provided a very simple test case for the kind soul that will (hopefully) work on this:

0001-test-add-nix-language-idiom-on-embedded-strings.patch

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions