Skip to content

Autoimport keep throwing exception when delete a line #307

Closed
@douo

Description

@douo
--- 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions