Exemplo n.º 1
0
 def tssig(self):
     """
     Get the type info
     """
     if self._client.server_handle is not None:
         self.reload()
         file = self.vim.current.buffer.name
         line = self.vim.current.window.cursor[0]
         offset = self.vim.current.window.cursor[1] + 1
         info = self._client.getSignature(file, line, offset)
         if info:
             signatureHelpItems = list(
                 map(
                     lambda item: {
                         'variableArguments':
                         item['isVariadic'],
                         'prefix':
                         utils.convertToDisplayString(item[
                             'prefixDisplayParts']),
                         'suffix':
                         utils.convertToDisplayString(item[
                             'suffixDisplayParts']),
                         'separator':
                         utils.convertToDisplayString(item[
                             'separatorDisplayParts']),
                         'parameters':
                         list(
                             map(
                                 lambda p: {
                                     'text':
                                     utils.convertToDisplayString(p[
                                         'displayParts']),
                                     'documentation':
                                     utils.convertToDisplayString(p[
                                         'documentation']),
                                 }, item['parameters']))
                     }, info['items']))
             params = utils.getParams(signatureHelpItems[0]['parameters'],
                                      signatureHelpItems[0]['separator'])
             self.printHighlight(params)
     else:
         self.printError('Server is not running')
    def tssig(self):
        """
        Get type signature for symbol at cursor
        """
        self.reload()
        file = self.vim.current.buffer.name
        line = self.vim.current.window.cursor[0]
        offset = self.vim.current.window.cursor[1] + 1
        info = self._client.getSignature(file, line, offset)

        if info:
            signatureHelpItems = list(map(lambda item: {
                'variableArguments': item['isVariadic'],
                'prefix': utils.convertToDisplayString(item['prefixDisplayParts']),
                'suffix': utils.convertToDisplayString(item['suffixDisplayParts']),
                'separator': utils.convertToDisplayString(item['separatorDisplayParts']),
                'parameters': list(map(lambda p: {
                    'text': utils.convertToDisplayString(p['displayParts']),
                    'documentation': utils.convertToDisplayString(p['documentation']),
                }, item['parameters']))
            }, info['items']))
            params = utils.getParams(signatureHelpItems[0][
                                     'parameters'], signatureHelpItems[0]['separator'])
            self.printHighlight(params)