--- a/RefactoringRope/RefactoringServer.py Sun Nov 11 19:43:10 2018 +0100 +++ b/RefactoringRope/RefactoringServer.py Sun Nov 11 19:43:56 2018 +0100 @@ -1743,6 +1743,7 @@ line, index = aw.getCursorPosition() offset = self.__getOffset(aw, line, index) + # TODO: remove Subcommand handling self.sendJson("QueryDefinition", { "Title": title, "FileName": filename, @@ -1751,29 +1752,30 @@ "Subcommand": "Query", }) - def gotoDefinition(self, editor): - """ - Public slot to find the definition for the word at the cursor position - and go to it. - - Note: This is executed upon a mouse click sequence. - - @param editor reference to the calling editor - @type QScintilla.Editor.Editor - """ - if self.__projectopen: - filename = editor.getFileName() - line, index = editor.getCursorPosition() - offset = self.__getOffset(editor, line, index) - - self.sendJson("QueryDefinition", { - "Title": "", - "FileName": filename, - "Offset": offset, - "Source": editor.text(), - "Subcommand": "Goto", - }) - + # TODO: move this to code assist +## def gotoDefinition(self, editor): +## """ +## Public slot to find the definition for the word at the cursor position +## and go to it. +## +## Note: This is executed upon a mouse click sequence. +## +## @param editor reference to the calling editor +## @type QScintilla.Editor.Editor +## """ +## if self.__projectopen: +## filename = editor.getFileName() +## line, index = editor.getCursorPosition() +## offset = self.__getOffset(editor, line, index) +## +## self.sendJson("QueryDefinition", { +## "Title": "", +## "FileName": filename, +## "Offset": offset, +## "Source": editor.text(), +## "Subcommand": "Goto", +## }) +## def __queryDefinitionResult(self, result): """ Private method to handle the "Query Definition" result sent by @@ -1782,6 +1784,7 @@ @param result dictionary containing the result data @type dict """ + # TODO: remove Subcommand handling if result["Subcommand"] == "Query": if self.handleRopeError(result): title = result["Title"] @@ -1797,21 +1800,22 @@ E5MessageBox.warning( self.__ui, title, self.tr("No matching definition found.")) - elif result["Subcommand"] == "Goto": - if "Error" not in result: - # ignore errors silently - if "Location" in result: - location = result["Location"] - try: - self.__vm.openSourceFile( - location[0], location[1], addNext=True) - except TypeError: - # backward compatibility; <= 17.03 - self.__vm.openSourceFile( - location[0], location[1], next=True) - else: - e5App().getObject("UserInterface").statusBar().showMessage( - self.tr('No definition found'), 5000) + # TODO: move this to code assist +## elif result["Subcommand"] == "Goto": +## if "Error" not in result: +## # ignore errors silently +## if "Location" in result: +## location = result["Location"] +## try: +## self.__vm.openSourceFile( +## location[0], location[1], addNext=True) +## except TypeError: +## # backward compatibility; <= 17.03 +## self.__vm.openSourceFile( +## location[0], location[1], next=True) +## else: +## e5App().getObject("UserInterface").statusBar().showMessage( +## self.tr('No definition found'), 5000) def __queryImplementations(self): """ @@ -2327,51 +2331,55 @@ else: ok = False return ok - - ######################################################################### - ## Methods below handle setting/unsetting the mouse click handler methods - ######################################################################### - - def connectEditor(self, editor): - """ - Public method to connect an editor. - - @param editor reference to the editor - @type QScintilla.Editor.Editor - """ - if self.__plugin.getPreferences("MouseClickEnabled"): - self.__disconnectMouseClickHandler(editor) - self.__connectMouseClickHandler(editor) - - def disconnectEditor(self, editor): - """ - Public method to disconnect an editor. - - @param editor reference to the editor - @type QScintilla.Editor.Editor - """ - self.__disconnectMouseClickHandler(editor) - - def __connectMouseClickHandler(self, editor): - """ - Private method to connect the mouse click handler to an editor. - - @param editor reference to the editor - @type QScintilla.Editor.Editor - """ - if self.__plugin.getPreferences("MouseClickGotoButton"): - editor.setMouseClickHandler( - "rope", - self.__plugin.getPreferences("MouseClickGotoModifiers"), - self.__plugin.getPreferences("MouseClickGotoButton"), - self.gotoDefinition - ) - - def __disconnectMouseClickHandler(self, editor): - """ - Private method to disconnect the mouse click handler from an editor. - - @param editor reference to the editor - @type QScintilla.Editor.Editor - """ - editor.removeMouseClickHandlers("rope") +## +## ######################################################################### +## ## Methods below handle setting/unsetting the mouse click handler methods +## ######################################################################### +## +## # TODO: move this to code assist +## def connectEditor(self, editor): +## """ +## Public method to connect an editor. +## +## @param editor reference to the editor +## @type QScintilla.Editor.Editor +## """ +## if self.__plugin.getPreferences("MouseClickEnabled"): +## self.__disconnectMouseClickHandler(editor) +## self.__connectMouseClickHandler(editor) +## +## # TODO: move this to code assist +## def disconnectEditor(self, editor): +## """ +## Public method to disconnect an editor. +## +## @param editor reference to the editor +## @type QScintilla.Editor.Editor +## """ +## self.__disconnectMouseClickHandler(editor) +## +## # TODO: move this to code assist +## def __connectMouseClickHandler(self, editor): +## """ +## Private method to connect the mouse click handler to an editor. +## +## @param editor reference to the editor +## @type QScintilla.Editor.Editor +## """ +## if self.__plugin.getPreferences("MouseClickGotoButton"): +## editor.setMouseClickHandler( +## "rope", +## self.__plugin.getPreferences("MouseClickGotoModifiers"), +## self.__plugin.getPreferences("MouseClickGotoButton"), +## self.gotoDefinition +## ) +## +## # TODO: move this to code assist +## def __disconnectMouseClickHandler(self, editor): +## """ +## Private method to disconnect the mouse click handler from an editor. +## +## @param editor reference to the editor +## @type QScintilla.Editor.Editor +## """ +## editor.removeMouseClickHandlers("rope")