Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Anaconda.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,11 @@
*/
"anaconda_linter_phantoms_template": "default",

/*
This determines whether error messages are show when hovering over a line.
*/
"anaconda_linter_hover_message": false,

/*
If anaconda_linter_show_errors_on_save is set to true, anaconda
will show a list of errors when you save the file.
Expand Down
29 changes: 28 additions & 1 deletion listeners/linting.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
)
from ..anaconda_lib.linting.sublime import (
ANACONDA, erase_lint_marks, run_linter,
last_selected_lineno, update_statusbar
last_selected_lineno, update_statusbar,
get_lineno_msgs
)


Expand Down Expand Up @@ -152,3 +153,29 @@ def _erase_marks(self, view: sublime.View) -> None:
"""

erase_lint_marks(view)

def on_hover(self, view: sublime.View, point: int, hover_zone: int):
Comment thread
Kyu marked this conversation as resolved.
Outdated
# Planned to make my own listener class(sublime_plugin.ViewEventListener) for this function
Comment thread
Kyu marked this conversation as resolved.
Outdated
# but couldn't figure out how to register them
# Tell me if I need to move this, or if it can piggyback under this listener

# from anaconda_lib.tooltips:show_tooltips
st_ver = int(sublime.version())
if st_ver < 3070:
return

if hover_zone == sublime.HOVER_TEXT:
if get_settings(view, 'anaconda_linter_hover_message', False):
rowcol = view.rowcol(point)
line = rowcol[0] # tuple (lineno, col)
messages = get_lineno_msgs(view, line)

if messages:
# Not sure how to properly choose the height & width values, but this works fine on my laptop
# Also unsure as to how to format it so its pretty and colorful (Tooltip._generate ?)
max_width = len(messages) * 840
max_height = len(max(messages))
message = "\n".join(messages)
# Newline is not rendered , errors all on one line :( help
view.show_popup(message, location=point, max_width=max_width, max_height=max_height)
# amount of time of popup?