Coder Social home page Coder Social logo

Comments (8)

dsherret avatar dsherret commented on April 24, 2024 1

@bartlomieju FYI, I did a 0.14.0 release because I needed to keep the error message property not having the range for dprint-plugin-json. It should still display with the range when doing parse_to_value(...)? though.

from jsonc-parser.

dsherret avatar dsherret commented on April 24, 2024

I was thinking this the other day and came across a similar issue using dprint-plugin-typescript about 5 mins ago 😂. It’s because I didn’t/still don’t really understand Error. This would be a good change... do you have the time to implement it properly to show me how it’s done?

It returns an Option because the file might be empty.

from jsonc-parser.

bartlomieju avatar bartlomieju commented on April 24, 2024

I was thinking this the other day and came across a similar issue using dprint-plugin-typescript about 5 mins ago 😂. It’s because I didn’t/still don’t really understand Error. This would be a good change... do you have the time to implement it properly to show me how it’s done?

It's just a blanket trait - it requires to implement Display on the struct implementing Error - I guess the only purpose of that trait is to have "idiomatic" handling of errors. Sure, I can open a PR.

It returns an Option because the file might be empty.

Thanks that makes sense

from jsonc-parser.

dsherret avatar dsherret commented on April 24, 2024

Oh! I am just remembering the get_message_with_range thing. It would be nice if it did that by default always. Perhaps the current error can be renamed and returned in the lower level functions and then the top level functions can return a ParseError that has the message with the range. I'm not sure what's best though (this is more complicated than I remember... I can do it when I get back from lunch if you're not up for it).

from jsonc-parser.

bartlomieju avatar bartlomieju commented on April 24, 2024

@dsherret I'm gonna change ParseError not to have get_message_with_range() - I will perform that logic when creating ParseError

from jsonc-parser.

bartlomieju avatar bartlomieju commented on April 24, 2024

@dsherret you were faster! Whichever for works for you better

from jsonc-parser.

dsherret avatar dsherret commented on April 24, 2024

@bartlomieju awesome! Yeah, if you have it figured out already then that would be super helpful!

from jsonc-parser.

bartlomieju avatar bartlomieju commented on April 24, 2024

@dsherret my approach would need to store whole text on one of Scanner/Context. I'm not sure if that's a valid approach...

from jsonc-parser.

Related Issues (18)

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.