Giter Club home page Giter Club logo

Comments (5)

nblumhardt avatar nblumhardt commented on July 24, 2024

Hi! Nothing like this is built in - not sure how it could be welded on, but very interested to hear how you go if you come up with something!

Best regards,
Nick

from superpower.

skyne98 avatar skyne98 commented on July 24, 2024

@nblumhardt, to be honest, in such case I see only two solutions:

  • as commonly done, you can always create additional parsers for the "wrong" situations
  • avoid this problem altogether and provide completions only for correctly parsed programs (identifier completions, for example)

from superpower.

skyne98 avatar skyne98 commented on July 24, 2024

The first solution will partially solve the problem, however, we all know that you cannot physically cover all the scenarios. Also, the codebase will become a big mess, trying to make parsers for all the "wrong" paths a user can take.
The second one is feasible in the beginning, as most of the times you want exactly that type of completions. However, in that case you will have a very limited set of possible completions you can provide.

Either of those ways won't provide a full experience for the user. The only practical solution I see is having a parser provide its state in a form of a list of "possible" trees, to solve the possible ambiguity problem of parsing incomplete sources.

from superpower.

skyne98 avatar skyne98 commented on July 24, 2024

Also, you can try to use the type data of the previous successful compilations as the source of truth. It will allow you to query data about the failed token, based on that info and provide a meaningful set of completions. Hmm, it won't even require any kind of magic. Interesting!

from superpower.

nblumhardt avatar nblumhardt commented on July 24, 2024

Thanks for sharing your thoughts. I might close this one as I don't think there's a direction to follow here, yet, but keep us in the loop with your investigations! :-)

from superpower.

Related Issues (20)

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.