当前位置: 首页>>代码示例>>Python>>正文


Python sublime.DRAW_SQUIGGLY_UNDERLINE属性代码示例

本文整理汇总了Python中sublime.DRAW_SQUIGGLY_UNDERLINE属性的典型用法代码示例。如果您正苦于以下问题:Python sublime.DRAW_SQUIGGLY_UNDERLINE属性的具体用法?Python sublime.DRAW_SQUIGGLY_UNDERLINE怎么用?Python sublime.DRAW_SQUIGGLY_UNDERLINE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在sublime的用法示例。


在下文中一共展示了sublime.DRAW_SQUIGGLY_UNDERLINE属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: highlight_problems

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_SQUIGGLY_UNDERLINE [as 别名]
def highlight_problems(self, view, problems):
        view.erase_regions('clang-code-errors')
        view_id = view.id()
        view_cache = {}
        regions = []
        for problem in problems:
            lineno = problem['location']['line_num']
            colno = problem['location']['column_num']
            line_regions = view_cache.setdefault(lineno - 1, {})
            message = ERROR_MESSAGE_TEMPLATE.format(**problem)
            print(PRINT_ERROR_MESSAGE_TEMPLATE.format(message, lineno, colno))
            region = view.word(view.text_point(lineno - 1, colno - 1))
            regions.append(region)
            line_regions[(region.a, region.b)] = message
        self.view_cache[view_id] = view_cache
        style = (sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE |
                 sublime.DRAW_SQUIGGLY_UNDERLINE)
        view.add_regions(
            'clang-code-errors', regions, 'invalid', ERROR_MARKER_IMG, style) 
开发者ID:LuckyGeck,项目名称:YcmdCompletion,代码行数:21,代码来源:Completion.py

示例2: append

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_SQUIGGLY_UNDERLINE [as 别名]
def append(self, data):
		view = self.buildResultPanel
		view.run_command("append", {"characters": data})

		codePoints = view.find_by_selector("constant.numeric.line-number.match.find-in-files")
		lines = []
		for codePoint in codePoints:
			lines.append(view.line(codePoint))

		view.add_regions("errors", lines, "keyword", "bookmark", 
			sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE | sublime.PERSISTENT | sublime.DRAW_SQUIGGLY_UNDERLINE) 
开发者ID:fuse-open,项目名称:Fuse.SublimePlugin,代码行数:13,代码来源:build_results.py

示例3: _handle_response

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_SQUIGGLY_UNDERLINE [as 别名]
def _handle_response(self, response: Optional[List]) -> None:
        if not response:
            return
        kind2regions = {}  # type: Dict[str, List[sublime.Region]]
        for kind in range(0, 4):
            kind2regions[_kind2name[kind]] = []
        for highlight in response:
            r = range_to_region(Range.from_lsp(highlight["range"]), self.view)
            kind = highlight.get("kind", DocumentHighlightKind.Unknown)
            if kind is not None:
                kind2regions[_kind2name[kind]].append(r)
        if settings.document_highlight_style == "fill":
            flags = 0
        elif settings.document_highlight_style == "box":
            flags = sublime.DRAW_NO_FILL
        else:
            flags = sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE
            if settings.document_highlight_style == "underline":
                flags |= sublime.DRAW_SOLID_UNDERLINE
            elif settings.document_highlight_style == "stippled":
                flags |= sublime.DRAW_STIPPLED_UNDERLINE
            elif settings.document_highlight_style == "squiggly":
                flags |= sublime.DRAW_SQUIGGLY_UNDERLINE

        self._clear_regions()
        for kind_str, regions in kind2regions.items():
            if regions:
                scope = settings.document_highlight_scopes.get(kind_str, None)
                if scope:
                    self.view.add_regions("lsp_highlight_{}".format(kind_str),
                                          regions, scope=scope, flags=flags) 
开发者ID:sublimelsp,项目名称:LSP,代码行数:33,代码来源:highlights.py

