本文整理汇总了Python中UltiSnips.UltiSnips_Manager._snips方法的典型用法代码示例。如果您正苦于以下问题:Python UltiSnips_Manager._snips方法的具体用法?Python UltiSnips_Manager._snips怎么用?Python UltiSnips_Manager._snips使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UltiSnips.UltiSnips_Manager
的用法示例。
在下文中一共展示了UltiSnips_Manager._snips方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse
# 需要导入模块: from UltiSnips import UltiSnips_Manager [as 别名]
# 或者: from UltiSnips.UltiSnips_Manager import _snips [as 别名]
def parse(self, base):
try:
snips = UltiSnips_Manager._snips(base, True)
except Exception:
return []
return [{
'word': snip.trigger,
'menu': ' '.join(['[snip]', snip.description]),
} for snip in snips]
示例2: _GetCandidates
# 需要导入模块: from UltiSnips import UltiSnips_Manager [as 别名]
# 或者: from UltiSnips.UltiSnips_Manager import _snips [as 别名]
def _GetCandidates():
try:
rawsnips = UltiSnips_Manager._snips( '', 1 )
# UltiSnips_Manager._snips() returns a class instance where:
# class.trigger - name of snippet trigger word ( e.g. defn or testcase )
# class.description - description of the snippet
return [ { 'word': str( snip.trigger ),
'menu': str( '<snip> ' + snip.description ) }
for snip in rawsnips ]
except:
return []
示例3: _AddUltiSnipsDataIfNeeded
# 需要导入模块: from UltiSnips import UltiSnips_Manager [as 别名]
# 或者: from UltiSnips.UltiSnips_Manager import _snips [as 别名]
def _AddUltiSnipsDataIfNeeded(extra_data):
if not USE_ULTISNIPS_DATA:
return
try:
rawsnips = UltiSnips_Manager._snips("", 1)
except:
return
# UltiSnips_Manager._snips() returns a class instance where:
# class.trigger - name of snippet trigger word ( e.g. defn or testcase )
# class.description - description of the snippet
extra_data["ultisnips_snippets"] = [{"trigger": x.trigger, "description": x.description} for x in rawsnips]
示例4: _AddUltiSnipsDataIfNeeded
# 需要导入模块: from UltiSnips import UltiSnips_Manager [as 别名]
# 或者: from UltiSnips.UltiSnips_Manager import _snips [as 别名]
def _AddUltiSnipsDataIfNeeded(extra_data):
if not USE_ULTISNIPS_DATA:
return
try:
# Since UltiSnips may run in a different python interpreter (python 3) than
# YCM, UltiSnips_Manager singleton is not necessary the same as the one
# used by YCM. In particular, it means that we cannot rely on UltiSnips to
# set the current filetypes to the singleton. We need to do it ourself.
UltiSnips_Manager.reset_buffer_filetypes()
UltiSnips_Manager.add_buffer_filetypes(vimsupport.GetVariableValue("&filetype"))
rawsnips = UltiSnips_Manager._snips("", True)
except:
return
# UltiSnips_Manager._snips() returns a class instance where:
# class.trigger - name of snippet trigger word ( e.g. defn or testcase )
# class.description - description of the snippet
extra_data["ultisnips_snippets"] = [{"trigger": x.trigger, "description": x.description} for x in rawsnips]
示例5: parse
# 需要导入模块: from UltiSnips import UltiSnips_Manager [as 别名]
# 或者: from UltiSnips.UltiSnips_Manager import _snips [as 别名]
def parse(self, base):
token = self.input_data.split()[-1]
try:
snips = UltiSnips_Manager._snips(token, True)
except Exception:
return []
candidates = [{
'word': snip.trigger,
'dup': 1,
'menu': ' '.join(['[snip]', snip.description]),
} for snip in snips]
index = token.rfind(base)
if index > 0 and candidates:
prefix = len(token[:index])
for c in candidates:
c['abbr'] = c['word']
c['word'] = c['word'][prefix:]
return candidates