76 self.__calculateIntroduceParameterChanges, |
76 self.__calculateIntroduceParameterChanges, |
77 "CalculateImportsChanges": self.__calculateImportsChanges, |
77 "CalculateImportsChanges": self.__calculateImportsChanges, |
78 "CalculateRestructureChanges": self.__calculateRestructureChanges, |
78 "CalculateRestructureChanges": self.__calculateRestructureChanges, |
79 "RequestSignature": self.__requestSignature, |
79 "RequestSignature": self.__requestSignature, |
80 "CalculateSignatureChanges": self.__calculateSignatureChanges, |
80 "CalculateSignatureChanges": self.__calculateSignatureChanges, |
|
81 "CalculateInlineArgumentDefaultChanges": |
|
82 self.__calculateInlineArgumentDefaultChanges, |
81 } |
83 } |
82 |
84 |
83 from FileSystemCommands import RefactoringClientFileSystemCommands |
85 from FileSystemCommands import RefactoringClientFileSystemCommands |
84 self.__fsCommands = RefactoringClientFileSystemCommands(self) |
86 self.__fsCommands = RefactoringClientFileSystemCommands(self) |
85 |
87 |
1241 |
1243 |
1242 result["Subcommand"] = "ChangesCalculated" |
1244 result["Subcommand"] = "ChangesCalculated" |
1243 result.update(errorDict) |
1245 result.update(errorDict) |
1244 |
1246 |
1245 self.sendJson("Changes", result) |
1247 self.sendJson("Changes", result) |
|
1248 |
|
1249 def __calculateInlineArgumentDefaultChanges(self, params): |
|
1250 """ |
|
1251 Private method to calculate the 'Inline Argument Default' changes |
|
1252 based on the parameters sent by the server. |
|
1253 |
|
1254 @param params dictionary containing the method parameters sent by |
|
1255 the server |
|
1256 @type dict |
|
1257 """ |
|
1258 changeGroup = params["ChangeGroup"] |
|
1259 title = params["Title"] |
|
1260 filename = params["FileName"] |
|
1261 offset = params["Offset"] |
|
1262 argumentIndex = params["Index"] |
|
1263 |
|
1264 errorDict = {} |
|
1265 result = { |
|
1266 "Subcommand": "Signature", |
|
1267 "ChangeGroup": changeGroup, |
|
1268 "Title": title, |
|
1269 } |
|
1270 |
|
1271 resource = rope.base.libutils.path_to_resource( |
|
1272 self.__project, filename) |
|
1273 self.__progressHandle = ProgressHandle(self, title, True) |
|
1274 try: |
|
1275 changer = rope.refactor.change_signature.ChangeSignature( |
|
1276 self.__project, resource, offset) |
|
1277 inliner = rope.refactor.change_signature.ArgumentDefaultInliner( |
|
1278 argumentIndex) |
|
1279 changes = changer.get_changes( |
|
1280 [inliner], task_handle=self.__progressHandle) |
|
1281 except Exception as err: |
|
1282 errorDict = self.__handleRopeError(err) |
|
1283 self.__progressHandle.reset() |
|
1284 self.__progressHandle = None |
|
1285 |
|
1286 self.__changes[changeGroup] = changes |
|
1287 |
|
1288 result["Subcommand"] = "ChangesCalculated" |
|
1289 result.update(errorDict) |
|
1290 |
|
1291 self.sendJson("Changes", result) |
1246 |
1292 |
1247 |
1293 |
1248 if __name__ == '__main__': |
1294 if __name__ == '__main__': |
1249 if len(sys.argv) != 4: |
1295 if len(sys.argv) != 4: |
1250 print('Host, port and project path parameters are missing. Abort.') |
1296 print('Host, port and project path parameters are missing. Abort.') |