Code Monkey home page Code Monkey logo

vim-hjson's Introduction

NPM Maven Central PyPI nuget Packagist crate crate Go Pkg LuaRocks

Hjson, a user interface for JSON

Hjson

Adds comments, makes it nicer to read and avoids comma mistakes.

For details see hjson.github.io.

vim-hjson's People

Contributors

laktak 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

vim-hjson's Issues

Broken indentation

Doing gg=G reveals the horrors of the broken indentation. I am unsure of wether it's a general issue or strictly an issue with NeoVim comparability.

NeoVim version: v0.10.0-dev

Inconsistent highlighting

Syntax highlighting seems to change depending on where my cursor is in the file, which is ... strange, to say the least.

Tested on NVIM v0.10.0 and Vim 8.0. I see similar behavior on both, though the Vim 8.0 issue is subtly different, possibly due to different rerendering behavior.

NVIM v0.10.0

Screen.Recording.2023-12-05.at.8.58.00.PM.mov

Vim 8.0

Screen.Recording.2023-12-05.at.9.00.28.PM.mov

highlighting from hjson/try shows odd result

From the /try example on hjson.org, there is one section of output that looks odd in vim-hjson.

{
  # commas are optional
  commas:
  {
    one: 1
    two: 2
  }
}

Looks like this:
20170427-c15nw4zsud

The one: 1 part shows the number without highlighting. My vimrc has this in it:

hi clear Identifier
hi clear Statement

But that doesn't seem to explain 1 lacking highlighting.

`]` and `}` are highlighted differently from their corresponding opening brackets

Apparently, syntax highlighting assumes presence of commas between list elements, which are optional in hjson.

I expect a closing bracket (of a list or object) to be displayed in same colors as a corresponding opening bracket.

Instead, closing } of some objects within a list AND the ] of that list are highlighted rather like string literals (at least in my colorscheme). To be precise, wrong } highlighting happens for objects:

  1. followed by another object or string, but
  2. not separated from it with comma nor comment.

Sample

According to https://hjson.github.io/try.html, this is a valid list of 6 elements โ€” 5 objects and 1 string:

[
    {x:1}
    {y:2} {z:3}
    {z:4}
    "You are in a debris room filled with stuff washed in from the surface."
    {y:5}
]

Demo

asciicast

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.