示例4: highlight_problems

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_SQUIGGLY_UNDERLINE [as 别名]
def highlight_problems(self, view, problems):
        view.erase_regions('clang-code-errors')
        view_id = view.id()
        view_cache = {}
        regions = []
        # erase output panel
        self.output_panel.set_read_only(False)
        self.output_panel.run_command('select_all')
        self.output_panel.run_command('right_delete')
        for problem in problems:
            lineno = problem['location']['line_num']
            colno = problem['location']['column_num']
            line_regions = view_cache.setdefault(lineno - 1, {})
            message = MsgTemplates.ERROR_MESSAGE_TEMPLATE.format(**problem)
            problem_output = MsgTemplates.PRINT_ERROR_MESSAGE_TEMPLATE.format(
                message, lineno, colno)
            self.output_panel.run_command(
                'insert', {'characters': problem_output}
            )

            region = view.word(view.text_point(lineno - 1, colno - 1))
            regions.append(region)
            line_regions[(region.a, region.b)] = message

        self.output_panel.set_read_only(True)
        self.output_panel.run_command(
            'move_to', {'to': 'bof', 'extend': False})
        if problems:
            self.window.run_command(
                'show_panel', {'panel': self.output_panel_name})
        # self.view_cache[view_id] = view_cache
        style = (sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE |
                 sublime.DRAW_SQUIGGLY_UNDERLINE)
        view.add_regions(
            key='clang-code-errors',
            regions=regions,
            scope='invalid',
            flags=style) 
开发者ID:glymehrvrd,项目名称:CppYCM,代码行数:40,代码来源:highlight_problems.py

示例5: __init__

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_SQUIGGLY_UNDERLINE [as 别名]
def __init__(self, settings):
        """Initialize error visualization.

        Args:
            mark_gutter (bool): add a mark to the gutter for error regions
        """
        gutter_style = settings.gutter_style
        mark_style = settings.linter_mark_style
        self.settings = settings

        self.err_regions = {}
        if gutter_style == SettingsStorage.GUTTER_COLOR_STYLE:
            self.gutter_mark_error = PATH_TO_ICON.format(
                icon="error.png")
            self.gutter_mark_warning = PATH_TO_ICON.format(
                icon="warning.png")
        elif gutter_style == SettingsStorage.GUTTER_MONO_STYLE:
            self.gutter_mark_error = PATH_TO_ICON.format(
                icon="error_mono.png")
            self.gutter_mark_warning = PATH_TO_ICON.format(
                icon="warning_mono.png")
        elif gutter_style == SettingsStorage.GUTTER_DOT_STYLE:
            self.gutter_mark_error = PATH_TO_ICON.format(
                icon="error_dot.png")
            self.gutter_mark_warning = PATH_TO_ICON.format(
                icon="warning_dot.png")
        else:
            log.error("Unknown option for gutter_style: %s", gutter_style)
            self.gutter_mark_error = ""
            self.gutter_mark_warning = ""

        if mark_style == SettingsStorage.MARK_STYLE_OUTLINE:
            self.draw_flags = sublime.DRAW_EMPTY | sublime.DRAW_NO_FILL
        elif mark_style == SettingsStorage.MARK_STYLE_FILL:
            self.draw_flags = 0
        elif mark_style == SettingsStorage.MARK_STYLE_SOLID_UNDERLINE:
            self.draw_flags = sublime.DRAW_NO_FILL | \
                sublime.DRAW_NO_OUTLINE | sublime.DRAW_SOLID_UNDERLINE
        elif mark_style == SettingsStorage.MARK_STYLE_STIPPLED_UNDERLINE:
            self.draw_flags = sublime.DRAW_NO_FILL | \
                sublime.DRAW_NO_OUTLINE | sublime.DRAW_STIPPLED_UNDERLINE
        elif mark_style == SettingsStorage.MARK_STYLE_SQUIGGLY_UNDERLINE:
            self.draw_flags = sublime.DRAW_NO_FILL | \
                sublime.DRAW_NO_OUTLINE | sublime.DRAW_SQUIGGLY_UNDERLINE
        else:
            self.draw_flags = sublime.HIDDEN 
开发者ID:niosus,项目名称:EasyClangComplete,代码行数:48,代码来源:popup_error_vis.py

示例6: _handle_codeerrors

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_SQUIGGLY_UNDERLINE [as 别名]
def _handle_codeerrors(self, data):
        print('handling Errors')
        if data is None:
            print('no data')
            return
        
        self.data = data
        self.underlines = []
        self.warninglines = []
        self.errlines = []
        oops_map = {}

        if "QuickFixes" in self.data and self.data["QuickFixes"] != None and len(self.data["QuickFixes"]) > 0:
            self.data["QuickFixes"].sort(key = lambda a:(a['Line'],a['Column']))
            self.outputpanel.write_line("File: "+self.data["QuickFixes"][0]["FileName"]+"\n")
            suppressHidden = bool(helpers.get_settings(self.view,'omnisharp_suppresshidden'))
            for i in self.data["QuickFixes"]:
                point = self.view.text_point(i["Line"]-1, i["Column"]-1)
                reg = self.view.word(point)
                region_that_would_be_looked_up = self.view.word(reg.begin())
                if region_that_would_be_looked_up.begin() != reg.begin() or region_that_would_be_looked_up.end() != reg.end():
                    reg = sublime.Region(point, point+1)
                # self.underlines.append(reg)

                if i["LogLevel"] == "Hidden" and suppressHidden:
                    continue
                if i["LogLevel"] == "Warning" :
                    self.warninglines.append(reg)
                if i["LogLevel"] == "Error" :
                    self.errlines.append(reg)
                key = "%s,%s" % (reg.a, reg.b)
                oops_map[key] = i["Text"].strip()
                self.outputpanel.write_line(i["LogLevel"] + " : " + i["Text"].strip() + " - (" + str(i["Line"]) + ", " + str(i["Column"]) + ")")
            showErrorPanel = bool(helpers.get_settings(self.view,'omnisharp_showerrorwindows'))
            showWarningPanel = bool(helpers.get_settings(self.view,'omnisharp_showwarningwindows'))
            haveError = len(self.errlines) > 0
            if haveError:
                # print('underlines')
                self.view.settings().set("oops", oops_map)
                self.view.add_regions("oops", self.errlines, "sublimelinter.mark.error", "circle",  sublime.DRAW_NO_FILL|sublime.DRAW_NO_OUTLINE|sublime.DRAW_SOLID_UNDERLINE )
                if showErrorPanel:
                    self.view.window().run_command("show_panel", {"panel": "output.variable_get"})
            if len(self.warninglines) > 0:
                # print('underlines')
                self.view.settings().set("oops", oops_map)
                self.view.add_regions("oops", self.warninglines, "sublimelinter.mark.warning", "dot", sublime.DRAW_NO_FILL + sublime.DRAW_NO_OUTLINE + sublime.DRAW_SQUIGGLY_UNDERLINE )
                if (not haveError or not showErrorPanel) and showWarningPanel:
                    self.view.window().run_command("show_panel", {"panel": "output.variable_get"})

        self.data = None

        # Make error panel be scrolled to top so that we can see the first error:
        self.outputpanel.view.set_viewport_position((0,0)) 
开发者ID:OmniSharp,项目名称:omnisharp-sublime,代码行数:55,代码来源:syntax.py

示例7: handle_process

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_SQUIGGLY_UNDERLINE [as 别名]
def handle_process(self, returncode, stdout, error):
        """Handle the output from the threaded process."""
        self.view.erase_regions("flow_type_uncovered")

        if type(error) is bytes:
            error = error.decode("utf-8")

        if returncode != 0:
            logger.logger.error("coverage %s" % error)
            return

        logger.logger.debug(stdout)

        if stdout:
            expressions = stdout["expressions"]
            covered = expressions["covered_count"]
            uncovered = expressions["uncovered_count"]
            uncovered_locs = expressions["uncovered_locs"]
            total = covered + uncovered
            percentage = (covered * 100.0) / total

            self.view.set_status(
                "flow_type",
                "Flow: {}% coverage with {}/{} uncovered lines".format(
                    round(percentage, 2), uncovered, covered
                ),
            )

            if len(uncovered_locs) > 0:
                # Uncovered regions
                regions = []
                for location in uncovered_locs:
                    row_start = int(location["start"]["line"]) - 1
                    col_start = int(location["start"]["column"]) - 1
                    row_end = int(location["end"]["line"]) - 1
                    col_end = int(location["end"]["column"])

                    start = self.view.text_point(row_start, col_start)
                    stop = self.view.text_point(row_end, col_end)

                    regions.append(sublime.Region(start, stop))

                self.view.add_regions(
                    "flow_type_uncovered",
                    regions,
                    "comment",
                    "bookmark",
                    sublime.DRAW_SQUIGGLY_UNDERLINE,
                )

        else:
            self.view.set_status("flow_type", "Flow: coverage is not possible") 
开发者ID:Pegase745,项目名称:sublime-flowtype,代码行数:54,代码来源:coverage.py


注:本文中的sublime.DRAW_SQUIGGLY_UNDERLINE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。