99from prompt_toolkit .buffer import Buffer
1010from prompt_toolkit .key_binding import KeyPressEvent
1111from prompt_toolkit .key_binding .bindings import named_commands as nc
12- from prompt_toolkit .auto_suggest import AutoSuggestFromHistory , Suggestion , AutoSuggest
12+ from prompt_toolkit .auto_suggest import AutoSuggestFromHistory , Suggestion
1313from prompt_toolkit .document import Document
1414from prompt_toolkit .history import History
1515from prompt_toolkit .shortcuts import PromptSession
@@ -103,9 +103,6 @@ def apply_transformation(self, ti: TransformationInput) -> Transformation:
103103 if len (suggestions ) == 0 :
104104 return noop ("noop: no suggestions" )
105105
106- suggestions_longer_than_buffer : bool = (
107- len (suggestions ) + ti .document .cursor_position_row > ti .document .line_count
108- )
109106 if prompt_toolkit .VERSION < (3 , 0 , 49 ):
110107 if len (suggestions ) > 1 and prompt_toolkit .VERSION < (3 , 0 , 49 ):
111108 if ti .lineno == ti .document .cursor_position_row :
@@ -132,7 +129,6 @@ def apply_transformation(self, ti: TransformationInput) -> Transformation:
132129 return Transformation (fragments = ti .fragments + [(self .style , suggestion )])
133130 if is_last_line :
134131 if delta < len (suggestions ):
135- extra = f"; { len (suggestions ) - delta } line(s) hidden"
136132 suggestion = f"… rest of suggestion ({ len (suggestions ) - delta } lines) and code hidden"
137133 return Transformation ([(self .style , suggestion )])
138134
@@ -171,7 +167,7 @@ class NavigableAutoSuggestFromHistory(AutoSuggestFromHistory):
171167 _connected_apps : list [PromptSession ]
172168
173169 # handle to the currently running llm task that appends suggestions to the
174- # current buffer; we keep a handle to it in order to cancell it when there is a cursor movement, or
170+ # current buffer; we keep a handle to it in order to cancel it when there is a cursor movement, or
175171 # another request.
176172 _llm_task : asyncio .Task | None = None
177173
@@ -306,7 +302,7 @@ def down(self, query: str, other_than: str, history: History) -> None:
306302
307303 def _cancel_running_llm_task (self ) -> None :
308304 """
309- Try to cancell the currently running llm_task if exists, and set it to None.
305+ Try to cancel the currently running llm_task if exists, and set it to None.
310306 """
311307 if self ._llm_task is not None :
312308 if self ._llm_task .done ():
@@ -353,7 +349,7 @@ async def error_catcher(buffer):
353349 get_ipython ().log .error ("error" )
354350 raise
355351
356- # here we need a cancellable task so we can't just await the error catched
352+ # here we need a cancellable task so we can't just await the error caught
357353 self ._llm_task = asyncio .create_task (error_catcher (buffer ))
358354 await self ._llm_task
359355
@@ -427,7 +423,7 @@ async def llm_autosuggestion(event: KeyPressEvent):
427423 This will first make sure that the current buffer have _MIN_LINES (7)
428424 available lines to insert the LLM completion
429425
430- Provisional as of 8.32, may change without warnigns
426+ Provisional as of 8.32, may change without warnings
431427
432428 """
433429 _MIN_LINES = 5
0 commit comments