Anonymous avatar Anonymous committed 419bfa9

Added basic find file

Comments (0)

Files changed (3)

 New Features
 ============
 
+* Auto-completing python names (code-assist)
+
 
 Setting Up
 ==========
 C-x p k         rope-close-project
 C-x p u         rope-undo-refactoring
 C-x p r         rope-redo-refactoring
+C-x p f         rope-find-file
 
 C-c r r         rope-rename
 C-c r l         rope-extract-variable
 C-c r 1 v       rope-move-current-module
 C-c r 1 p       rope-module-to-package
 
+C-/             rope-code-assist
 C-c g           rope-goto-definition
 C-c C-d         rope-show-doc
 C-c i o         rope-organize-imports
 
 > Public Release 0.2
 
-* autocomplete
 * change pymacs to accept unicode strings
 * specifying refactoring options
-* find file dialog
+* new file/directory/module/package; C-x p n [fdmp]
+* new function/variable/class/module/package; C-c n [fvcmp]
+* find file dialog; C-x p f

ropemacs/__init__.py

             ('C-x p k', lisp.rope_close_project),
             ('C-x p u', lisp.rope_undo_refactoring),
             ('C-x p r', lisp.rope_redo_refactoring),
+            ('C-x p f', lisp.rope_find_file),
 
             ('C-c r r', lisp.rope_rename),
             ('C-c r l', lisp.rope_extract_variable),
         names = [proposal.name for proposal in proposals]
         starting = source[starting_offset:offset]
         prompt = 'Completion for %s: ' % starting
-        result = lisp.completing_read(prompt, names, None, None, starting)
+        result = _ask_values(prompt, names, starting=starting)
         lisp.delete_region(starting_offset + 1, offset + 1)
         lisp.insert(result)
 
+    @interactive()
+    def find_file(self):
+        self._check_project()
+        files = self.project.get_files()
+        source = lisp.buffer_string()
+        result = _ask_values('Rope Find File: ',
+                             [file.name for file in files], exact=True)
+        for file in files:
+            if result == file.name:
+                lisp.find_file(file.real_path)
+
     def _get_location(self):
         resource = self._get_resource()
         offset = self._get_offset()
             globals()[attrname] = attr
 
 
-class _LispAskConfig(object):
-
-    def __call__(self, conf):
-        if conf.values:
-            return lisp.completing_read(
-                conf.prompt, conf.values, None, True)
-        else:
-            return lisp.read_from_minibuffer(conf.prompt)
-
-
 def _ask(prompt, default=None):
     return lisp.read_from_minibuffer(prompt, default, None, None,
                                      None, default, None)
 
+def _ask_values(prompt, values, starting=None, exact=None):
+    return lisp.completing_read(prompt, values, None, exact, starting)
+
 interface = RopeInterface()
 _register_functions(interface)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.