Python sublime 模块,HIDE_ON_MOUSE_MOVE_AWAY 实例源码

我们从Python开源项目中,提取了以下11个代码示例,用于说明如何使用sublime.HIDE_ON_MOUSE_MOVE_AWAY

项目:EasyClangComplete    作者:niosus    | 项目源码 | 文件源码
def info_finished(self, future):
        """Call this callback when additional information for tag is available.

        Creates popup containing information about text under the cursor

        """
        if not future.done():
            return
        if future.cancelled():
            return
        (tooltip_request, result) = future.result()
        if result == "":
            return
        if not tooltip_request:
            return
        if tooltip_request.get_identifier() != self.current_job_id:
            return
        view = tooltip_request.get_view()
        view.show_popup(result,
                        location=tooltip_request.get_trigger_position(),
                        flags=sublime.HIDE_ON_MOUSE_MOVE_AWAY,
                        max_width=1000,
                        on_navigate=self.on_open_declaration)
项目:SmartVHDL    作者:TheClams    | 项目源码 | 文件源码
def plugin_loaded():
    imp.reload(vhdl_util)
    imp.reload(sublime_util)
    # Ensure the preference settings are properly reloaded when changed
    global pref_settings
    pref_settings = sublime.load_settings('Preferences.sublime-settings')
    pref_settings.clear_on_change('reload')
    pref_settings.add_on_change('reload',plugin_loaded)
    # Ensure the VHDL settings are properly reloaded when changed
    global vhdl_settings
    vhdl_settings = sublime.load_settings('VHDL.sublime-settings')
    vhdl_settings.clear_on_change('reload')
    vhdl_settings.add_on_change('reload',plugin_loaded)
    global tooltip_flag
    if vhdl_settings.get('vhdl.tooltip_hide_on_move',True):
        tooltip_flag = sublime.HIDE_ON_MOUSE_MOVE_AWAY
    else:
        tooltip_flag = 0
    init_css()
项目:SourceKittenSubl    作者:Dan2552    | 项目源码 | 文件源码
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)
项目:CompletePHP    作者:desean1625    | 项目源码 | 文件源码
def show_doc_popup(self, view, point, word):
        if not word in functions:
            return
        max_width, max_height = 600, 300
        word = word.replace("_","-")
        filepath = re.sub("{{.*?}}",word,self.settings.get('pathToPHPDocs'))
        print(filepath)
        html_file = filepath
        html_str = sublime.load_resource(html_file)
        html_str = re.sub("<!DOCTYPE.*?>","",html_str)
        #strip Meta tag
        html_str = re.sub("<meta .*?>","",html_str)
        #remove entities that python has trouble with from what I saw 
        html_str = re.sub("&mdash;","-",html_str)
        html_str = re.sub("&quot;",'"',html_str)
        html_str = re.sub("&#039;","'",html_str)
        html_str = re.sub("&raquo;","»",html_str)
        #replace &$ with entity many functions had this
        html_str = re.sub("&\$","&amp;$",html_str)
        #remove all spans
        html_str = re.sub("<span.*?>(.*?)</span>",r"\1",html_str)
        html_str = re.sub("<head>","",html_str)
        html_str = re.sub("</head>","",html_str)
        view.show_popup(html_str,
                        sublime.HIDE_ON_MOUSE_MOVE_AWAY,
                        point,
                        max_width,
                        max_height,
                        lambda s: self.on_navigate(s, view, point),
                        )
        print("here")
项目:SubVale    作者:ValeLint    | 项目源码 | 文件源码
def on_hover(self, view, point, hover_zone):
        loc = Settings.get('vale_alert_location')
        for alert in Settings.on_hover:
            region = alert['region']
            if alert['view_id'] == view.id() and region.contains(point):
                if loc == 'hover_popup':
                    view.show_popup(
                        alert['HTML'], flags=sublime.HIDE_ON_MOUSE_MOVE_AWAY,
                        location=point, on_navigate=webbrowser.open,
                        max_width=Settings.get('vale_popup_width'))
                elif loc == 'hover_status_bar':
                    sublime.status_message(
                        'vale:{0}:{1}'.format(alert['level'], alert['msg']))
项目:purescript-ide-sublime    作者:b123400    | 项目源码 | 文件源码
def show_type_hint(self, view, point):
        project_path = find_project_dir(view)
        module_info = get_module_imports(project_path, view.file_name())
        module, word = module_word(view, point)
        if word == '':
            return
        if word[0] == '(' and word[-1] == ')':
            word = word[1:-1]

        # TODO: use module from module_word to improve accuracy
        type_info = get_type(
            project_path,
            module_info['moduleName'],
            word,
            [m['module'] for m in module_info['imports']]
        )
        if len(type_info) == 0:
            return

        first_result = type_info[0]

        def on_navigate(string):
            view.window().open_file(string, sublime.ENCODED_POSITION)

        #file_path:row:col
        link_url = first_result['definedAt']['name'] + ':' + \
            str(first_result['definedAt']['start'][0]) + ':' + \
            str(first_result['definedAt']['start'][1])

        view.show_popup('''
            <p>From: <a href="%s">%s</a> </p>
            <p>Type: %s </p>
        ''' % ( link_url,
                ",".join(first_result['exportedFrom']),
                first_result['type']),
        sublime.HIDE_ON_MOUSE_MOVE_AWAY,
        point,
        500,    # max width
        500,    # max height
        on_navigate)
