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


Python UltiSnips_Manager._snips方法代码示例

本文整理汇总了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]
开发者ID:sagargp,项目名称:shdw,代码行数:12,代码来源:ultisnips.py

示例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 []
开发者ID:Chibin,项目名称:.vim,代码行数:14,代码来源:ultisnips_completer.py

示例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]
开发者ID:axelmartensson,项目名称:YouCompleteMe,代码行数:15,代码来源:youcompleteme.py

示例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]
开发者ID:lining0806,项目名称:YouCompleteMe,代码行数:21,代码来源:youcompleteme.py

示例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
开发者ID:jalemolina,项目名称:vim,代码行数:21,代码来源:ultisnips.py


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