本文整理汇总了Python中sublime.HOVER_TEXT属性的典型用法代码示例。如果您正苦于以下问题:Python sublime.HOVER_TEXT属性的具体用法?Python sublime.HOVER_TEXT怎么用?Python sublime.HOVER_TEXT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类sublime
的用法示例。
在下文中一共展示了sublime.HOVER_TEXT属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_hover
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import HOVER_TEXT [as 别名]
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()
示例2: on_hover
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import HOVER_TEXT [as 别名]
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)
示例3: on_hover_async
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import HOVER_TEXT [as 别名]
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})
示例4: on_hover
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import HOVER_TEXT [as 别名]
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
示例5: on_hover
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import HOVER_TEXT [as 别名]
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})
示例6: on_hover
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import HOVER_TEXT [as 别名]
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)
示例7: on_hover
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import HOVER_TEXT [as 别名]
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)
示例8: run
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import HOVER_TEXT [as 别名]
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
示例9: on_hover
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import HOVER_TEXT [as 别名]
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
示例10: on_hover
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import HOVER_TEXT [as 别名]
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"}
)
示例11: on_hover
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import HOVER_TEXT [as 别名]
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)