[vim/vim] Support JSONL syntax highlighting (#7520)

53 views
Skip to first unread message

Yash Singh

unread,
Dec 20, 2020, 10:57:28 PM12/20/20
to vim/vim, Subscribed

Is your feature request about something currently impossible or hard to do? Please describe the problem.

JSONL is an easier way to use JSON in arrays: jsonlines.org. Not a problem

Describe the solution you'd like
A clear and concise description of what you want to happen.

Syntax highlighting for JSONL

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

I tried the following locally:

---------------------------- runtime/filetype.vim -----------------------------

index 7322f74be..b871794d1 100644
@@ -834,7 +834,7 @@ au BufNewFile,BufRead *.jgr			setf jgraph
 au BufNewFile,BufRead *.jov,*.j73,*.jovial	setf jovial
 
 " JSON
-au BufNewFile,BufRead *.json,*.jsonp,*.webmanifest	setf json
+au BufNewFile,BufRead *.json,*.jsonl,*.jsonp,*.webmanifest	setf json
 
 " Kixtart
 au BufNewFile,BufRead *.kix			setf kix

This seems to give an error every time I miss a comma:

Screenshot from 2020-12-20 19-48-10


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Christian Brabandt

unread,
Dec 21, 2020, 2:33:41 AM12/21/20
to vim/vim, Subscribed

There are two questions here:

  1. should jsonlines files be detected as json files? So are jsonline files compatible with json syntax? If it is, then the patch to filetype.vim seems fine.
  2. I would expect a comma for the extract shown on your screenshot. So is this actually valid jsonline/json syntax? If yes, this should be addressed by the syntax file maintainer. So you might want to contact him.

Jonas Strittmatter

unread,
Jan 10, 2022, 3:50:01 PM1/10/22
to vim/vim, Subscribed

I am also interested in getting support for .jsonl files since they are regularly used for data files (e.g. loggers, search engines support this format). See here: https://jsonlines.org/.

@chrisbra To answer your questions:

  1. No, jsonlines files are not valid json, therefore I think this will require a new filetype.
  2. The jsonlines specifies that each line must be a valid json object (without a trailing comma), that's it basically.

I tried to contact the maintainer that's listed here as vacancy. I was of the impression that this referred to the GitHub username of the maintainer, however I contacted her and she replied she is not the maintainer.

Is there any other info about the current maintainer so I can contact him / her?

Thanks.


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/7520/1009330279@github.com>

Christian Brabandt

unread,
Jan 11, 2022, 5:34:30 AM1/11/22
to vim/vim, Subscribed

if jsonlines and json are different enough that we need a new syntax script anyhow, then we do not need to worry about the current json maintainer. Would anybody volunteer to maintain this? If yes, please go ahead and create a PR with your new runtime files.


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/7520/1009828186@github.com>

nacho00112

unread,
May 18, 2023, 9:42:32 AM5/18/23
to vim/vim, Subscribed

This guy did it vim-jsonl, it seemed that it really wasn't a hard task, i don't know vim language but it seemed he only taked the json syntax and fixed the comma syntax errors


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/7520/1553076511@github.com>

Bram Moolenaar

unread,
May 18, 2023, 11:33:57 AM5/18/23
to vim/vim, Subscribed

How about I make a patch to detect *.jsonl files as the "jsonl" filetype. Then please add filetype and indent plugins that use the json plugins for now. And ask the author of vim-jsonl to provide that file for including in the runtime files, with a proper header.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/7520/1553239868@github.com>

Yang Liu

unread,
Jan 9, 2024, 10:17:59 PM1/9/24
to vim/vim, Subscribed

This guy did it vim-jsonl, it seemed that it really wasn't a hard task, i don't know vim language but it seemed he only taken the json syntax and fixed the comma syntax errors

This plugin is really simple but helpful, thanks for sharing!


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/7520/1884126486@github.com>

Reply all
Reply to author
Forward
0 new messages