udalov / kotlin-vim

Kotlin plugin for Vim. Featuring: syntax highlighting, basic indentation, Syntastic support
Apache License 2.0
632 stars 51 forks source link

Fix nested comments #2

Closed chocolateboy closed 10 years ago

chocolateboy commented 10 years ago

The whole of the following program is highlighted as a comment for me in vim 7.4 (Ubuntu 14.04):

/* Hello, world! */

fun main(args: Array<String>) {
    println("Hello, world!")
}

The problem appears to be that /* is matched as the start of the inner/contained region rather than the start of the outer/containing region i.e. this works:

/* */ */

fun main(args: Array<String>) {
    println("Hello, world!")
}

The documentation doesn't help much, but using a matchgroup (and not giving it the same name as the region) seems to solve the problem, and even handles /*/**/*/ and /* */* (via) correctly.

I also updated the README to include Vundle and Pathogen installation instructions.

udalov commented 10 years ago

Interesting... I don't have such a problem neither on Ubuntu nor on OS X. Do you have any specific configuration options that may cause this, e.g. a non-default 'magic' value? Does it reproduce on a clean (no .vimrc) setup?

chocolateboy commented 10 years ago

Do you have any specific configuration options that may cause this, e.g. a non-default 'magic' value?

Not that I'm aware of. vim -u NONE was the first thing I tried. The problem doesn't exist for me prior to this commit, and it goes away if I replace contains=ktComment,ktTodo,@Spell with contains=ktTodo,@Spell.

Does this also fix something? :)

No, it's just for consistency :-)

chocolateboy commented 10 years ago

I can't reproduce the main issue with vim 7.3.409 (though it still barfs on /*/**/*/ and /* */* without this patch). My 7.4 patchlevel is 52.

udalov commented 10 years ago

Thank you!