def on_hover(self, view, point, hover_zone):
"""Call this when mouse pointer hovers over text.
Triggers showing popup with additional information about element under
cursor.
"""
if not Tools.is_valid_view(view):
return
settings = EasyClangComplete.settings_manager.settings_for_view(view)
if not settings.show_type_info:
return
if hover_zone != sublime.HOVER_TEXT:
return
tooltip_request = tools.ActionRequest(view, point)
self.current_job_id = tooltip_request.get_identifier()
job = ThreadJob(
name=ThreadJob.INFO_TAG,
callback=self.info_finished,
function=EasyClangComplete.view_config_manager.trigger_info,
args=[view, tooltip_request, settings])
EasyClangComplete.thread_pool.new_job(job)
python类HOVER_TEXT的实例源码
def on_hover(self, view, point, hover_zone):
# Popup only on text
if hover_zone != sublime.HOVER_TEXT:
return
# Check file size to optionnaly disable the feature (finding the information can be quite long)
threshold = view.settings().get('vhdl.hover_max_size',-1)
if view.size() > threshold and threshold!=-1 :
return
# Only show a popup for vhdl, when not in a string of a comment
scope = view.scope_name(point)
if 'source.vhdl' not in scope:
return
if any(w in scope for w in ['comment', 'string', 'keyword']):
return
popup = VhdlTypePopup(view)
sublime.set_timeout_async(lambda r=view.word(point), p=point: popup.show(r,p))
def on_hover(self, view, point, hover_zone):
self.view = view
file = view.file_name()
if not _is_swift(file):
return
if hover_zone != sublime.HOVER_TEXT:
return
project_directory = _project_directory(view)
text = _view_text(view)
text = subl_source_kitten.popup(point, file, project_directory, text)
view.show_popup(text,
sublime.HIDE_ON_MOUSE_MOVE_AWAY,
point,
600,
600,
self.on_navigate,
self.on_hide)
def on_hover(self, view, point, hover_zone):
if "PHP" not in view.settings().get('syntax'):
return
self.settings = sublime.load_settings('CompletePHP.sublime-settings')
if self.settings.get('showInlineDocsOnHover') == False:
return
if hover_zone != sublime.HOVER_TEXT:
return
wordregion = view.word(point)
word = view.substr(wordregion).lower()
print(word)
self.show_doc_popup(view, point, word)
def handle_hover(view, point, hover_zone):
if util.is_apex_file(view):
if hover_zone != sublime.HOVER_TEXT or view.is_popup_visible():
return
util.debug('handling hover')
line_diagnostics = get_line_diagnostics(view, point)
if line_diagnostics:
show_diagnostics_hover(view, point, line_diagnostics)
def on_hover(self, point, hover_zone):
if hover_zone != sublime.HOVER_TEXT or self.view.is_popup_visible():
return
self.request_symbol_hover(point)
point_diagnostics = get_point_diagnostics(self.view, point)
if point_diagnostics:
self.show_hover(point, self.diagnostics_content(point_diagnostics))
def run(self, edit):
point = self.view.sel()[0].begin()
SublCompletions().on_hover(self.view, point, sublime.HOVER_TEXT)
def on_hover(self, view, point, hover_zone):
# run hover only if its text
if hover_zone == sublime.HOVER_TEXT:
a = ToolTipHelperCommand(view, point);
a.run('');