-
-
Notifications
You must be signed in to change notification settings - Fork 58
Code causes syntax tree to crash #160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yeah we could definitely improve the user experience here. I think honestly if it fails to parse it should just not try to format. Want to take a crack at improving this behavior? It would involve fixing it here: syntax_tree/lib/syntax_tree/language_server.rb Lines 58 to 59 in 695918e
|
It seemed like vscode-prettier handled this sort of stuff well. SyntaxTree crashes on any syntax error with no UI warning. Even simple things like this crash it instead of fixing. Is this the intended behavior?
|
No, the intended behavior is to not have it crash when there's a syntax error. Would you be able to attempt a PR? It would involve handling the parser error on that line I linked. |
I guess i'm missing this answer. Is the purpose of syntax tree to show the error too in vscode, or to try and fix it first? I would assume on syntax error it would try to format and fix? Sorry for all the questions. |
Syntax Tree can't recover from syntax errors because the underlying CRuby parser isn't error tolerant. It has no knowledge of how to fix those things. In VSCode I haven't made any effort to show the error as well. At the moment that's beyond the scope of this plugin. I'd be happy to support it if you want to put up a PR, but my efforts are elsewhere at the moment. |
Looking at this issue #129 and it seems to work correctly from the CLI
example code:
CLI:
However in vscode it crashes synax-tree and there is nothing indicating that something is wrong. Is this the correct behavior?
VSCODE:
The text was updated successfully, but these errors were encountered: