peggyjs / code-peggy-language Goto Github PK
View Code? Open in Web Editor NEWVSCode syntax highlighting and error reporting for Peggy
License: MIT License
VSCode syntax highlighting and error reporting for Peggy
License: MIT License
After #4, there are new features that should be shown off.
After #14, vsce package
fails with:
[tsl] ERROR
TS6059: File '[base]//src/main.ts' is not under 'rootDir' '[base]/server/src'. 'rootDir' is expected to contain all source files.
The file is in the program because:
Root file specified for compilation
ts-loader-default_bf8b548751077c90
This is why I had removed the tsconfig file in server/
, but I'm sure there's a way to solve this that is more correct.
see the tests for peggy-tag with release 2.3.0 loaded in vscode: https://github.com/peggyjs/peggy-tag/blob/da6744153604aa10418de49801bd03d82b9235f5/test/index-spec.js
Assigned to: @sanket143
I'm working with a large grammar file of about 4000 lines (see parser.pegjs). At that size this extension becomes utterly sluggish.
It takes a few seconds to parse and compile the whole file, but the extension attempts to do that at every keystroke. So like when I type 10 characters I'll need to wait like 30 seconds for the extension to finish parsing and compiling the file 10 times in a row. When I write even longer passages of code, it can take several minutes for the extension to catch up.
I don't know what's the best practice for dealing with such long-executing processes in VSCode extension, but I guess something like wrapping the validateTextDocument function call inside a debounce would alleviate a large part of the pain.
For example with this grammar:
start = multi_stmt
multi_stmt = (stmt ";")+
stmt = "HELLO"
The Peek Definition functionality works fine with the stmt
rule:
But when I try to peek at the multi_stmt
rule, it doesn't work. Further more, when I hover over the stmt
part of multi_stmt
, it peeks at the stmt
rule:
Similar problem happens when using the $
character inside rule name. In that case even syntax highlighting doesn't consider $
to be part of the name:
test1 = ""
test2 = test1
Neither clicking on test1
nor test2
will do any action
Hi,
I had some problems when debugging
Cmd-. an eslint error, select "Disable @peggyjs/no-unused-rules for the entire file", you get this added to the top of the file:
/** eslint-disable @peggyjs/no-unused-rules */
This doesn't work because of the extra asterisk at the beginning. What is desired is this:
/* eslint-disable @peggyjs/no-unused-rules */
See https://github.com/microsoft/vscode-eslint/blob/1fa8e21b20f83987d349ac500a571194695117a3/server/src/eslintServer.ts#L699 for where the insertion happens. getBlockComment
should return [ "/*", "*/" ]
as far as I can see, so I don't know why this is happening.
See the repo
When trying to look up definition of a proxy rule, none is found:
This likely happens because the rule gets optimized away:
I suppose one can simply refactor the proxy rule away, but I don't really want to do that. It's often helpful to have such proxy rules.
When one just turns off the "Peggy Language Server: Mark Info" config, the squiggly line won't appear under the rule, and it's even harder to diagnose why the lookup fails.
Like we have in GraphQL
https://marketplace.visualstudio.com/items?itemName=GraphQL.vscode-graphql
File extension icons can be specified by VS Code themes, but less-common extensions usually don't get this treatment. That means that in most (probably all) themes, .peggy
and .pegjs
files just use the default icon for unknown file types, which makes it hard to visually distinguish them at a glance:
If a theme doesn't specify a theme for a file extension, the associated VS Code extension can specify a default one. I suggest reusing the favicon from the peggyjs/pegjs site for this purpose, with a colorized version for dark themes.
PR to follow.
Recently peggy had an update to version 3 with some new features, for which the actual vscode plugin shows errors.
Can you do a dependency update for the plugin?
Steps to reproduce:
Expected: show all symbols directly after opening
After debugging a bit I found out it was introduced in #33 because validateTextDocument
always delays the AST parsing but in the meantime onDocumentSymbol
gets called which can't find the cached AST
Shut up vsce about it wanting bundling, use example from yo code
.
See repo
@tamuratak do you have any interest in collaborating? We're re-invigorating Peg.js as Peggy, and in my opinion it would be great if we had one VSCode plugin that was a superset of the options the Peg.js world had.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.