Skip to content

Commit

Permalink
open completer only InputMode.INSERT
Browse files Browse the repository at this point in the history
  • Loading branch information
nakagami committed Oct 6, 2024
1 parent cd7b6ac commit 6b25e41
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pyvim/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import jedi

from prompt_toolkit.completion import Completer, Completion
from prompt_toolkit.key_binding.vi_state import InputMode

from .utils import getLogger
logger = getLogger()
Expand All @@ -26,9 +27,8 @@ def get_completions(self, document, complete_event):
editor = self._editor_ref()
location = self._editor_buffer_ref().location or '.txt'

if location.endswith('.py') and editor.enable_jedi:
if location.endswith('.py') and editor.enable_jedi and editor.application.vi_state.input_mode==InputMode.INSERT:
completer = PythonCompleter(location)
logger.debug(f"DocumentCompleter::get_completions():{completer=}")
return completer.get_completions(document, complete_event)

return []
Expand Down

0 comments on commit 6b25e41

Please sign in to comment.