Skip to content

Commit

Permalink
get_script: additional_dynamic_modules: add only listed buffers
Browse files Browse the repository at this point in the history
Unlisted buffers might come e.g. from `set viminfo+=%`, and Jedi would
crash on them.

This could additionally check for them to be readable, but this should
be handled in Jedi itself anyway.
  • Loading branch information
blueyed authored and davidhalter committed Apr 17, 2018
1 parent 79b332a commit 1c3078e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pythonx/jedi_vim.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,11 @@ def wrapper(*args, **kwargs):

@catch_and_print_exceptions
def get_script(source=None, column=None):
jedi.settings.additional_dynamic_modules = \
[b.name for b in vim.buffers if b.name is not None and b.name.endswith('.py')]
jedi.settings.additional_dynamic_modules = [
b.name for b in vim.buffers if (
b.name is not None and
b.name.endswith('.py') and
b.options['buflisted'])]
if source is None:
source = '\n'.join(vim.current.buffer)
row = vim.current.window.cursor[0]
Expand Down

0 comments on commit 1c3078e

Please sign in to comment.