RefactoringRope/CodeAssistClient.py

branch
server_client_variant
changeset 201
e677d82706d4
parent 200
1584892147ef
child 203
c38750e1bafd
diff -r 1584892147ef -r e677d82706d4 RefactoringRope/CodeAssistClient.py
--- a/RefactoringRope/CodeAssistClient.py	Wed Sep 27 19:02:58 2017 +0200
+++ b/RefactoringRope/CodeAssistClient.py	Wed Sep 27 19:30:16 2017 +0200
@@ -32,9 +32,17 @@
     """
     PictureIDs = {
         "class": "?{0}".format(1),          # Editor.ClassID
+        "_class": "?{0}".format(2),         # Editor.ClassProtectedID
+        "__class": "?{0}".format(3),        # Editor.ClassPrivateID
         "instance": "?{0}".format(1),       # Editor.ClassID
+        "_instance": "?{0}".format(2),      # Editor.ClassProtectedID
+        "__instance": "?{0}".format(3),     # Editor.ClassPrivateID
         "function": "?{0}".format(4),       # Editor.MethodID
+        "_function": "?{0}".format(5),      # Editor.MethodProtectedID
+        "__function": "?{0}".format(6),     # Editor.MethodPrivateID
         "module": "?{0}".format(7),         # Editor.AttributeID
+        "_module": "?{0}".format(8),        # Editor.AttributeProtectedID
+        "__module": "?{0}".format(9),       # Editor.AttributePrivateID
         "None": "",
     }
     # The various ID values are a copy of the ones found in the Editor
@@ -124,10 +132,14 @@
             proposals = rope.contrib.codeassist.code_assist(
                 self.__project, source, offset, resource, maxfixes=maxfixes)
             proposals = rope.contrib.codeassist.sorted_proposals(proposals)
-            # TODO: extend this to include PictureIDs for protected and
-            #       private stuff (i.e. names starting with _ or __)
-            completions = [proposal.name + self.PictureIDs[proposal.type]
-                           for proposal in proposals]
+            for proposal in proposals:
+                proposalType = proposal.type
+                if proposal.name.startswith("__"):
+                    proposalType = "__" + proposalType
+                elif proposal.name.startswith("_"):
+                    proposalType = "_" + proposalType
+                completions.append(
+                    proposal.name + self.PictureIDs[proposalType])
         except Exception as err:
             errorDict = self.__handleRopeError(err)
         

eric ide

mercurial