Skip to content

Commit

Permalink
Limit number of completions to 5k (for performance).
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanslenders committed May 16, 2024
1 parent 1c558f8 commit d229af6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ptpython/completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import keyword
import re
from enum import Enum
from itertools import islice
from typing import TYPE_CHECKING, Any, Callable, Iterable

from prompt_toolkit.completion import (
Expand Down Expand Up @@ -617,7 +618,10 @@ def __init__(
def get_completions(
self, document: Document, complete_event: CompleteEvent
) -> Iterable[Completion]:
completions = list(self.completer.get_completions(document, complete_event))
completions = list(
# Limit at 5k completions for performance.
islice(self.completer.get_completions(document, complete_event), 0, 5000)
)
complete_private_attributes = self.complete_private_attributes()
hide_private = False

Expand Down

0 comments on commit d229af6

Please sign in to comment.