RefactoringRope/CodeAssistServer.py

branch
server_client_variant
changeset 200
1584892147ef
parent 199
ae2ad82725b0
child 202
a111134b5dc7
equal deleted inserted replaced
199:ae2ad82725b0 200:1584892147ef
11 11
12 import os 12 import os
13 import sys 13 import sys
14 14
15 from PyQt5.QtCore import pyqtSlot, QCoreApplication, QTimer 15 from PyQt5.QtCore import pyqtSlot, QCoreApplication, QTimer
16
17 from E5Gui.E5Application import e5App
16 18
17 # TODO: eliminate this 19 # TODO: eliminate this
18 sys.path.insert(0, os.path.dirname(__file__)) 20 sys.path.insert(0, os.path.dirname(__file__))
19 21
20 from JsonServer import JsonServer 22 from JsonServer import JsonServer
192 if "Error" in result: 194 if "Error" in result:
193 self.__calltips = [] 195 self.__calltips = []
194 else: 196 else:
195 self.__calltips = result["CallTips"] 197 self.__calltips = result["CallTips"]
196 198
197 # TODO: port this to the distributed variant
198 def reportChanged(self, filename, oldSource): 199 def reportChanged(self, filename, oldSource):
199 """ 200 """
200 Public slot to report some changed sources. 201 Public slot to report some changed sources.
201 202
202 @param filename file name of the changed source (string) 203 @param filename file name of the changed source
203 @param oldSource source code before the change (string) 204 @type str
204 """ 205 @param oldSource source code before the change
205 print("code assist: reportChanged") 206 @type str
206 ## try: 207 """
207 ## rope.base.libutils.report_change( 208 editor = e5App().getObject("ViewManager").getOpenEditor(filename)
208 ## self.__project, filename, oldSource) 209 if editor is not None:
209 ## except RuntimeError: 210 language = editor.getLanguage()
210 ## # this could come from trying to do PyQt4/PyQt5 mixed stuff 211 if language in self.__editorLanguageMapping:
211 ## # simply ignore it 212 idString = self.__editorLanguageMapping[language]
212 ## pass 213
214 self.sendJson("reportChanged", {
215 "FileName": filename,
216 "OldSource": oldSource,
217 }, idString=idString)
213 218
214 ####################################################################### 219 #######################################################################
215 ## Methods below handle the network connection 220 ## Methods below handle the network connection
216 ####################################################################### 221 #######################################################################
217 222

eric ide

mercurial