當前位置: 首頁>>代碼示例>>Python>>正文


Python sublime.HOVER_TEXT屬性代碼示例

本文整理匯總了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() 
開發者ID:heyglen,項目名稱:network_tech,代碼行數:17,代碼來源:listener.py

示例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) 
開發者ID:daveleroy,項目名稱:sublime_debugger,代碼行數:30,代碼來源:view_hover.py

示例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}) 
開發者ID:randy3k,項目名稱:R-Box,代碼行數:12,代碼來源:popup.py

示例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 
開發者ID:5alt,項目名稱:VulHint,代碼行數:38,代碼來源:VulHint.py

示例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}) 
開發者ID:sublimelsp,項目名稱:LSP,代碼行數:6,代碼來源:hover.py

示例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) 
開發者ID:niosus,項目名稱:EasyClangComplete,代碼行數:12,代碼來源:EasyClangComplete.py

示例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) 
開發者ID:randy3k,項目名稱:Terminus,代碼行數:36,代碼來源:mouse.py

示例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 
開發者ID:pichillilorenzo,項目名稱:JavaScriptEnhancements,代碼行數:30,代碼來源:hint_parameters.py

示例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 
開發者ID:pichillilorenzo,項目名稱:JavaScriptEnhancements,代碼行數:37,代碼來源:hover_description.py

示例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"}
        ) 
開發者ID:jcberquist,項目名稱:sublimetext-cfml,代碼行數:12,代碼來源:cfml_plugin.py

示例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) 
開發者ID:pichillilorenzo,項目名稱:JavaScript-Completions,代碼行數:61,代碼來源:_generated_2018_02_11_at_20_21_24.py


注:本文中的sublime.HOVER_TEXT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。