--- a/RefactoringRope/CodeAssistServer.py Wed Sep 27 18:42:35 2017 +0200 +++ b/RefactoringRope/CodeAssistServer.py Wed Sep 27 19:02:58 2017 +0200 @@ -14,6 +14,8 @@ from PyQt5.QtCore import pyqtSlot, QCoreApplication, QTimer +from E5Gui.E5Application import e5App + # TODO: eliminate this sys.path.insert(0, os.path.dirname(__file__)) @@ -194,22 +196,25 @@ else: self.__calltips = result["CallTips"] - # TODO: port this to the distributed variant def reportChanged(self, filename, oldSource): """ Public slot to report some changed sources. - @param filename file name of the changed source (string) - @param oldSource source code before the change (string) + @param filename file name of the changed source + @type str + @param oldSource source code before the change + @type str """ - print("code assist: reportChanged") -## try: -## rope.base.libutils.report_change( -## self.__project, filename, oldSource) -## except RuntimeError: -## # this could come from trying to do PyQt4/PyQt5 mixed stuff -## # simply ignore it -## pass + editor = e5App().getObject("ViewManager").getOpenEditor(filename) + if editor is not None: + language = editor.getLanguage() + if language in self.__editorLanguageMapping: + idString = self.__editorLanguageMapping[language] + + self.sendJson("reportChanged", { + "FileName": filename, + "OldSource": oldSource, + }, idString=idString) ####################################################################### ## Methods below handle the network connection