本文整理汇总了Python中sublime.CLASS_WORD_START属性的典型用法代码示例。如果您正苦于以下问题:Python sublime.CLASS_WORD_START属性的具体用法?Python sublime.CLASS_WORD_START怎么用?Python sublime.CLASS_WORD_START使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类sublime
的用法示例。
在下文中一共展示了sublime.CLASS_WORD_START属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_name_candidate
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import CLASS_WORD_START [as 别名]
def get_name_candidate(view, point):
point_region = view.sel()[0]
if point is not None:
point_region = sublime.Region(point, point)
name = view.substr(point_region).strip()
if not name:
cursor_region = view.expand_by_class(
point_region,
sublime.CLASS_WORD_START
| sublime.CLASS_LINE_START
| sublime.CLASS_PUNCTUATION_START
| sublime.CLASS_WORD_END
| sublime.CLASS_PUNCTUATION_END
| sublime.CLASS_LINE_END,
)
name = view.substr(cursor_region)
return name
示例2: right_word
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import CLASS_WORD_START [as 别名]
def right_word(cls, view, region, repeat=1):
return cls._expand_words(
view,
region,
classes=sublime.CLASS_WORD_START,
repeat=repeat,
forward=True,
)
示例3: word
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import CLASS_WORD_START [as 别名]
def word(cls, view, region):
return cls._expand_words(
view,
region,
classes=sublime.CLASS_WORD_START,
repeat=0,
forward=True,
)
示例4: on_hover_provider
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import CLASS_WORD_START [as 别名]
def on_hover_provider(self, view, point):
seperators = "./\\()\"'-:,.;<>~!@#%^&*|+=[]{}`~?."
word = view.expand_by_class(point, sublime.CLASS_WORD_START | sublime.CLASS_WORD_END, separators=seperators)
word_string = word and view.substr(word)
if not word_string:
return None
match = re.search("\\$[a-zA-Z0-9_]*", word_string)
if not match:
return None
word_string = match.group()
return (match.group(), word)
示例5: get_next_character
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import CLASS_WORD_START [as 别名]
def get_next_character(view, position):
if view.substr(position) in [" ", "\t", "\n"]:
position = view.find_by_class(
position, True, sublime.CLASS_WORD_START | sublime.CLASS_PUNCTUATION_START
)
return position
示例6: expand_selection
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import CLASS_WORD_START [as 别名]
def expand_selection(view, point_or_region, aliases={}):
region = view.expand_by_class(point_or_region,
sublime.CLASS_WORD_START |
sublime.CLASS_WORD_END, ' (){},[]%&')
selection = view.substr(region).strip()
if aliases:
parts = selection.split('.')
for alias, canonical in aliases.items():
if alias == parts[0]:
parts[0] = canonical
return '.'.join(parts)
return selection