def _build_signature(self):
     """
     Transforms keyword name and its arguments into Robot Framework syntax.
     The syntax ${number:text} is a so called 'snippet notation' of Sublime Text.
     This feature allows to jump through arguments with TAB.
     The characters '{' and '}' should be 'escaped' with '{' and '}' accordingly.
     """
     if self.arguments:
         self.arguments = escape_robot_var(self.arguments)
         args = self.arguments.split(',')
         if len(args) == 1:
             return '  ${{1:{0}\n}}'.format(args[0])
         args = '\n'.join(['...  ${{{0}:{1}}}'.format(args.index(arg)+1, arg.strip(),) for arg in args])
         return '\n{0}\n'.format(args)
     return '\n'
 def _build_signature(self):
     """
     Transforms keyword name and its arguments into Robot Framework syntax.
     The syntax ${number:text} is a so called 'snippet notation' of Sublime Text.
     This feature allows to jump through arguments with TAB.
     The characters '{' and '}' should be 'escaped' with '{' and '}' accordingly.
     """
     if self.arguments:
         self.arguments = escape_robot_var(self.arguments)
         args = self.arguments.split(',')
         if len(args) == 1:
             return '{0}${{1:{1}\n}}'.format(settings.separator['between_kw_and_args'], args[0])
         formatted_args = ['{0}${{{1}:{2}}}'.format(settings.separator['between_args'],
                                                    args.index(arg)+1,
                                                    arg.strip(),) for arg in args]
         if settings.separator['kw_and_args_one_line']:
             return '{0}\n'.format(''.join(formatted_args))
         return '\n{0}\n'.format('\n'.join(formatted_args))
     return '\n'
Esempio n. 3
0
 def get_name_and_signature(self):
     #TODO(`name` should be a lazy property, and escape/replace should be done there)
     return '%s%s' % (escape_robot_var(self.name), self.signature)
 def get_name_and_signature(self):
     return '%s%s' % (escape_robot_var(self.name), self.signature)