Skip to content

Commit

Permalink
First pass at jsObjectProp
Browse files Browse the repository at this point in the history
I had an interesting idea to disable various matches like `class` and
`require` from appearing when using `.` notation on objects.

The proposed fix is to create a special `jsObjectProp` match, with a
super high priority, that is used as a `nextgroup` for `.`

It is not assigned any colors or match groups, it simply exists to
disable other items from matching.

This is a very quick pass and I have not really tested it yet, but I
think it could be a very viable, working solution
  • Loading branch information
amadeus committed Jan 17, 2017
1 parent 3cf8f3d commit 67b90c7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion syntax/javascript.vim
Expand Up @@ -24,7 +24,8 @@ syntax sync fromstart
" syntax case ignore
syntax case match

syntax match jsNoise /[:,\;\.]\{1}/
syntax match jsNoise /[:,\;]\{1}/
syntax match jsNoise /[\.]\{1}/ skipwhite skipempty nextgroup=jsObjectProp
syntax match jsFuncCall /\k\+\%(\s*(\)\@=/
syntax match jsParensError /[)}\]]/

Expand Down Expand Up @@ -220,6 +221,7 @@ syntax region jsCommentMisc contained start=/\/\*/ end=/\*\// contains=j
" Decorators
syntax match jsDecorator /^\s*@/ nextgroup=jsDecoratorFunction
syntax match jsDecoratorFunction contained /[a-zA-Z_][a-zA-Z0-9_.]*/ nextgroup=jsParenDecorator
syntax match jsObjectProp contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>/

if exists("javascript_plugin_jsdoc")
runtime extras/jsdoc.vim
Expand Down

0 comments on commit 67b90c7

Please sign in to comment.