项目:DXMate    作者:jtowers    | 项目源码 | 文件源码
def show_diagnostics_hover(view, point, diagnostics):
    #util.debug('got diagnostics: ', diagnostics)
    formatted = list("{}: {}".format(format_severity(diagnostic.severity), diagnostic.message) for diagnostic in diagnostics)
    #formatted.append("[{}]({})".format('Code Actions', 'code-actions'))
    mdpopups.show_popup(
        view,
        "\n".join(formatted),
        css=".mdpopups .lsp_hover { margin: 4px; }",
        md=True,
        flags=sublime.HIDE_ON_MOUSE_MOVE_AWAY,
        location=point,
        wrapper_class="lsp_hover",
        max_width=800,
        #on_navigate=lambda href: self.on_diagnostics_navigate(self, href, point, diagnostics)
        )
项目:LSP    作者:tomv564    | 项目源码 | 文件源码
def handle_response(self, response, point):
        if response is not None:
            self._signatures = response.get("signatures", [])
            self._active_signature = response.get("activeSignature", -1)

            if self._signatures:
                if not 0 <= self._active_signature < len(self._signatures):
                    debug("activeSignature {} not a valid index for signatures length {}".format(
                        self._active_signature, len(self._signatures)))
                    self._active_signature = 0
            else:
                if self._active_signature != -1:
                    debug("activeSignature should be -1 or null when no signatures are returned")
                    self._active_signature = -1

            if len(self._signatures) > 0:
                mdpopups.show_popup(self.view,
                                    self._build_popup_content(),
                                    css=popup_css,
                                    md=True,
                                    flags=sublime.HIDE_ON_MOUSE_MOVE_AWAY,
                                    location=point,
                                    wrapper_class=popup_class,
                                    max_width=800,
                                    on_hide=self._on_hide,
                                    on_navigate=lambda href: self._on_hover_navigate(href))
                self._visible = True
项目:LSP    作者:tomv564    | 项目源码 | 文件源码
def handle_codeaction_response(self, response):
        titles = []
        self.commands = response
        for command in self.commands:
            titles.append(
                command.get('title'))  # TODO parse command and arguments
        if len(self.commands) > 0:
            self.view.show_popup_menu(titles, self.handle_select)
        else:
            self.view.show_popup('No actions available', sublime.HIDE_ON_MOUSE_MOVE_AWAY)
项目:LSP    作者:tomv564    | 项目源码 | 文件源码
def show_hover(self, point, contents):
        mdpopups.show_popup(
            self.view,
            contents,
            css=popup_css,
            md=False,
            flags=sublime.HIDE_ON_MOUSE_MOVE_AWAY,
            location=point,
            wrapper_class=popup_class,
            max_width=800,
            on_navigate=lambda href: self.on_hover_navigate(href, point))
项目:purescript-ide-sublime    作者:b123400    | 项目源码 | 文件源码
def show_error(self, view, error, point):
        error_message_lines = error['message'].split('\n')
        error_message = "".join(['<p>%s</p>' % s.replace(' ', '&nbsp;') for s in error_message_lines])

        handle_nav = None
        def default_handle_nav(href):
            pass
        handle_nav = default_handle_nav

        error_link = error.get('errorLink', None)
        if error_link is not None:
            before_error_link = handle_nav
            error_message = error_message + '<p><a href="error_link">More Info</a></p>'
            def open_error_link(href):
                if href != 'error_link':
                    before_error_link()
                    return
                webbrowser.open_new_tab(error_link)
            handle_nav = open_error_link

        suggestion = error.get('suggestion', None)
        if suggestion is not None:
            before_auto_save = handle_nav
            error_message = '<p><a href="replace">Fix it!</a></p>' + error_message
            def auto_fix(href):
                if href != 'replace':
                    before_auto_save(href)
                    return

                start_point = view.text_point(
                    suggestion['replaceRange']['startLine']-1,
                    suggestion['replaceRange']['startColumn']-1
                )
                end_point = view.text_point(
                    suggestion['replaceRange']['endLine']-1,
                    suggestion['replaceRange']['endColumn']-1
                )

                # if the last char is \n, create one less \n
                replacement = suggestion['replacement']
                if len(replacement) > 0 and replacement[-1] == '\n':
                    replacement = replacement[:-1]

                view.run_command(
                    'replace_region',
                    {
                        'text': replacement,
                        'start': start_point,
                        'end': end_point
                    })

            handle_nav = auto_fix

        view.show_popup(error_message,
            sublime.HIDE_ON_MOUSE_MOVE_AWAY,
            point,
            600,
            600,
            handle_nav)