RefactoringRope/CodeAssistClient.py

branch
server_client_variant
changeset 212
f05681349336
parent 209
c1dce8630555
child 216
47fb0119f0be
--- a/RefactoringRope/CodeAssistClient.py	Fri Oct 06 18:49:50 2017 +0200
+++ b/RefactoringRope/CodeAssistClient.py	Sun Oct 08 17:54:29 2017 +0200
@@ -66,6 +66,9 @@
         super(CodeAssistClient, self).__init__(host, port, idString)
         
         self.__methodMapping = {
+            "getConfig": self.__getConfig,
+            "configChanged": self.__configChanged,
+            "closeProject": self.__closeProject,
             "getCompletions": self.__getCompletions,
             "getCallTips": self.__getCallTips,
             "reportChanged": self.__reportChanged,
@@ -74,6 +77,8 @@
         self.__projectpath = projectPath
         self.__project = rope.base.project.Project(self.__projectpath)
         self.__project.validate(self.__project.root)
+        
+        self.__id = idString
     
     def handleCall(self, method, params):
         """
@@ -107,6 +112,43 @@
         
         return errorDict
     
+    def __getConfig(self, params):
+        """
+        Private method to send some configuration data to the server.
+        
+        @param params dictionary containing the method parameters sent by
+            the server
+        @type dict
+        """
+        result = {
+            "RopeFolderName": self.__project.ropefolder.real_path,
+            "Id": self.__id,
+        }
+        
+        self.sendJson("Config", result)
+    
+    def __configChanged(self, params):
+        """
+        Private method to handle a change of the configuration file.
+        
+        @param params dictionary containing the method parameters sent by
+            the server
+        @type dict
+        """
+        self.__project.close()
+        self.__project = rope.base.project.Project(self.__projectpath)
+        self.__project.validate(self.__project.root)
+    
+    def __closeProject(self, params):
+        """
+        Private slot to validate the project.
+        
+        @param params dictionary containing the method parameters sent by
+            the server
+        @type dict
+        """
+        self.__project.close()
+    
     def __getCompletions(self, params):
         """
         Private method to calculate possible completions.
@@ -144,6 +186,8 @@
         
         result = {
             "Completions": completions,
+            "CompletionText": params["CompletionText"],
+            "FileName": filename,
         }
         result.update(errorDict)
         

eric ide

mercurial