本文整理匯總了Python中sublime.View.sel方法的典型用法代碼示例。如果您正苦於以下問題:Python View.sel方法的具體用法?Python View.sel怎麽用?Python View.sel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sublime.View
的用法示例。
在下文中一共展示了View.sel方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: on_modified
# 需要導入模塊: from sublime import View [as 別名]
# 或者: from sublime.View import sel [as 別名]
def on_modified(self, view: sublime.View) -> None:
"""Called after changes has been made to a view
"""
if view.command_history(0)[0] in ("expand_tabs", "unexpand_tabs"):
return
if not is_python(view) or not get_settings(view, 'display_signatures'):
return
try:
location = view.rowcol(view.sel()[0].begin())
if view.substr(view.sel()[0].begin()) in ['(', ')']:
location = (location[0], location[1] - 1)
data = prepare_send_data(location, 'doc', 'jedi')
use_tooltips = get_settings(
view, 'enable_signatures_tooltip', True
)
st_version = int(sublime.version())
if st_version >= 3070:
data['html'] = use_tooltips
currying = partial(self.prepare_data_status, view)
if use_tooltips and st_version >= 3070:
currying = partial(self.prepare_data_tooltip, view)
Worker().execute(currying, **data)
except Exception as error:
logging.error(error)
示例2: is_scope
# 需要導入模塊: from sublime import View [as 別名]
# 或者: from sublime.View import sel [as 別名]
def is_scope(view: sublime.View, scope: str) -> bool:
sel = view.sel()
try:
return view.match_selector(sel[0].begin(), scope)
except IndexError:
# If in doubt, let's return `False`.
return False
示例3: on_modified
# 需要導入模塊: from sublime import View [as 別名]
# 或者: from sublime.View import sel [as 別名]
def on_modified(self, view: sublime.View) -> None:
"""Called after changes has been made to a view.
"""
if not is_python(view, autocomplete_ignore_repl=True):
return
global JUST_COMPLETED
if (view.substr(view.sel()[0].begin() - 1) == '('
and view.substr(view.sel()[0].begin()) == ')'):
if JUST_COMPLETED:
view.run_command('anaconda_complete_funcargs')
JUST_COMPLETED = False
elif view.substr(sublime.Region(
view.sel()[0].begin() - 7, view.sel()[0].end())) == 'import ':
self._run_auto_complete()
示例4: get_document_position
# 需要導入模塊: from sublime import View [as 別名]
# 或者: from sublime.View import sel [as 別名]
def get_document_position(view: sublime.View, point) -> 'Optional[OrderedDict]':
file_name = view.file_name()
if file_name:
if not point:
point = view.sel()[0].begin()
d = OrderedDict() # type: OrderedDict[str, Any]
d['textDocument'] = {"uri": filename_to_uri(file_name)}
d['position'] = offset_to_point(view, point).to_lsp()
return d
else:
return None
示例5: __init__
# 需要導入模塊: from sublime import View [as 別名]
# 或者: from sublime.View import sel [as 別名]
def __init__(self, view: sublime.View, options: List) -> None:
self.options = options
self.view = view
self.selected = [] # type: List
self.restore_point = view.sel()[0]
示例6: on_phantom_navigate
# 需要導入模塊: from sublime import View [as 別名]
# 或者: from sublime.View import sel [as 別名]
def on_phantom_navigate(view: sublime.View, href: str, point: int):
# TODO: don't mess with the user's cursor.
sel = view.sel()
sel.clear()
sel.add(sublime.Region(point))
view.run_command("code_intel_code_actions")
示例7: get_position
# 需要導入模塊: from sublime import View [as 別名]
# 或者: from sublime.View import sel [as 別名]
def get_position(view: sublime.View, event=None) -> int:
if event:
return view.window_to_text((event["x"], event["y"]))
else:
return view.sel()[0].begin()
示例8: goto
# 需要導入模塊: from sublime import View [as 別名]
# 或者: from sublime.View import sel [as 別名]
def goto(view: sublime.View, point):
save_position_for_jump_history(view)
view.sel().clear()
view.sel().add(sublime.Region(point))
view.show(point)