How to fundamentally fix code formatting conflict? - formatting

This problem confuse me for years.
It's seems that Prettier, ESlint, Editor or IDE all can format my code.
When I format code, I have no idea which one enfoced what rule to my code.
Are there any articles elucided this problem?
Thanks!

Related

SQL: Sublime-->PHPMyAdmin formatting error?

this is probably a very rookie mistake (I`m totally new to SQL), but I hope you can help me. I have written some SQL code in Sublime Text. When trying to paste it into PHPMyadmin (web) I get some error messages. I think the code is right, so it seems like something happened to the formatting. Does anybody have any clues what I might have done wrong?

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

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.

Agda PDFs with colour

I am using lhs2TeX for my literate Agda files and I'd like them to be syntax highlighted. I know I can achieve some highlighting via %format instructions but that is a bit too much. I have tried using lhs2Tex-hl as instructed at http://foswiki.cs.uu.nl/foswiki/pub/FPOld/CourseLiterature/presentation.pdf but to no avail.
If anyone can help with getting PDF's with coloured Agda, that'd be appreciated!
Edit
The Agda latex backend is great but has some issues. Biggest issue is spec-environment. It says that spec is undefined, so making it a synonym for code should fix things: \newenvironment{spec}{\begin{code}}{\end{code}}, but instead now there are type-checking issues and missing $ errors. Using sed to remove spec blocks altogether results in missing $ errors; likewise \newenvironment{spec}{\verbatim}{\endverbatim}. Similar trouble with using |...|. Also, I honestly liked the %format of lhs2tex ...

Spelling assist in Idea-Intellij

While writing Java doc, if we are making any spelling mistakes Idea IntelliJ shows that there is a typo, but is there any way to do some settings so that it also shows possible correct words for that typo?
Thanks in advance.
Kitty

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.