Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@IzhakJakov
Copy link

@IzhakJakov IzhakJakov commented Jul 2, 2021

Description from issue #8499

I see more and more tools using jsonc format for their configuration files. I believe this trend will only increase and VIM should consider supporting these formats

jsonc

Basically a JSON with C-style line (//) and block (/**/) comments.
Exiting vim plugin: https://github.com/kevinoid/vim-jsonc

Steps to reproduce using vim -u NONE

$ vim -u NONE sample.jsonc
<opened as a plain text>

Actual behaviour

opens up as a plain text

Expected behaviour

Opened as a jsonc file:

  • proper syntax highlighting
  • proper error messages
  • proper indentation and formatting

@codecov
Copy link

codecov bot commented Jul 2, 2021

Codecov Report

Merging #8500 (ca26cb8) into master (b836f63) will decrease coverage by 0.03%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8500      +/-   ##
==========================================
- Coverage   90.01%   89.97%   -0.04%     
==========================================
  Files         149      149              
  Lines      167978   167329     -649     
==========================================
- Hits       151212   150562     -650     
- Misses      16766    16767       +1     
Flag Coverage Δ
huge-clang-none 89.12% <ø> (+0.08%) ⬆️
huge-gcc-none 89.51% <ø> (+<0.01%) ⬆️
huge-gcc-testgui 88.12% <ø> (-0.01%) ⬇️
huge-gcc-unittests 2.49% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/os_unix.c 71.16% <0.00%> (-0.96%) ⬇️
src/if_python.c 82.65% <0.00%> (-0.62%) ⬇️
src/gui.c 71.97% <0.00%> (-0.44%) ⬇️
src/syntax.c 86.58% <0.00%> (-0.43%) ⬇️
src/ops.c 95.58% <0.00%> (-0.42%) ⬇️
src/getchar.c 91.14% <0.00%> (-0.39%) ⬇️
src/if_cscope.c 82.06% <0.00%> (-0.37%) ⬇️
src/ui.c 83.01% <0.00%> (-0.36%) ⬇️
src/hardcopy.c 87.48% <0.00%> (-0.29%) ⬇️
src/fold.c 94.53% <0.00%> (-0.25%) ⬇️
... and 18 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b836f63...ca26cb8. Read the comment docs.

@chrisbra
Copy link
Member

chrisbra commented Jul 2, 2021

Don't you need a ftplugin with jsonc? json has one: json.vim.

Also you would need to adjust runtime/filetype.vim to let Vim know, when to apply the jsonc filetype. And when you add a new filetype to filetype.vim, please also add a test to src/testdir/test_filetype.vim

	new file:   runtime/ftplugin/jsonc.vim
	modified:   runtime/filetype.vim
	modified:   runtime/syntax/jsonc.vim
	modified:   src/testdir/test_filetype.vim
@IzhakJakov
Copy link
Author

@chrisbra

Don't you need a ftplugin with jsonc? json has one: json.vim.

Also you would need to adjust runtime/filetype.vim to let Vim know, when to apply the jsonc filetype. And when you add a new filetype to filetype.vim, please also add a test to src/testdir/test_filetype.vim

Done.

@brammool brammool closed this in acbb4b5 Jul 3, 2021
@IzhakJakov
Copy link
Author

Hi @brammool I think 3 files are missing from commit acbb4b5

Looks like it is only including: runtime/filetype.vim and src/testdir/test_filetype.vim
However, there should also be 3 jsonc.vim in runtime: syntax/, indent/ and ftplugin/

@brammool
Copy link
Contributor

brammool commented Jul 3, 2021 via email

janlazo added a commit to janlazo/neovim that referenced this pull request Jul 4, 2021
Problem:    JSONC files are not recognized.
Solution:   Recognize .jsonc files. (Izhak Jakov, closes vim/vim#8500)
vim/vim@acbb4b5

N/A patches for version.c:

vim-patch:8.2.3081: cannot catch errors in a channel command

Problem:    Cannot catch errors in a channel command.
Solution:   Instead of skipping the error make it silent. (closes vim/vim#8477)
vim/vim@11a632d

vim-patch:8.2.3082: a channel command "echoerr" does not show anything

Problem:    A channel command "echoerr" does not show anything.
Solution:   Do not use silent errors when using an "echoerr" command.
            (closes vim/vim#8494)
vim/vim@b836f63

vim-patch:8.2.3094: Test_popup_atcursor_pos() fails without the conceal feature

Problem:    Test_popup_atcursor_pos() fails without the conceal feature.
Solution:   Add a check for the conceal feature. (Dominique Pellé,
            closes vim/vim#8505)
vim/vim@c60e959
janlazo added a commit to janlazo/neovim that referenced this pull request Jul 4, 2021
Problem:    JSONC files are not recognized.
Solution:   Recognize .jsonc files. (Izhak Jakov, closes vim/vim#8500)
vim/vim@acbb4b5

N/A patches for version.c:

vim-patch:8.2.3081: cannot catch errors in a channel command

Problem:    Cannot catch errors in a channel command.
Solution:   Instead of skipping the error make it silent. (closes vim/vim#8477)
vim/vim@11a632d

vim-patch:8.2.3082: a channel command "echoerr" does not show anything

Problem:    A channel command "echoerr" does not show anything.
Solution:   Do not use silent errors when using an "echoerr" command.
            (closes vim/vim#8494)
vim/vim@b836f63

vim-patch:8.2.3094: Test_popup_atcursor_pos() fails without the conceal feature

Problem:    Test_popup_atcursor_pos() fails without the conceal feature.
Solution:   Add a check for the conceal feature. (Dominique Pellé,
            closes vim/vim#8505)
vim/vim@c60e959

vim-patch:8.2.3098: popup window test is flaky on MS-Windows with GUI

Problem:    Popup window test is flaky on MS-Windows with GUI.
Solution:   Skip the check in this situation.
vim/vim@999db23
chrisbra pushed a commit to chrisbra/vim that referenced this pull request Aug 30, 2021
Problem:    JSONC files are not recognized.
Solution:   Recognize .jsonc files. (Izhak Jakov, closes vim#8500)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants