本文整理汇总了Python中sublime.DRAW_NO_OUTLINE属性的典型用法代码示例。如果您正苦于以下问题:Python sublime.DRAW_NO_OUTLINE属性的具体用法?Python sublime.DRAW_NO_OUTLINE怎么用?Python sublime.DRAW_NO_OUTLINE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类sublime
的用法示例。
在下文中一共展示了sublime.DRAW_NO_OUTLINE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: visible
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_NO_OUTLINE [as 别名]
def visible():
fill = settings.get('fill_conflict_area')
outline = settings.get('outline_conflict_area')
flags = 0
if _st_version < 3000:
# If fill is set then outline is ignored; ST2 doesn't provide a combination
if not (fill or outline):
flags = sublime.HIDDEN
elif not fill and outline:
flags = sublime.DRAW_OUTLINED
else:
if not fill:
flags |= sublime.DRAW_NO_FILL
if not outline:
flags |= sublime.DRAW_NO_OUTLINE
return flags
示例2: _update_line_colors
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_NO_OUTLINE [as 别名]
def _update_line_colors(self, line_no, line_color_map):
# Note this function has been optimized quite a bit. Calls to the ST3
# API has been left out on purpose as they are slower than the
# alternative.
view_region_cache = self._sub_buffer.view_region_cache()
view_content_cache = self._sub_buffer.view_content_cache()
for idx, field in line_color_map.items():
length = field["field_length"]
color_scope = "terminalview.%s_%s" % (field["color"][0], field["color"][1])
# Get text point where color should start
line_start, _ = view_content_cache.get_line_start_and_end_points(line_no)
color_start = line_start + idx
# Make region that should be colored
buffer_region = sublime.Region(color_start, color_start + length)
region_key = "%i,%s" % (line_no, idx)
# Add the region
flags = sublime.DRAW_NO_OUTLINE | sublime.PERSISTENT
self.view.add_regions(region_key, [buffer_region], color_scope, flags=flags)
view_region_cache.add(line_no, region_key)
示例3: highlight_problems
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_NO_OUTLINE [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)
示例4: set_bookmarks
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_NO_OUTLINE [as 别名]
def set_bookmarks(set_dot = False, erase_regions = True):
global bookmarks
view = sublime.active_window().active_view()
if util.is_project_view(view) and util.is_javascript_project() :
project_settings = util.get_project_settings()
bookmarks = util.open_json(os.path.join(project_settings["settings_dir_name"], 'bookmarks.json')) or dict()
else :
sublime.error_message("Can't recognize JavaScript Project.")
return
if erase_regions:
view.erase_regions("javascript_enhancements_region_bookmarks")
if set_dot :
lines = []
lines = [view.line(view.text_point(bookmark_line, 0)) for bookmark_line in search_bookmarks_by_view(view, is_from_set = True)]
view.add_regions("javascript_enhancements_region_bookmarks", lines, "code", "bookmark", sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE)
示例5: update_bookmarks
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_NO_OUTLINE [as 别名]
def update_bookmarks(set_dot = False, erase_regions = True):
global bookmarks
path = ""
view = sublime.active_window().active_view()
if util.is_project_view(view) and util.is_javascript_project() :
project_settings = util.get_project_settings()
path = os.path.join(project_settings["settings_dir_name"], 'bookmarks.json')
else :
sublime.error_message("Can't recognize JavaScript Project.")
return
with open(path, 'w+', encoding="utf-8") as bookmarks_json:
bookmarks_json.write(json.dumps(bookmarks))
if erase_regions:
view.erase_regions("javascript_enhancements_region_bookmarks")
if set_dot :
lines = []
lines = [view.line(view.text_point(bookmark_line, 0)) for bookmark_line in search_bookmarks_by_view(view)]
view.add_regions("javascript_enhancements_region_bookmarks", lines, "code", "bookmark", sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE)
示例6: add_input
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_NO_OUTLINE [as 别名]
def add_input(self, value=" ", label=None, key="input", scope="javascriptenhancements.input", icon="", flags=sublime.DRAW_EMPTY | sublime.DRAW_NO_OUTLINE, region_id="", padding=1, display_block=False, insert_point=None, replace_points=[]):
if not region_id:
raise Exception("Error: ID isn't setted.")
if region_id in self.region_input_ids:
raise Exception("Error: ID "+region_id+" already used.")
if value == None:
value = " "
if label:
self.add(label)
self.region_input_ids.append(region_id)
self.add(value, key=key, scope=scope, icon=icon, flags=flags, region_id=region_id, padding=padding, display_block=display_block, insert_point=insert_point, replace_points=replace_points)
示例7: hidden
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_NO_OUTLINE [as 别名]
def hidden():
flags = 0
if _st_version < 3000:
flags = sublime.HIDDEN
else:
flags = (sublime.DRAW_NO_FILL |
sublime.DRAW_NO_OUTLINE)
return (flags | sublime.HIDE_ON_MINIMAP)
示例8: on_idle
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_NO_OUTLINE [as 别名]
def on_idle(self, view):
"""
"""
structure_info = self._get_structure_info(view)
linting = self.get_settings(view, "linting", True)
# linting
if linting and "key.diagnostics" in structure_info:
diagnostics = structure_info["key.diagnostics"]
self.errors = {}
for entry in diagnostics:
description = entry["key.description"]
#level = entry['key.severity']
row, col = entry["key.line"], entry["key.column"]
pos = view.text_point(row-1,col-1)
self.errors[pos] = description
view.add_regions(
"swiftkitten.diagnostics",
[Region(pos,pos+1) for pos in self.errors.keys()],
"constant",
"",
sublime.DRAW_STIPPLED_UNDERLINE | sublime.DRAW_NO_OUTLINE | sublime.DRAW_NO_FILL
)
self._update_linting_status(view)
示例9: run
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_NO_OUTLINE [as 别名]
def run(self, edit) :
global region_selected
view = self.view
lines = view.lines(region_selected)
view.add_regions("region-dot", [lines[0], lines[-1:][0]], "code", "dot", sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE)
#view.add_regions("region-body", [region_selected], "code", "", sublime.DRAW_NO_FILL)
示例10: on_hover
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_NO_OUTLINE [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)
示例11: append
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_NO_OUTLINE [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)
示例12: mark
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_NO_OUTLINE [as 别名]
def mark(self, view: sublime.View):
"Marks tracker in given view"
scope = emmet.get_settings('marker_scope', 'region.accent')
mark_opt = sublime.DRAW_SOLID_UNDERLINE | sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE
view.erase_regions(ABBR_REGION_ID)
view.add_regions(ABBR_REGION_ID, [self.region], scope, '', mark_opt)
if self.forced:
phantoms = [sublime.Phantom(self.region, forced_indicator('⋮>'), sublime.LAYOUT_INLINE)]
if not self.forced_indicator:
self.forced_indicator = sublime.PhantomSet(view, ABBR_REGION_ID)
self.forced_indicator.update(phantoms)
示例13: mark
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_NO_OUTLINE [as 别名]
def mark(editor: sublime.View, tracker: AbbreviationTracker):
"Marks tracker in given view"
scope = get_settings('marker_scope', 'region.accent')
mark_opt = sublime.DRAW_SOLID_UNDERLINE | sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE
editor.erase_regions(ABBR_REGION_ID)
editor.add_regions(ABBR_REGION_ID, [tracker.region], scope, '', mark_opt)
if isinstance(tracker, AbbreviationTrackerValid) and tracker.forced:
phantoms = [
sublime.Phantom(tracker.region, forced_indicator('⋮>'), sublime.LAYOUT_INLINE)
]
key = editor.id()
if key not in _forced_indicator:
_forced_indicator[key] = sublime.PhantomSet(editor, ABBR_REGION_ID)
_forced_indicator[key].update(phantoms)
示例14: run
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_NO_OUTLINE [as 别名]
def run(self, edit):
connection = ChromeREPLConnection.get_instance(self.view)
# store selection for later restoration
prev = []
for sel in self.view.sel():
prev.append(sel)
success = True
# evaluate selections in Chrome
for sel in self.view.sel():
if sel.a == sel.b: # the 'selection' is a single point
sel = self.view.line(sel)
self.view.sel().add(sel)
try:
expression = self.view.substr(sel)
connection.execute(expression)
except Exception as e:
success = False
if success:
# highlight
self.view.add_regions(self.HIGHLIGHT_KEY,
self.view.sel(),
self.HIGHLIGHT_SCOPE,
flags=sublime.DRAW_NO_OUTLINE)
# clear selection so highlighting will be visible
self.view.sel().clear()
# do highlighting
sublime.set_timeout(lambda: self.view.sel().add_all(prev), 10)
# remove highlight and restore original selection
sublime.set_timeout(lambda: self.view.erase_regions(self.HIGHLIGHT_KEY), 50)
示例15: _handle_response
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_NO_OUTLINE [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)