Closed jez closed 5 years ago
@elzr bump! Let me know if there's anything I should change or explain better 🙂
I also ran into this problem.
For the fix, you can avoid the negative lookbehind simply by swapping the branches in the preceding group (i.e. \(\\\"\|[^"]\)\+"
instead of "\([^"]\|\\\"\)\+
), so that an escaped quote always gets matched by the group, and the quote part cannot leak out of the group.
Complete line:
syn match jsonStringMatch /"\(\\\"\|[^"]\)\+"\ze[[:blank:]\r\n]\{-}[,}\]]/ contains=jsonString
@jez Why did you close this? As far as I can see, the fix hasn't been included anywhere? Is there another fork that is actively maintained?
Why did you close this?
It was cluttering up my list of open PRs; I wanted to get to "inbox zero"
Is there another fork that is actively maintained?
I use submodules + vim-pathogen to manage my Vim plugins, so I just configured it to point at my fork instead of at elzr/vim-json:
https://github.com/jez/dotfiles/commit/27c9d9899baa104af4886dcb07bbed38a420531e
Feel free to point your config here (but I won't take feature requests or bug fixes). Also feel free to make another PR with these contents yourself.
Ah, thanks for letting me know. I've raised the issue that @elzr apparently doesn't maintain this syntax any longer on the vim_dev mailing list; it would be great if someone else picks up maintenance, wouldn't it?!
Regarding your fix: I'd mentioned above that there's a simpler fix than what you've committed. It avoids the negative lookbehind.
There's actually an even simpler fix for this issue that doesn't require modification of the regexp, just shifting around of the individual :syntax
commands. It's been directly included in the Vim runtime (as vim/vim#4625) and the syntax plugin has been marked as being without a maintainer.
The problem was code like this:
before, we'd highlight the value of the "foo" key as if it were JSON, because
jsonKeywordMatch
would match against the region shown above.By adding the
\\\@<!
before the"
we ensure that a \ doesn't come before the"
; a keyword must be terminated by an unescaped quote.