Git Product home page Git Product logo

Comments (7)

dqsully avatar dqsully commented on August 16, 2024 1

Yeah, explicit root braces make parsing quite a bit simpler. Thanks for submitting this bug, you definitely let the right person know 🙂.

from textmate-hjson.

dqsully avatar dqsully commented on August 16, 2024

Sorry for the late reply. Hjson's implicit root object syntax has been deprecated. Try this instead:

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

from textmate-hjson.

noblemaster avatar noblemaster commented on August 16, 2024

Adding the root object removes 1 error. Other errors are still there. Also, I have tried my original HJSON here: https://hjson.org/try.html It works without showing any errors at all.

I wasn't aware the root braces are deprecated? Based on https://hjson.org/syntax.html it's still pending (end of the page)!?

from textmate-hjson.

dqsully avatar dqsully commented on August 16, 2024

I don't know about the current status of the RFC, but that page does explain that root braces are obsolete:

While Hjson allows you to omit {} for the root object, this feature should no longer be used.

Could you upload a screenshot of the errors you still see in IntelliJ? Never mind, I installed IntelliJ on my system and I see the same issues.

from textmate-hjson.

dqsully avatar dqsully commented on August 16, 2024

This issue seems to be caused by a difference in how VS Code handles TextMate grammars and how IntelliJ does it. Until I pinpoint the issue, if you decide keep using Hjson in IntelliJ, you can just put a comma after every closing brace of an object property like so:

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

from textmate-hjson.

noblemaster avatar noblemaster commented on August 16, 2024

I am aware that putting a comma and the root braces back into the HJSON text will fix the IntelliJ syntax errors. However, that somewhat defeats the purpose of HJSON and ends just up with regular JSON instead...

I looked at the "Hjson.tmLanguage", but it's little bit over my head to attempt to fix it myself. I am not in a rush. I don't mind dealing with syntax errors now, given that it will hopefully be fixed in the future. Just thought I let someone know :)

I don't know about the status of the RFC either? Although the page discourages from using root braces, they are stated in the RFC. Ditto above, would that not go with the meaning of "Human" JSON to allow to obit them, to make the document more readable? I can't see why that would not be possible from a technical point of view, besides probably being harder to parse?

from textmate-hjson.

noblemaster avatar noblemaster commented on August 16, 2024

I found a solution: telling IntelliJ to parse the file as *.xaml via Settings->File Types does produce correct formatting. That was unexpected.

from textmate-hjson.

Related Issues (9)

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.