--- a/RefactoringRope/RefactoringClient.py Mon Sep 11 19:15:44 2017 +0200 +++ b/RefactoringRope/RefactoringClient.py Mon Sep 11 19:55:45 2017 +0200 @@ -51,9 +51,12 @@ """ self.__connection = socket.create_connection((host, port)) + from FileSystemCommands import RefactoringClientFileSystemCommands + self.__fsCommands = RefactoringClientFileSystemCommands(self) + self.__projectpath = projectPath self.__project = rope.base.project.Project( - self.__projectpath)#, fscommands=self.__fsCommands) + self.__projectpath, fscommands=self.__fsCommands) def __processJson(self, jsonStr): """ @@ -65,7 +68,7 @@ try: commandDict = json.loads(jsonStr.strip()) except (TypeError, ValueError) as err: - self.__sendJson("ClientException", { + self.sendJson("ClientException", { "ExceptionType": "ProtocolError", "ExceptionValue": str(err), "ProtocolData": jsonStr.strip(), @@ -79,11 +82,11 @@ sys.getfilesystemencoding()) if method == "ping": - self.__sendJson("pong", {}) + self.sendJson("pong", {}) - def __sendJson(self, command, params): + def sendJson(self, command, params): """ - Private method to send a single refactoring command to the client. + Public method to send a single refactoring command to the client. @param command command name to be sent @type str @@ -125,17 +128,14 @@ while True: try: rrdy, wrdy, xrdy = select.select( - [self.__connection], [self.__connection], []) + [self.__connection], [], []) except (select.error, KeyboardInterrupt, socket.error): # just carry on continue if self.__connection in rrdy: self.__receiveJson() -## -## if self.__connection in wrdy: -## self.__connection.flush() - + except Exception: exctype, excval, exctb = sys.exc_info() tbinfofile = io.StringIO() @@ -143,7 +143,7 @@ tbinfofile.seek(0) tbinfo = tbinfofile.read() del exctb - self.__sendJson("ClientException", { + self.sendJson("ClientException", { "ExceptionType": str(exctype), "ExceptionValue": str(excval), "Traceback": tbinfo,