Tue, 14 Sep 2021 19:30:12 +0200
JediInterface: streamlined the code dealing with "Goto Definition" and "Goto Reference" to avoid one turn around.
eric7/JediInterface/JediClient.py | file | annotate | diff | comparison | revisions | |
eric7/JediInterface/JediServer.py | file | annotate | diff | comparison | revisions |
--- a/eric7/JediInterface/JediClient.py Tue Sep 14 19:18:33 2021 +0200 +++ b/eric7/JediInterface/JediClient.py Tue Sep 14 19:30:12 2021 +0200 @@ -341,6 +341,15 @@ assignment.line), 'Column': assignment.column, } + + if ( + gotoDefinition["ModulePath"] == filename and + gotoDefinition["Line"] == line + ): + # user called for the definition itself + # => send the references instead + self.__getReferences(params) + return break except SuppressedException as err: errorDict = self.__handleError(err)
--- a/eric7/JediInterface/JediServer.py Tue Sep 14 19:18:33 2021 +0200 +++ b/eric7/JediInterface/JediServer.py Tue Sep 14 19:30:12 2021 +0200 @@ -379,29 +379,6 @@ # ignore errors silently location = result["GotoDefinitionDict"] if location: - try: - editor = self.__editors[euuid] - except KeyError: - editor = None - - if ( - editor is not None and - editor.getFileName() == location["ModulePath"] and - editor.getCursorPosition()[0] + 1 == location["Line"] - ): - # this was a click onto the definition line - # -> get references - idString = self.__idString(editor) - filename, line, index, source = self.__prepareData(editor) - self.sendJson("gotoReferences", { - "FileName": filename, - "Source": source, - "Line": line, - "Index": index, - "Uuid": euuid, - }, idString=idString) - return - self.__vm.openSourceFile(location["ModulePath"], location["Line"], addNext=True)