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
Support inline error tooltip at cursor position #546
Conversation
if PHANTOM_SUPPORT: | ||
template = '<body><style>div.error {{ background-color: brown; padding: 5px; }}</style><div class="error">{0}</div></body>' |
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.
Does the coloring change at all with the themes? Seeing as you only set background here, and not foreground, could foreground ever default to something in some themes which is unreadable?
template = '<body><style>div.error {{ background-color: brown; padding: 5px; }}</style><div class="error">{0}</div></body>' | ||
display_text = template.format(error_text) | ||
self.view.add_phantom("typescript_error", self.view.sel()[0], display_text, sublime.LAYOUT_BLOCK) |
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.
Interesting I don't see add_phantom
on the view
class in the docs (https://www.sublimetext.com/docs/3/api_reference.html#sublime.View). Maybe an oversight. They didn't make changes to this API after introducing it right?
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.
Yeah it still exists in the latest version. I learnt it from the example at:
https://forum.sublimetext.com/t/dev-build-3118/21270
if PHANTOM_SUPPORT: |
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.
If show_errors_inline
is set to false
, do phantoms still appear? As this is an if/else
, that would mean no error info. Is there a downside to always updating the status bar anyway?
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.
Yes, show_errors_inline
only affects sublime's own error tips, it doesn't toggle all phantom tooltips. Though I agree we can always update the status bar anyway.
👍 |
It would be cool if you could place links in the tooltip that take you to the website rule. Atom does this. |
The added behavior is quite similar to what we had before. But when the sublime version supports Phantom APIs (> 3118), we show a phantom popup instead of put the error message at the status bar (only after you click). The popup will go away when either the error is fixed or when the cursor (the keyboard cursor not the mouse cursor) moved to somewhere else. While the "on_hover" tooltip will always show the quick info.
In summary, the workflow is: