Skip to content

Commit 3727f08

Browse files
authored
Merge pull request elzr#89 from anchnk/master
add jsonl support
2 parents a05984f + 51edb42 commit 3727f08

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

ftdetect/json.vim

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
autocmd BufNewFile,BufRead *.json setlocal filetype=json
2+
autocmd BufNewFile,BufRead *.jsonl setlocal filetype=json
23
autocmd BufNewFile,BufRead *.jsonp setlocal filetype=json
34
autocmd BufNewFile,BufRead *.geojson setlocal filetype=json
45
autocmd BufNewFile,BufRead *.template setlocal filetype=json

jsonl-test.jsonl

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{"name": "Gilbert", "wins": [["straight", "7♣"], ["one pair", "10♥"]]}
2+
{"name": "Alexa", "wins": [["two pair", "4♠"], ["two pair", "9♠"]]}
3+
{"name": "May", "wins": []}
4+
{"name": "Deloise", "wins": [["three of a kind", "5♣"]]}

syntax/json.vim

+6-4
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,12 @@ if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1)
7171
syn match jsonTrailingCommaError ",\_s*[}\]]"
7272

7373
" Syntax: Watch out for missing commas between elements
74-
syn match jsonMissingCommaError /\("\|\]\|\d\)\zs\_s\+\ze"/
75-
syn match jsonMissingCommaError /\(\]\|\}\)\_s\+\ze"/ "arrays/objects as values
76-
syn match jsonMissingCommaError /}\_s\+\ze{/ "objects as elements in an array
77-
syn match jsonMissingCommaError /\(true\|false\)\_s\+\ze"/ "true/false as value
74+
syn match jsonMissingCommaError /\("\|\]\|\d\)\zs\_s\+\ze"/
75+
syn match jsonMissingCommaError /\(\]\|\}\)\_s\+\ze"/ "arrays/objects as values
76+
if (expand('%:e') !=? 'jsonl')
77+
syn match jsonMissingCommaError /}\_s\+\ze{/ "objects as elements in an array
78+
endif
79+
syn match jsonMissingCommaError /\(true\|false\)\_s\+\ze"/ "true/false as value
7880
endif
7981

8082
" ********************************************** END OF ERROR WARNINGS

0 commit comments

Comments
 (0)