Comments (4)
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.
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.
I'm ok with just removing the compiler pass.
from code-peggy-language.
Awesome! Sent a PR.
from code-peggy-language.
Related Issues (18)
- Code functions do not work when identifier contains number HOT 1
- Difficulties using development setup
- vsce package fails HOT 3
- Open VSX HOT 8
- Is it possible to get syntax highlighting in template string? HOT 2
- Bad peggy-tag coloring HOT 2
- Inserting file-wide eslint-disable adds star
- Syntax highlighting for `[\]']` is broken
- "Goto/Peek Definition" doesn't work when rule name contains underscores
- Pull in ideas from vsc-syntax-pegjs
- Slow performance when working on a large grammar file HOT 2
- Update to Peggy v3.0 HOT 4
- Collaborate with vscode-pegjs HOT 1
- Custom icon for `.peggy` and `.pegjs` files
- Empty outline on newly opened files
- Use webpack
- Add new screenshots
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from code-peggy-language.