예제 #1
0
 def convertToCandidate(self, symbols, context):
     return list(map(lambda symbol: {
         't': symbol['name'],
         'i': getKind(self.vim, symbol['kind']),
         'l': symbol['start']['line'],
         'c': symbol['start']['offset'],
         'f': symbol['file']
     }, symbols))
예제 #2
0
 def convertToCandidate(self, symbols):
     candidates = []
     for symbol in symbols['childItems']:
         candidates.append({
             'text':  symbol['text'],
             'kindIcon': getKind(self.vim, symbol['kind']),
             'lnum':  symbol['spans'][0]['start']['line'],
             'col':  symbol['spans'][0]['start']['offset']
         })
         if 'childItems' in symbol and len(symbol['childItems']) > 0:
             for childSymbol in symbol['childItems']:
                 candidates.append({
                     'text': childSymbol['text'] + ' - ' + symbol['text'],
                     'kindIcon': getKind(self.vim, childSymbol['kind']),
                     'lnum': childSymbol['spans'][0]['start']['line'],
                     'col': childSymbol['spans'][0]['start']['offset']
                 })
     return candidates
예제 #3
0
 def convertToCandidate(self, symbols):
     cwd = os.getcwd()
     return list(map(lambda symbol: {
         'text':  symbol['name'],
         'kindIcon': getKind(self.vim, symbol['kind']),
         'lnum':  symbol['start']['line'],
         'col':  symbol['start']['offset'],
         'file': re.sub(cwd + '/', '', symbol['file'])
     }, symbols))
 def convertToCandidate(self, symbols):
     candidates = []
     for symbol in symbols['childItems']:
         candidates.append({
             'text':  symbol['text'],
             'kindIcon': getKind(self.vim, symbol['kind']),
             'lnum':  symbol['spans'][0]['start']['line'],
             'col':  symbol['spans'][0]['start']['offset']
         })
         if 'childItems' in symbol and len(symbol['childItems']) > 0:
             for childSymbol in symbol['childItems']:
                 candidates.append({
                     'text': childSymbol['text'] + ' - ' + symbol['text'],
                     'kindIcon': getKind(self.vim, childSymbol['kind']),
                     'lnum': childSymbol['spans'][0]['start']['line'],
                     'col': childSymbol['spans'][0]['start']['offset']
                 })
     return candidates
예제 #5
0
    def _convert_detailed_completion_data(self, entry, padding=80):
        name = entry["name"]
        display_parts = entry["displayParts"]
        signature = "".join([p["text"] for p in display_parts])

        # needed to strip new lines and indentation from the signature
        signature = re.sub("\s+", " ", signature)
        menu_text = re.sub(
            "^(var|let|const|class|\(method\)|\(property\)|enum|namespace|function|import|interface|type)\s+",
            "", signature)
        documentation = menu_text

        if "documentation" in entry and entry["documentation"]:
            documentation += "\n" + \
                "".join([d["text"] for d in entry["documentation"]])

        kind = getKind(self.vim, entry['kind'])[0].title()

        return ({
            "word": name,
            "kind": kind,
            "menu": menu_text,
            "info": documentation
        })