Skip to content

Commit 394fe38

Browse files
Limit number of completions to 5k (for performance).
1 parent 3df92f3 commit 394fe38

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ptpython/completer.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import keyword
77
import re
88
from enum import Enum
9+
from itertools import islice
910
from typing import TYPE_CHECKING, Any, Callable, Iterable
1011

1112
from prompt_toolkit.completion import (
@@ -617,7 +618,10 @@ def __init__(
617618
def get_completions(
618619
self, document: Document, complete_event: CompleteEvent
619620
) -> Iterable[Completion]:
620-
completions = list(self.completer.get_completions(document, complete_event))
621+
completions = list(
622+
# Limit at 5k completions for performance.
623+
islice(self.completer.get_completions(document, complete_event), 0, 5000)
624+
)
621625
complete_private_attributes = self.complete_private_attributes()
622626
hide_private = False
623627

0 commit comments

Comments
 (0)