luochen1990 / rainbow

Rainbow Parentheses Improved, shorter code, no level limit, smooth and fast, powerful configuration.
Apache License 2.0
1.78k stars 95 forks source link

[Bug] broken in sml (Standard ML) #146

Closed loreb closed 4 years ago

loreb commented 4 years ago

Describe the bug

Not sure if it's your fault or I should blame sml.vim, but your plugin breaks comments in SML; if sml.vim is to blame, sorry to bother you, my vimscript is a bit rusty.

To Reproduce

Steps to reproduce the behavior, Please provide a minimal piece of code to produce this issue, along with it's filename and it's filetype detected by vim (via :set ft?), a piece of text is better than a picture here. For example:

File: wikipediaexample.sml, filetype=sml

datatype shape
    = Circle   of loc * real      (* center and radius *)
    | Square   of loc * real      (* upper-left corner and side length; axis-aligned *)
    | Triangle of loc * loc * loc (* corners *)

Steps:

  1. Open file via vim myfile.sml
  2. Notice that comment text is NOT commented out; this example is not too bad, but any comment with code snippets...

Expected behavior

Comment text shows as text with no further highlighting other than FIXME/TODO etc.

Screenshots

sml

Additional context

Are you using some third-party syntax plugins? Add any other context about the problem here. Nothing, only stock sml.vim (and the updated version from https://github.com/mmottl/vim-files which exhibits the same problem).

luochen1990 commented 4 years ago

Please try this configuration:

let g:rainbow_conf = {
\  'separately': {
\    'sml': {
\      'parentheses': ['start=/(\ze[^*]/ end=/)/ fold', 'start=/\[/ end=/\]/ fold', 'start=/{/ end=/}/ fold']
\  }}
\}
loreb commented 4 years ago

I tried it on every every sml file I had around and it does the right thing in all cases (nested comments etc), thank you! Sorry for the late reply.