-
Notifications
You must be signed in to change notification settings - Fork 1
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
implement error/warning squiggles in stan editor #100
Conversation
I think it makes sense to do some munging on the error messages so they look nicer on the hover-over, e.g. removing the 'preview' stanc gives you. See: https://github.com/WardBrian/vscode-stan-extension/blob/main/src/linter.ts#L38 Additionally, with this implemented, do we still see value in the "pop-up" error window? |
Not sure about that. But can we keep it in there for the time being? Not ready to say goodbye :) |
Sure, no need to delete it in the same PR -- just speculating for the future! |
I was about to use that code, but saw that it's GPL. Do I have your permission? |
Ah, yes. The project I forked from is GPL, but I am the sole author of that file, and I happily grant permission. |
Okay, the messages are now reformatted and they look nice! Another comment about the syntax window... I think it's nice to not just rely on seeing a slight yellow squiggle... so even if we do remove that window, we'll want to be able to display something prominently that there are issues (and at that point, I'd like to click on that notification and get the details) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two style comments but otherwise I think this looks great!
} | ||
|
||
if ((lineNumber !== undefined) && (startColumn !== undefined) && (endColumn !== undefined)) { | ||
const isWarning = x.toLowerCase().startsWith('warning') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thoughts on having a loop over warnings and a loop over errors to avoid needing to back this information out again? I think if the above logic to find the start/end was its own function the two loops wouldn't need to share too much duplicate code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
const toSeverity = (s: 'error' | 'warning' | 'hint' | 'info'): monaco.MarkerSeverity => { | ||
switch (s) { | ||
case 'error': return monaco.MarkerSeverity.Error | ||
case 'warning': return monaco.MarkerSeverity.Warning | ||
case 'hint': return monaco.MarkerSeverity.Hint | ||
case 'info': return monaco.MarkerSeverity.Info | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind moving this helper function out of the hook?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Fixes #76