Skip to content
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

Normalize diagnostic messages #241

Merged
merged 1 commit into from
May 16, 2020
Merged

Conversation

msaraiva
Copy link
Collaborator

@msaraiva msaraiva commented May 13, 2020

This PR brings a few important improvements when handling errors/warnings.

1. Format error message

Currently, the message is shown without any treatment. Example:

image

The most import part of the whole message is unexpected token: }. However, it's hard to spot it because there's too much pollution. To make it worse, if the path of the file is long enough, the message might be clipped or even completely hidden.

After this PR, it will look like this:

image

2. Properly handle errors in phoenix templates (eex and leex)

Currently, if an error occurs in a phoenix template, the editor points to the view file instead of the template. Example:

The following syntax error is not shown in the template:

image

But in the view, pointing to a line where there's no code:

image

After this PR, the editor points to the right file/line:

image

Additionally, this PR adds .eex and .leex files to the list of watched files by the server so that any changes in those files trigger recompilation.

3. Find the line in the stacktrace if the diagnostic does not provide it

When using macros, is common the see errors reported without the line. Example:

image

After this PR, the editor points to the write file/line if the line is available in the stacktrace:

image

@axelson
Copy link
Member

axelson commented May 14, 2020

Thanks for this! It looks like a great change. I'm going to test it locally for a bit to see if I run into any issues.

Copy link
Member

@axelson axelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! It'll be a significant improvement to usability. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants