Giter Club home page Giter Club logo

vim-jsonc's People

Contributors

elliottcable avatar glepnir avatar kevinoid avatar lanza avatar oppara avatar zhmars avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

vim-jsonc's Issues

Error opening a .jsonc file

Error detected while processing function <SNR>3_LoadFTPlugin:
line    2:
E492: Not an editor command: commentstring< comments<

The error goes away if I comment out the loading of the plugin in my /etc/xdg/nvim/sysinit.vim:

" Plug 'kevinoid/vim-jsonc'

Apply for json files as well

It would be useful to add the option to apply this for *.json files as well, or at least document how to in the Readme.

I did it via including this in my init.vim as suggested here:

autocmd BufRead,BufNewFile *.json set filetype=jsonc

Doesn't match last string value in object if followed by a comment

This is a great package. One issues stands out to me for the example below:

{
  "protocol": "gRPC",                      // communication protocol
  "cut": {                                 // cut instruction set
    "to": {
      "USER_ID": ".response.body.id.value" // write instruction
    }
  },
  "request": {                             // request payload
    "body": {
      "email": "[email protected]"
    },
    "uri": "user_api.User/CreateUser"      // request uri
  },
  "response": {                            // response payload
    "body": "created user: ${USER_ID}",
    "status": 0                            // response status code
  }
}

It seems that any alphanumberic character in a string value that is preceded by a period gets highlighted with the jsonNoQuotes tag.

So for "USER_ID": ".response.body.id.value" // write instruction: response, body, id, and value are all highlighted with an error tag

EDIT: it looks like the jsonStringMatch is not matching on those two lines. Perhaps a lookahead is needed for the comment section?

Add eslint configuration to ALE linters

Eslint allows linting via the eslint-plugin-jsonc plugin.

I've tested it with ALE and it works fine, we just need to add the following linter configuration:
https://github.com/jpesce/vim-jsonc/blob/master/ale_linters/jsonc/eslint.vim

call ale#linter#Define('jsonc', {
\   'name': 'eslint',
\   'output_stream': 'both',
\   'executable': function('ale#handlers#eslint#GetExecutable'),
\   'cwd': function('ale#handlers#eslint#GetCwd'),
\   'command': function('ale#handlers#eslint#GetCommand'),
\   'callback': 'ale#handlers#eslint#HandleJSON',
\})

To make it easier, if you want I can make the pull request.

jsonc highlight error when last element in the list is commented

vim-jsonc shows error:

 "modules-left": [                
   //"custom/name",
   "sway/workspaces",
   "custom/weather",
   "sway/mode"
   //"custom/right-arrow-dark"
 ],

vim-jsonc does NOT shows error

 "modules-left": [                
   //"custom/name",
   "sway/workspaces",
   "custom/weather",
   //"custom/right-arrow-dark"
   "sway/mode"
 ],

I am using NeoVIM: NVIM v0.4.4 on Debian

Let me know if more info is needed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.