Python sublime.HOVER_TEXT Examples
The following are 11
code examples of sublime.HOVER_TEXT().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
sublime
, or try the search function
.
Example #1
Source File: listener.py From network_tech with Apache License 2.0 | 5 votes |
def on_hover(self, point, hover_zone): settings = sublime.load_settings('Network Tech.sublime-settings') network_info_on_hover = settings.get('network_info_on_hover', True) if not network_info_on_hover: return if not self.view.scope_name(point).startswith(SCOPE_PREFIX): return if hover_zone == sublime.HOVER_TEXT: if self.view.is_popup_visible(): self.view.hide_popup() self.network_info(point=point, location=point) else: self.view.hide_popup()
Example #2
Source File: view_hover.py From sublime_debugger with MIT License | 5 votes |
def on_hover(self, event: Tuple[sublime.View, int, int]): (view, point, hover_zone) = event if hover_zone != sublime.HOVER_TEXT or not self.project.is_source_file(view): return session = self.sessions.active r = session.adapter_configuration.on_hover_provider(view, point) if not r: return word_string, region = r try: response = await session.adapter.Evaluate(word_string, session.selected_frame, 'hover') await core.sleep(0.25) variable = dap.Variable("", response.result, response.variablesReference) view.add_regions('selected_hover', [region], scope="comment", flags=sublime.DRAW_NO_OUTLINE) def on_close() -> None: view.erase_regions('selected_hover') component = VariableComponent(Variable(session, variable)) component.toggle_expand() ui.Popup(component, view, region.a, on_close=on_close) # errors trying to evaluate a hover expression should be ignored except dap.Error as e: core.log_error("adapter failed hover evaluation", e)
Example #3
Source File: popup.py From R-Box with MIT License | 5 votes |
def on_hover_async(self, view, point, hover_zone): if not self.should_show_popup(view): return if hover_zone != sublime.HOVER_TEXT: return view.run_command("r_box_show_popup", {"pkg": None, "funct": None, "point": point})
Example #4
Source File: VulHint.py From VulHint with MIT License | 5 votes |
def on_hover(self, view, point, hover_zone): if not sublime.load_settings("plugin.sublime-settings").get("enable", 1): return global g_regions global g_region_lines global g_jump_index global g_line_regions if not self.lang or not self.data: return #self.init(view) # locate smiles in the string. smiles string should be at the beginning and followed by tab (cxsmiles) # hovered_line_text = view.substr(view.word(point)).strip() #hovered_line_text = view.substr(view.line(point)).strip() if (hover_zone == sublime.HOVER_TEXT): word = view.substr(view.word(point)).strip() for key in g_regions: val = self.data[key] if word in val["keyword"]: hovered_text = '<p>%s</p>'%(val["discription"]) view.show_popup(hovered_text, flags=sublime.HIDE_ON_MOUSE_MOVE_AWAY, location=point) g_jump_index = g_region_lines.index(view.rowcol(point)[0]) return line = view.rowcol(point)[0] if g_line_regions.get(line): hovered_text = '' for key in g_line_regions.get(line): val = self.data[key] hovered_text += '<p>%s</p><br>'%(val["discription"]) view.show_popup(hovered_text, flags=sublime.HIDE_ON_MOUSE_MOVE_AWAY, location=point) g_jump_index = g_region_lines.index(view.rowcol(point)[0]) return
Example #5
Source File: hover.py From LSP with MIT License | 5 votes |
def on_hover(self, point: int, hover_zone: int) -> None: if hover_zone != sublime.HOVER_TEXT or self.view.is_popup_visible(): return self.view.run_command("lsp_hover", {"point": point})
Example #6
Source File: EasyClangComplete.py From EasyClangComplete with MIT License | 5 votes |
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 hover_zone != sublime.HOVER_TEXT: return EasyClangComplete.begin_show_info_job(view, point)
Example #7
Source File: mouse.py From Terminus with MIT License | 5 votes |
def on_hover(self, view, point, hover_zone): terminal = Terminal.from_id(view.id()) if not terminal: return if hover_zone != sublime.HOVER_TEXT: return url = find_url(view, pt=point) if not url: return def on_navigate(action): if action == "open": webbrowser.open_new_tab(url) def on_hide(): if link_key: view.erase_regions(link_key) url_region = find_url_region(view, pt=point) link_key = None if url_region: link_key = highlight_key(view) view.add_regions( link_key, [sublime.Region(*url_region)], "meta", flags=sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE | sublime.DRAW_SOLID_UNDERLINE) view.show_popup( URL_POPUP, sublime.HIDE_ON_MOUSE_MOVE_AWAY, location=point, on_navigate=on_navigate, on_hide=on_hide)
Example #8
Source File: hint_parameters.py From JavaScriptEnhancements with MIT License | 5 votes |
def run(self, edit, **args): view = self.view point = view.sel()[0].begin() meta_group = 0 mate_group_scope = "" for mt in self.meta_groups: meta_group = view.scope_name(point).strip().split(" ").count(mt) if meta_group > 0: mate_group_scope = mt break if meta_group == 0: return while point >= 0: scope = view.scope_name(point).strip() scope_splitted = scope.split(" ") if len(scope_splitted) < 2: return if scope_splitted[-2] in self.meta_fun_calls and scope_splitted.count(mate_group_scope) == meta_group - 1: sublime.set_timeout_async(lambda: on_hover_description_async(view, point, sublime.HOVER_TEXT, point if 'popup_position_on_point' in args and args.get('popup_position_on_point') else view.sel()[0].begin(), show_hint=True)) return point = view.word(point).begin() - 1 if view.substr(point) != "(" else point - 1
Example #9
Source File: hover_description.py From JavaScriptEnhancements with MIT License | 5 votes |
def on_hover(self, view, point, hover_zone) : if not view.match_selector( point, 'source.js - string - constant - comment' ) or not view.settings().get("show_definitions"): return if hover_zone != sublime.HOVER_TEXT : return for region in view.get_regions("javascript_enhancements_flow_error") + view.get_regions("javascript_enhancements_flow_warning"): if region.contains(point): return try: # fix for #47 - "Interoperability with sublimelinter" import SublimeLinter regions_key = SublimeLinter.highlight_view.get_regions_keys(view) for key in regions_key: region = view.get_regions(key)[0] if region.contains(point): return except Exception as e: pass region = view.word(point) word = view.substr(region) if not word.strip() : return view.hide_popup() sublime.set_timeout_async(lambda: on_hover_description_async(view, point, hover_zone, point)) # used also by ShowHintParametersCommand
Example #10
Source File: cfml_plugin.py From sublimetext-cfml with MIT License | 5 votes |
def on_hover(self, view, point, hover_zone): if hover_zone != sublime.HOVER_TEXT: return if not view.match_selector(point, "embedding.cfml"): return view.run_command( "cfml_inline_documentation", {"pt": point, "doc_type": "hover_doc"} )
Example #11
Source File: _generated_2018_02_11_at_20_21_24.py From JavaScript-Completions with MIT License | 4 votes |
def on_hover(self, view, point, hover_zone) : if not Util.selection_in_js_scope(view, point) or not javascriptCompletions.get("enable_on_hover_description") or hover_zone != sublime.HOVER_TEXT : return str_region = view.word(point) result = Util.get_current_region_scope(view, str_region) if not result: return str_selected = result.get("region_string_stripped") completion_list = list() for API_Keyword in javascriptCompletions.api : if (javascriptCompletions.API_Setup and javascriptCompletions.API_Setup.get(API_Keyword)) : if(API_Keyword.startswith("description-")): index_completion = 0 completions = javascriptCompletions.api[API_Keyword].get('completions') for completion in completions: completion_name = completion[0][12:].split("\t") completion_name = strip_tags(completion_name[0].strip()) index_parenthesis = completion_name.find("(") completion_name_to_compare = "" if index_parenthesis >= 0 : completion_name_to_compare = completion_name[0: index_parenthesis] else : completion_name_to_compare = completion_name if(completion_name_to_compare == str_selected): href = API_Keyword+","+str(index_completion)+","+str(point) completion.insert(2, href) completion_list.append(completion) index_completion = index_completion + 1 if len(completion_list) == 0: return i = 0 completion_list_to_show = list() while i < len(completion_list) : if len(completion_list_to_show) >= 1 : j = 0 completion_already_exists = False while j < len(completion_list_to_show) : if completion_list_to_show[j][1].get("type") == completion_list[i][1].get("type") and completion_list_to_show[j][1].get("description") == completion_list[i][1].get("description") and completion_list_to_show[j][1].get("return_type") == completion_list[i][1].get("return_type") : if (completion_list_to_show[j][1].get("type") == "operation" or completion_list_to_show[j][1].get("type") == "constructor") : if completion_list_to_show[j][1].get("parameters") == completion_list[i][1].get("parameters") : completion_already_exists = True break j = j + 1 if not completion_already_exists : completion_list_to_show.append(completion_list[i]) else : completion_list_to_show.append(completion_list[i]) i = i + 1 self.hint_popup(point, completion_list_to_show)