-
Notifications
You must be signed in to change notification settings - Fork 333
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
Add quick fixes for E2 warnings and errors #2871
Conversation
Could add an "implement all quick fixes" button to the validation bar right click menu, if people want it right now. Otherwise could be done in another PR. |
If you could have a quick-fix for Table[1, number] = "Test"
# Error (1/1): Cannot assign type s to object expecting n
# Fixed to ->
Table[1, string] = "Test" ? Maybe too complicated |
This seems doable, just change trace to the type (assuming it's not already) then replace with expected type
Now this i'm not so sure. Think this can be a false positive, would need to look into it |
I actually noticed after that you can just do untyped |
Marked draft as I will add support for multiple changes for more complex fixes |
* Support multiple replacements * Quick fix support for Error, although none currently implemented. * Add (Quick fix available) at the end of a problem instead of changing icon. It's more clear and works for errors too.
* Preprocessor rewritten to use traces instead of mostly columns * Quick fixes to convert `normal` -> `number` for preprocessor * Quick fixes to convert non CamelCase variables to camelCase in preprocessor * Parser supports quick fixes now * Add warning for use of `normal` type in parser (this should really be handled in analyzer, though..) * Add quick fix for normal use in parser * Tokenizer supports quick fixes now * Added invalid escape quick fix (deletes the \)
Added significantly more quick fixes and support for the preprocessor, tokenizer and parser Also added warning for using |
Quick fixes allow you to address problems menu issues easily. You can tell if a warning has a quick fix if that green arrow is on the icon, and apply it by right clicking the problem and pressing "Quick fix".
Current api only supports replacing the string at the trace with another one. Maybe in the future more complex quick fixes could exist (adding something to the top of the file, moving an entire block, etc), but that's out of the scope of this pr.
And errors are not implemented mostly cause I can't really think of any that would have quick fixes. (Maybe just the
=
inside equation one to replace it with==
?)changed()
on an input warning that was missing from the compiler rewrite.