Esempio n. 1
0
 def _ask_file(self, files):
     names = []
     for file in files:
         names.append('<'.join(reversed(file.path.split('/'))))
     result = lisputils.ask_values('Rope Find File: ', names, exact=True)
     if result is not None:
         path = '/'.join(reversed(result.split('<')))
         file = self.project.get_file(path)
         return file
     lisputils.message('No file selected')
Esempio n. 2
0
 def jump_to_global(self):
     if not self._check_autoimport():
         return
     all_names = list(self.autoimport.get_all_names())
     name = lisputils.ask_values('Global name: ', all_names)
     result = dict(self.autoimport.get_name_locations(name))
     if len(result) == 1:
         resource = list(result.keys())[0]
     else:
         resource = self._ask_file(result.keys())
     if resource:
         self._goto_location(resource, result[resource])
Esempio n. 3
0
 def auto_import(self):
     if not self.interface._check_autoimport():
         return
     name = lisp.current_word()
     modules = self.autoimport.get_modules(name)
     if modules:
         if len(modules) == 1:
             module = modules[0]
         else:
             module = lisputils.ask_values(
                 'Which module to import: ', modules)
         self._insert_import(name, module)
     else:
         lisputils.message('Global name %s not found!' % name)
Esempio n. 4
0
 def code_assist(self, prefix):
     names = self._calculate_proposals()
     if prefix is not None:
         arg = lisp.prefix_numeric_value(prefix)
         if arg == 0:
             arg = len(names)
         common_start = self._calculate_prefix(names[:arg])
         lisp.insert(common_start[self.offset - self.starting_offset:])
         self._starting = common_start
         self._offset = self.starting_offset + len(common_start)
     prompt = 'Completion for %s: ' % self.expression
     result = lisputils.ask_values(prompt, names,
                                   starting=self.starting, exact=None)
     self._apply_assist(result)