Fixed a little bug in the code assist client. release-5.0.3

Sun, 19 Nov 2017 19:31:46 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 19 Nov 2017 19:31:46 +0100
changeset 234
a9d03af34d28
parent 233
9cfedb7c0574
child 235
911b3d0dd6b2

Fixed a little bug in the code assist client.

ChangeLog file | annotate | diff | comparison | revisions
PluginRefactoringRope.py file | annotate | diff | comparison | revisions
PluginRefactoringRope.zip file | annotate | diff | comparison | revisions
RefactoringRope/CodeAssistClient.py file | annotate | diff | comparison | revisions
RefactoringRope/Documentation/source/Plugin_Refactoring_Rope.RefactoringRope.CodeAssistClient.html file | annotate | diff | comparison | revisions
--- a/ChangeLog	Sun Nov 05 17:23:43 2017 +0100
+++ b/ChangeLog	Sun Nov 19 19:31:46 2017 +0100
@@ -1,5 +1,8 @@
 ChangeLog
 ---------
+Version 5.0.3:
+- bug fixes
+
 Version 5.0.2:
 - bug fixes
 - extended the code info provider to return the object type as well
--- a/PluginRefactoringRope.py	Sun Nov 05 17:23:43 2017 +0100
+++ b/PluginRefactoringRope.py	Sun Nov 19 19:31:46 2017 +0100
@@ -23,7 +23,7 @@
 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
 autoactivate = True
 deactivateable = True
-version = "5.0.2"
+version = "5.0.3"
 className = "RefactoringRopePlugin"
 packageName = "RefactoringRope"
 internalPackages = "rope"
Binary file PluginRefactoringRope.zip has changed
--- a/RefactoringRope/CodeAssistClient.py	Sun Nov 05 17:23:43 2017 +0100
+++ b/RefactoringRope/CodeAssistClient.py	Sun Nov 19 19:31:46 2017 +0100
@@ -24,6 +24,7 @@
 
 import rope.base.libutils
 import rope.contrib.codeassist
+from rope.base.exceptions import BadIdentifierError
 
 from JsonClient import JsonClient
 
@@ -277,7 +278,7 @@
         except Exception as err:
             errorDict = self.__handleRopeError(err)
         
-        typeName = self.__getObjectTypeAnName(
+        typeName = self.__getObjectTypeAndName(
                 self.__project, source, offset, resource, maxfixes=maxfixes)
         
         documentationDict = self.__processDocumentation(cts, documentation,
@@ -333,8 +334,8 @@
         return dict(name=objectFullname, argspec=argspec, module=module,
                     docstring=documentation, typ=typeName[0])
     
-    def __getObjectTypeAnName(self, project, sourceCode, offset,
-                              resource=None, maxfixes=1):
+    def __getObjectTypeAndName(self, project, sourceCode, offset,
+                               resource=None, maxfixes=1):
         """
         Private method to determine an object type and name for the given
         location.
@@ -353,8 +354,12 @@
         from rope.base import pyobjects, pyobjectsdef, pynames
         from rope.contrib import fixsyntax
         
-        fixer = fixsyntax.FixSyntax(project, sourceCode, resource, maxfixes)
-        pyname = fixer.pyname_at(offset)
+        try:
+            fixer = fixsyntax.FixSyntax(project, sourceCode, resource,
+                                        maxfixes)
+            pyname = fixer.pyname_at(offset)
+        except BadIdentifierError:
+            pyname = None
         if pyname is None:
             return "<unknown>", "<unknown>"
         
--- a/RefactoringRope/Documentation/source/Plugin_Refactoring_Rope.RefactoringRope.CodeAssistClient.html	Sun Nov 05 17:23:43 2017 +0100
+++ b/RefactoringRope/Documentation/source/Plugin_Refactoring_Rope.RefactoringRope.CodeAssistClient.html	Sun Nov 19 19:31:46 2017 +0100
@@ -78,7 +78,7 @@
 <td><a href="#CodeAssistClient.__getDocumentation">__getDocumentation</a></td>
 <td>Private method to get some source code documentation.</td>
 </tr><tr>
-<td><a href="#CodeAssistClient.__getObjectTypeAnName">__getObjectTypeAnName</a></td>
+<td><a href="#CodeAssistClient.__getObjectTypeAndName">__getObjectTypeAndName</a></td>
 <td>Private method to determine an object type and name for the given location.</td>
 </tr><tr>
 <td><a href="#CodeAssistClient.__handleRopeError">__handleRopeError</a></td>
@@ -181,9 +181,9 @@
 <dd>
 dictionary containing the method parameters
 </dd>
-</dl><a NAME="CodeAssistClient.__getObjectTypeAnName" ID="CodeAssistClient.__getObjectTypeAnName"></a>
-<h4>CodeAssistClient.__getObjectTypeAnName</h4>
-<b>__getObjectTypeAnName</b>(<i>project, sourceCode, offset, resource=None, maxfixes=1</i>)
+</dl><a NAME="CodeAssistClient.__getObjectTypeAndName" ID="CodeAssistClient.__getObjectTypeAndName"></a>
+<h4>CodeAssistClient.__getObjectTypeAndName</h4>
+<b>__getObjectTypeAndName</b>(<i>project, sourceCode, offset, resource=None, maxfixes=1</i>)
 <p>
         Private method to determine an object type and name for the given
         location.

eric ide

mercurial