javascript-libraries-syntax.vim icon indicating copy to clipboard operation
javascript-libraries-syntax.vim copied to clipboard

Properties that are keywords cause cascading highlighting issues

Open tandrewnichols opened this issue 7 years ago • 4 comments

I also use vim-javascript for my normal syntax highlighting. However, I've tried commenting out this library in my setup and I don't see the bug, so something here clashes with the setup there. Without this library, vim-javascript correctly does not highlight javascript keywords used as object properties, like obj.class = 'success'. With this library, class gets highlighted according to the syntax highlighting specified by vim-javascript (which is to say, it's the same color "class" would be when used as a class declaration). That by itself isn't really a problem; I could live with it. The problem is that subsequent text is then highlighted erratically because this library seems to think it was an actual class declaration and is expecting the class itself to follow. Here's a screen shot. Note how "MemberService.member.personal.firstname" is yellow. Without this library, it's white, as I'd expect for any object property path.

screen shot 41

tandrewnichols avatar Oct 03 '17 16:10 tandrewnichols

Related - strings are highlighted incorrectly if they contain keywords, such as the library names themselves

screen shot 2017-11-25 at 3 37 04 pm

lararosekelley avatar Nov 25 '17 20:11 lararosekelley

Comments too:

screen shot 11

tandrewnichols avatar Mar 13 '18 15:03 tandrewnichols

I think these are two different issue. The first one I am not sure what is the root cause.

The word highlighted in comment and string is because the syntax of vim-javascript use incorrect(or not following convention) group name.

othree avatar Apr 02 '18 06:04 othree

The first issue has something to do with postprocess.javascript.vim. If I make it not source that file, I don't get syntax highlighting errors with class, but I also don't get library function highlighting on chained functions. Like

angular.module('app').controller

Here angular and module are correctly highlighted but controller is not. And btw, this particular issue is unaffected by vim-javascript. If I remove that from my plugins, I still get these errors on things like .class.

You are correct that the second issue is a discrepancy between this library (which expects things called, e.g., javascriptComment and vim-javascript which is naming them jsComment.

tandrewnichols avatar Dec 10 '18 20:12 tandrewnichols