58 super(CodeAssistClient, self).__init__(host, port, idString) |
58 super(CodeAssistClient, self).__init__(host, port, idString) |
59 |
59 |
60 self.__methodMapping = { |
60 self.__methodMapping = { |
61 "getCompletions": self.__getCompletions, |
61 "getCompletions": self.__getCompletions, |
62 "getCallTips": self.__getCallTips, |
62 "getCallTips": self.__getCallTips, |
|
63 "reportChanged": self.__reportChanged, |
63 } |
64 } |
64 |
65 |
65 self.__projectpath = projectPath |
66 self.__projectpath = projectPath |
66 self.__project = rope.base.project.Project(self.__projectpath) |
67 self.__project = rope.base.project.Project(self.__projectpath) |
67 self.__project.validate(self.__project.root) |
68 self.__project.validate(self.__project.root) |
137 |
138 |
138 self.sendJson("CompletionsResult", result) |
139 self.sendJson("CompletionsResult", result) |
139 |
140 |
140 def __getCallTips(self, params): |
141 def __getCallTips(self, params): |
141 """ |
142 """ |
142 Private method to calculate possible completions. |
143 Private method to calculate possible calltips. |
143 |
144 |
144 @param params dictionary containing the method parameters |
145 @param params dictionary containing the method parameters |
145 @type dict |
146 @type dict |
146 """ |
147 """ |
147 filename = params["FileName"] |
148 filename = params["FileName"] |
171 "CallTips": calltips, |
172 "CallTips": calltips, |
172 } |
173 } |
173 result.update(errorDict) |
174 result.update(errorDict) |
174 |
175 |
175 self.sendJson("CallTipsResult", result) |
176 self.sendJson("CallTipsResult", result) |
|
177 |
|
178 def __reportChanged(self, params): |
|
179 """ |
|
180 Private method to register some changed sources. |
|
181 |
|
182 @param params dictionary containing the method parameters sent by |
|
183 the server |
|
184 @type dict |
|
185 """ |
|
186 filename = params["FileName"] |
|
187 oldSource = params["OldSource"] |
|
188 |
|
189 try: |
|
190 rope.base.libutils.report_change( |
|
191 self.__project, filename, oldSource) |
|
192 except Exception: |
|
193 # simply ignore it |
|
194 pass |
176 |
195 |
177 |
196 |
178 if __name__ == '__main__': |
197 if __name__ == '__main__': |
179 if len(sys.argv) != 5: |
198 if len(sys.argv) != 5: |
180 print('Host, port, id and project path parameters are missing. Abort.') |
199 print('Host, port, id and project path parameters are missing. Abort.') |