nix-mode icon indicating copy to clipboard operation
nix-mode copied to clipboard

* inside '' strings breaks syntax highlighting

Open peterhoeg opened this issue 6 years ago • 4 comments

Minimal example (not broken here on GH):

{
  foo = "woot/*";
  bar = ''
    woot/*
  '';
  baz = "hello";
}

In latest nix-mode you will see that highlighting is broken from bar onwards due to the * inside the '' being interpreted wrongly.

peterhoeg avatar Sep 11 '17 02:09 peterhoeg

I am not having this issue. What Emacs version are you running? I am testing on Emacs 25.2. Also whether you have MMM installed might be a factor.

matthewbauer avatar Sep 11 '17 15:09 matthewbauer

I do have mmm-mode installed which is being pulled in by markdown (spacemacs):

https://gist.github.com/27029c8a53132f0cdb37d4c920b29f30

And this is on 25.2

peterhoeg avatar Sep 11 '17 15:09 peterhoeg

What I'm seeing is that syntax highlighting doesn't treat the contents of indented strings as strings (with two single quote characters as delimiters, not double quotes).

It doesn't appear to be connected to /*; that's just the most obvious symptom (since it highlights the rest of the file as a single comment). In this example:

With this example:

{
  foo = "12";
  bar = ''some stuff inherit with   /*'';
  baz = let x = 12; in x;
}

I see:

  1. some stuff in black, like ordinary code, not like the string "12"
  2. inherit and with highlighted as keywords
  3. everything from /* onwards highlighted as a comment

I'm on the latest nixos-unstable; everything's from the channel. Emacs is version 25.3.1. I don't have MMM installed as far as I know.

cumber avatar Sep 21 '17 08:09 cumber

If you run nixos then nix-mode distributed as part of nix gets loaded instead of custom one. You can fix that by removing standard load path in your Emacs config.

sopvop avatar Sep 21 '17 11:09 sopvop