ANTLR v4 plugin for Intellij IDEA: have to restart IJ after changing lexer grammar - intellij-idea

I try to use an ANTLR plugin for IJ, but there is an annoying problem. I don't know, what I'm doing wrong, but after changing something in lexer grammar besides generating ANTLR recognizer (often, but not always) I have to restart IJ to see the correct parsing tree. Already tried to "Save all" or "Synchronize" before testing parser, but nothing helps. Has anyone encountered such a problem?
Thank you in advance.

As glytching suggested in their comment, this is the problem described in this GitHub issue: https://github.com/antlr/intellij-plugin-v4/issues/242
The solution seems to be to hit Save. Another user also mentions touching the file from the terminal.
This puzzled me, as I'm using PyCharm and the way it seems to be set up by default is to auto-save as you work so I basically never interact with Save explicitly in any way. However, in this case hitting Ctrl+S does seem to make a difference (compared with just letting it auto-save) and it solves the issue for me.
For clarity, my situation is:
I have a grammar broken up into several parts (mixture of lexer, parser and combined grammars) which are imported into the 'main' grammar.
I am working interactively with the ANTLR Preview window (OP mentioned generating a recognizer, but I think this issue is completely independent of running the Antlr generator).
If I make a change in one of the imported grammars and switch back to the main grammar to re-run my start rule there it doesn't always pick up the change from the imported grammar.
Hitting Ctrl+S after making the change in the imported grammar, before switching back to my main grammar, fixes the problem.

Related

How do I get Raku Grammar Preview unstuck from "Collecting results" without restart?

I'm playing with the Raku Grammar feature in the Comma IDE. It's pretty cool. I can code by limitless trial and error which is what I do best.
However, it's frequently getting stuck (maybe once every 5 to 10 minutes). It's probably a result of my bad code.
Regardless, is there a way to reset it without having to restart the IDE? I've tried changing my grammar. Sometimes that works but often it does not.
Thanks.
I found a slightly better way to try to keep the previewer from getting stuck:
create another grammar in the same file with just token TOP { .+ } in it.
If it gets stuck, switch to the othe grammar. This will divert Comma's attention away from the real grammar.
Mkae any changes to the code to try to fix the problem in the real grammar.
Switch back to real grammar. Often, it will start working again.
Also, the grammar checker can spawn several rakudo zombie processes. Be sure to kill those or they will eat up your CPU and memory very quickly.

How can I make a VS Code language extension insert an indent after a line ending in a colon, as in Python?

The VS Code documentation has a clear if short explanation of how to do custom indentation, but doing this has no effect — whatever I put in the "indentationRules", it fails to match the simplest patterns, and it doesn't even stop the built-in indentation from working, it goes right on using the default indentation described in the link above. All the other bits of the language extension are working, it's not a general problem, it's specific to trying to get these indentation rules to work. I've tried to find examples to copy from the internet but with no success. (I found an example of a grammar for Python but the only mention of indentation in it was as a possible kind of error, which is puzzling.)
Thanks for your help.

How to get rid of TS problem/error messages in the VS-Code editor?

The Issue at Hand:
While using VSCode I am being notified twice of problems that occur inside of my documents. I found that other people were have problems that sounded similar, but I couldn't find a Q&A with a solution that helped. The most obvious place to look is in the VSCode settings. I tried several different settings that I read had help others in similar situations, but to no avail. Below is the list of settings I attempted to configure in hopes of finding a solution.
{
"typescript.format.enable": false,
"typescript.validate.enable": false,
"js/ts.implicitProjectConfig.checkJs": false,
"js/ts.implicitProjectConfig.strictFunctionTypes": false,
"js/ts.implicitProjectConfig.experimentalDecorators": false,
"js/ts.implicitProjectConfig.strictNullChecks": false,
}
More Detailed Explanation
Every forum/Q&A I visited, I never found someone who I felt was try to solve exactly the same issue that I am experiencing, I feel this is in part because it doesn't cause any hindrance, only annoyance. Some people probably rely on the problem notifications that I am trying to get rid of.
The issue due to the fact that I use ESLint, and Prettier. I equip ESLint with a plugin that gives the linter the ability to communicate with Prettier, which in turn, allows both Prettier and ESLint to communicate harmoniously to me through VSCode. ESLint & Prettier notify of every problem in my code I need to be aware of, therefore; I don't need to be notified by some other mechanism. The unwanted notifications come with a TS code every time they pop-up, because of this & the fact its VSCode, I am guessing it is a TypeScript/JavaScript formatter that comes with VSCode out-of-the-box, though I am pretty confident that, that is what it is, at this point I don't truly know. It is odd I don't see other people asking about "unwanted TS codes in the VSCode editor".
Demonstration of the Issue:
Below is a screenshot of my VSCode problems panel that demonstrates what is happening. In the screenshot I am intentionally causing an error by typing the Keyword function into the editor, followed by nothing else. You can see that ESLint is working as it should, it notifies me that there is a problem with entering the keyword function without any other code following. You'll notice it says there are 2 problems, though their is clearly only one, and that some mechanism other than my linter, and formatter is notifying me of the same problem. This annoys the hell-O out of me, because I can't trust the badges when they pop-up with a problem count, and I have to look through two sets of error codes to figure out why the editor is complaining.
In Final: Making the Question Being Asked Concise:
What I am asking, or what i would like to know, is this:
"How can I turn off the problem notifications that display the TS codes as shown in the image above. How can I configure VSCode so that only the formatter &/or linter of my choice notifies me of problems, so that I am not being notified of a single problem multiple times, by multiple processes ???"
Set "typescript.validate.enable": false for TS files and "javascript.validate.enable": false for JS files
This disables errors from the built-in JS/TS extension

