Anonymous avatar Anonymous committed 0a77827

Showing change preview buffer

Comments (0)

Files changed (3)

 * adding a menu
 * including pymacs in ropemacs?
 * change pymacs to accept unicode strings
+* saving the old values of refacturing config
 > Public Release 0.2
 * new file/directory/module/package; C-x p n [fdmp]
 * showing proposal type in code-assist
 * previewing changes
-* showing refactoring progress


         resource, offset = self._get_location()
         docs = codeassist.get_doc(
             self.project, lisp.buffer_string(), offset, resource)
-        pydoc_buffer = lisp.get_buffer_create('*rope-pydoc*')
-        lisp.set_buffer(pydoc_buffer)
-        lisp.erase_buffer()
-        if docs:
-            lisp.insert(docs)
-            lisp.display_buffer(pydoc_buffer)
+        _make_buffer('*rope-pydoc*', docs, empty_goto=False)
     def code_assist(self):
     def __call__(self):
         handle = taskhandle.TaskHandle(
-        _message('')
         progress = lisp.make_progress_reporter(
             '%s ... ' %, 0, 100)
         def update_progress():
         return calculate.result
+def _make_buffer(name, contents, empty_goto=True):
+    new_buffer = lisp.get_buffer_create(name)
+    lisp.set_buffer(new_buffer)
+    lisp.erase_buffer()
+    if contents or empty_goto:
+        lisp.insert(contents)
+        lisp.display_buffer(new_buffer)
+        lisp.goto_line(1)
 DEFVARS = """\


         def calculate(handle):
             return self._calculate_changes(result, handle)
-        name = 'Performing %s' %
+        name = 'Calculating %s changes' %
         changes = ropemacs._RunTask(calculate, name=name)()
         if action == 'perform':
         if action == 'preview':
-            ropemacs._message('We\'ll preview it!')
+            ropemacs._make_buffer('*rope-preview*',
+                                  str(changes.get_description()))
     def project(self):
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
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.