Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoimport keep throwing exception when delete a line #307

Closed
douo opened this issue Nov 28, 2022 · 2 comments · Fixed by #309
Closed

Autoimport keep throwing exception when delete a line #307

douo opened this issue Nov 28, 2022 · 2 comments · Fixed by #309
Milestone

Comments

@douo
Copy link
Contributor

douo commented Nov 28, 2022

--- Send (notification): textDocument/didChange

--- Send (58706): textDocument/completion
2022-11-28 22:45:51,446 CST - WARNING - pylsp.config.config - Failed to load hook pylsp_completions: 'NoneType' object has no attribute 'value'
Traceback (most recent call last):
  File "▒▒▒▒▒▒▒▒/venv/lib/python3.10/site-packages/pylsp/config/config.py", line 33, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "▒▒▒▒▒▒▒▒/venv/lib/python3.10/site-packages/pluggy/_manager.py", line 327, in traced_hookexec
    return outcome.get_result()
  File "▒▒▒▒▒▒▒▒/venv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "▒▒▒▒▒▒▒▒/venv/lib/python3.10/site-packages/pluggy/_result.py", line 33, in from_call
    result = func()
  File "▒▒▒▒▒▒▒▒/venv/lib/python3.10/site-packages/pluggy/_manager.py", line 324, in <lambda>
    lambda: oldcall(hook_name, hook_impls, kwargs, firstresult)
  File "▒▒▒▒▒▒▒▒/venv/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
    return outcome.get_result()
  File "▒▒▒▒▒▒▒▒/venv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "▒▒▒▒▒▒▒▒/venv/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "▒▒▒▒▒▒▒▒/venv/lib/python3.10/site-packages/pylsp/plugins/rope_autoimport.py", line 159, in pylsp_completions
    word = word_node.value
AttributeError: 'NoneType' object has no attribute 'value'

After I digging in code, I found the var line is alway a empty string when I delete a line

@ccordoba12
Copy link
Member

Hey @douo, thanks for reporting. It seems that we need to add a validation to avoid this bug. Is it ok for you to submit a pull request to do that?

@ccordoba12 ccordoba12 added this to the v1.7.0 milestone Nov 28, 2022
@ccordoba12
Copy link
Member

Also, pinging @bagel897 about this, just in case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants