Git Product home page Git Product logo

textmate-hjson's Introduction

TextMate compatible Syntax for Hjson

A lot of editors support TextMate compatible syntax definitions. You can use this package to install Hjson syntax highlighting support.

IntelliJ Installation

  • Install TextMate bundles support (if it is not installed already)

    • Open Preferences/Plugins
    • Click Install JetBrains plugin...
    • Type "textmate" in the search box
    • Install "TextMate bundles support"
    • Restart IntelliJ
  • Install Hjson syntax

    • clone or download this repo git clone https://github.com/hjson/textmate-hjson.git
    • Open Preferences/Editor in IntelliJ
    • Select Textmate Bundles
    • Click on + and select the textmate-hjson folder
    • Depending on your color scheme you may wish to edit the mapping on the same screen (E.g. select something like Dracula if you are using a dark scheme)
  • To install a custom color scheme

    • Create a subfolder named Themes in the textmate-hjson folder
    • Download your favorite tmTheme file to the folder you just created
    • You may need to restart/re-add the Hjson bundle
    • The theme should now show up in the mappings in Textmate Bundles

Others

Check Editor Support for a native package first (like Sublime/Atom/Visual Studio).

If your editor is not listed you may be able to install this package if it supports TextMate syntax bundles.

textmate-hjson's People

Contributors

dqsully avatar laktak avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

Forkers

isabella232

textmate-hjson's Issues

Comment highlighting

Hi,
I noticed, that the plugin highlights any text after :// as a comment no matter what it's surrounded by. So e.g. if I have a line like
"jdbc_url": "jdbc:gdc:datawarehouse://{params.hostname}}/datawarehouse/instances/xzy"
everything after //{ looks like a comment. When I parse it, it is not interpreted as a comment as well as when I try to reproduce this issue on the official HJSON site https://hjson.org/try.html it doesn't interpret or highlight such cases as comments which leads me to believe it's an error in this plugin.
The same goes for :# and :*/

Formatting?

I installed this in IntelliJ IDEA. The syntax highlighting is fair, but I was disappointed to see that formatting (especially indenting) is not supported. Could that be added?

Errors Parsing HJSON (IntelliJ)

I getting several errors for the following JSON. I am using the latest version of IntelliJ, TextMate and HJSON:

schema: [
  { id: 7
    spec: {
      comp: {
        any: true
      }
      wrong-color: {
        some: "thing"
      }
    }
  }
]

Error List:

  • 3x curly braces '}' are highlighed in red
  • 1x rectangular ']' brace in red
  • the "wrong-color" part is wrongly colored.

Editor Screenshot:
2019-03-03 hjson formatter - problem

Requires trailing comma or whitespace after last subobject

Steps to reproduce:

  1. Create a .hjson file with the following content and open it after installing textmate-hjson in PHPStorm 2018.2:
{
    subobject: {}
}

Expected behavior:
The last closing brace should not have syntax error highlight.

Actual behavior:
The last closing brace has syntax error highlight.

Additional observations:

  1. If comma or whitespace is added after the subobject's closing brace, the syntax error highlight goes away. Same if whitespace is added before the end of the line that contains the subobject's closing brace. Neither is a good workaround because the comma is ugly and trailing whitespaces can be stripped by editor.

  2. This happens whenever the last subobject of an object is not terminated by comma or whitespace after the closing brace (but on the same line), even if that subobject is not the last property. It therefore happens i this case:

{
    am_I_an_object: { answer: "yes" }
    am_I_one_too: false
}

But not in this one (note the comma):

{
    am_I_an_object: { answer: "yes" },
    am_I_one_too: false
}

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.