diff --git a/ycmd/completers/python/python_completer.py b/ycmd/completers/python/python_completer.py index ada2fd19e0..aad8c6701d 100644 --- a/ycmd/completers/python/python_completer.py +++ b/ycmd/completers/python/python_completer.py @@ -217,6 +217,9 @@ def ComputeCandidatesInner( self, request_data ): def ComputeSignaturesInner( self, request_data ): with self._jedi_lock: signatures = self._GetJediScript( request_data ).call_signatures() + # Sorting bu the number or arguments makes the order stable for the tests + # and isn't harmful. The order returned by jedi seems to be arbitrary. + signatures = sorted( signatures, key=lambda s: len( s.params ) ) active_signature = 0 active_parameter = 0