How are you supposed to use text editors without debugging tools?

The thing I haven't been able to understand is how I am supposed to use a plain ol' text editor like TextWrangler or Atom to code, as opposed to a full-blow IDE like Xcode or Visual Studio. There are no debugging tools, so you can't know if you made an error, and their isn't autocomplete (prebugging, heh heh) which makes it much easier to make mistakes. I feel like I am missing something; how do people debug with their text editor workflow?
Using a text editor without debug tools forces you to write beautiful code that works first time 100% of the time. Each line of code is carefully crafted and does exactly what you expect it to do.
I personally use VIM for all my programming, it takes a while to learn but it's definitely worth it.
You end up writing code which is easy to read, because you have to read and re-read you code before you run it.
Debugging is more than just pressing a button and someone else software tells you whats wrong with yours. It's about deeply understanding your code and exactly what it is doing. I'll admit that sometimes finding a missing comma can be a pain, but the tradeoff is definitely worth it.
At the end of the day it depends on whether you just want to turn out 800 line of code an hour, or if you want to build software which is robust and easily extendable by anybody.
Atom and almost all this ide VIM ...
their is a plugins https://atom.io/packages
You install what plugins that you want
I believe that this is the power of this editors. You decide what plugins you want.
For atom for example
linter https://atom.io/packages/linter is a tool for visualize errors.
autocomplete https://atom.io/packages/autocomplete is a tool for auto complete.
The only difference is you have to compile manually.
If the error happens at compile time, the compiler will tell you, otherwise you have to find & fix the error yourself.
For the auto-complete, it's still available in most text editors(Atom, notepad++ etc...), however it's not always as good as intellisense.

grunt lesslint how to prevent output from being written to console

We are trying to use grunt-lesslint in our project, as our UI developer is comfortable fix errors in less file. grunt-recess seems more powerful but not sure if it can point errors in less file itself. I am unable to comprehend enough from lesslint page, and there do not seem to be many examples. Does anyone know the following:
How to prevent lesslint from displaying on the console. I use formatters and the report file is generated, but it also prints on console, which I do not want to.
How to make lesslint fail only in the case of errors (not warnings). Also csslint seems to report errors also, while lesslint mostly gives warnings only, why is that so? Does lesslint throw errors as well? How to make it fail only in case of errors?
I tried using 'checkstyle-xml' formatter, but it does not seem to use it (I have used in jshint and it gives a properly formatted xml, which it does not give for lesslint).
Is it possible to compile less (many files or directories) in conjunction with lesslint? Any example?
Thanks,
Paddy
I'd say it's more of a common practice to display stdout for this kind of thing; the JSHint plugin does it, as does any other linting plugin that I've used. If you get in another developer that uses Grunt they'll probably expect stdout too. If you really want to override this, use grunt-verbosity: https://npmjs.org/package/grunt-verbosity
Again, this is a convention in Grunt; if a task has any warnings then it fails. The reason being if you lint a file and the linter flags something up it should be dealt with straight away, rather than delay it; six months time you have 500 errors that you haven't fixed and you're less likely to fix them then. Most linting plugins allow you to specify custom options (I've used CSS Lint and that is very customisable), so if you don't like a rule you can always disable it.
This should work. If there's a bug with this feature you should report it on the issue tracker, where it will be noticed by the developers of the plugin. https://github.com/kevinsawicki/grunt-lesslint/issues
Yes. You can set up a custom task that runs both your linter and compile in one step: something like grunt.registerTask('buildless', 'Lint and compile LESS files.', ['lesslint', 'less']); note that you'll have to install https://github.com/gruntjs/grunt-contrib-less to get that to work. Also note that, failing linting will not compile your LESS files; mandate that your code always passes the lint check; you'll help everyone involved in the project.