Skip to content

Commit 67b90c7

Browse files
committed
First pass at jsObjectProp
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
1 parent 3cf8f3d commit 67b90c7

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

syntax/javascript.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ syntax sync fromstart
2424
" syntax case ignore
2525
syntax case match
2626

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

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

224226
if exists("javascript_plugin_jsdoc")
225227
runtime extras/jsdoc.vim

0 commit comments

Comments
 (0)