Open djcas9 opened 9 years ago
Yah, I often use 2-3 languages a day (backend, frontend, etc.) and mistakes like you illustrate above are very common. Adding in missing semi-colons or extraneous symbols sounds doable as part of the formatting (probably with an option). It might make sense as an esformatter plugin that we bundle by default.
The difficulty on our end will be that we use Esprima which is not very resilient to syntax errors. In Go's case, both syntaxes are valid (with or without parens). There's a "tolerant" mode in Esprima that's in progress but I'm not sure how far along it is.
This is related to issue #2. As you can see by the 2nd comment, it takes some patching. But then again that issue is 1 year old.
I just wanted to open a ticket to get a conversation started on this concept.
Example, if i goofed and wrote:
could it fix that by wrapping the expression in
(
)
like gofmt does.If this is a direction people would interested in what would be the cleanest way to start adding this type of functionality.