Giter Club home page Giter Club logo

Comments (4)

nene avatar nene commented on July 28, 2024

I have a few ideas for solving this problem:

The simplest just-delete-it solution

Simply remove the removeProxyRules function from Peggy transform pass. As far as I understand, this transform exists purely for optimization purposes. As the VSCode extension doesn't generate code, there's no actual need to perform that optimization.

The downside is that this eliminates the "Proxy rule 'foo' replaced by the rule 'bar'" info messages. I personally don't find these messages valuable. The blue squiggly line seems to suggest that there's something wrong with having a rule that's optimized away by the compiler. On the contrary I often find such rules useful for documentation purposes.

The complex work-around-the-problem solution

Store all the proxy rule removal messages and use that info later when performing the "Goto/Peek definition" action to navigate to the.

This seems like a pretty bad approach as we would be keeping the source of the problem, and working around the issues caused by that.

An intermediate make-it-harmless solution

Finally, we could replace the removeProxyRules transform pass with one that only reports these info messages, but doesn't perform the actual transform. That way the info messages would still be there, but the transformations would not cause "Goto/Peek definition" to fail.

from code-peggy-language.

nene avatar nene commented on July 28, 2024

I tried out the simple solution, which is pretty much a single line of code:

 const PASSES: peggy.compiler.Stages = {
   check: peggy.compiler.passes.check,
-  transform: peggy.compiler.passes.transform,
+  transform: peggy.compiler.passes.transform.filter(fn => fn.name !== "removeProxyRules"),
   generate: [getWarnings],
 };

from code-peggy-language.

hildjj avatar hildjj commented on July 28, 2024

I'm ok with just removing the compiler pass.

from code-peggy-language.

nene avatar nene commented on July 28, 2024

Awesome! Sent a PR.

from code-peggy-language.

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.