Closed
Description
When attempting to format, I get an error. The backtrace from lsp.log
is below:
Failed to handle request 2
Traceback (most recent call last):
File \"<snip>/.venv/lib/python3.9/site-packages/pylsp_jsonrpc/endpoint.py\", line 116, in consume
self._handle_request(message['id'], message['method'], message.get('params'))
File \"<snip>/.venv/lib/python3.9/site-packages/pylsp_jsonrpc/endpoint.py\", line 185, in _handle_request
handler_result = handler(params)
File \"<snip>/.venv/lib/python3.9/site-packages/pylsp_jsonrpc/dispatchers.py\", line 25, in handler
return method(**(params or {}))
File \"<snip>/.venv/lib/python3.9/site-packages/pylsp/python_lsp.py\", line 366, in m_text_document__formatting
return self.format_document(textDocument['uri'])
File \"<snip>/.venv/lib/python3.9/site-packages/pylsp/python_lsp.py\", line 281, in format_document
return self._hook('pylsp_format_document', doc_uri)
File \"<snip>/.venv/lib/python3.9/site-packages/pylsp/python_lsp.py\", line 156, in _hook
return hook_handlers(config=self.config, workspace=workspace, document=doc, **kwargs)
File \"<snip>/.venv/lib/python3.9/site-packages/pluggy/_hooks.py\", line 265, in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File \"<snip>/.venv/lib/python3.9/site-packages/pluggy/_manager.py\", line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File \"<snip>/.venv/lib/python3.9/site-packages/pluggy/_manager.py\", line 327, in traced_hookexec
return outcome.get_result()
File \"<snip>/.venv/lib/python3.9/site-packages/pluggy/_result.py\", line 60, in get_result
raise ex[1].with_traceback(ex[2])
File \"<snip>/.venv/lib/python3.9/site-packages/pluggy/_result.py\", line 33, in from_call
result = func()
File \"<snip>/.venv/lib/python3.9/site-packages/pluggy/_manager.py\", line 324, in <lambda>
lambda: oldcall(hook_name, hook_impls, kwargs, firstresult)
File \"<snip>/.venv/lib/python3.9/site-packages/pluggy/_callers.py\", line 60, in _multicall
return outcome.get_result()
File \"<snip>/.venv/lib/python3.9/site-packages/pluggy/_result.py\", line 60, in get_result
raise ex[1].with_traceback(ex[2])
File \"<snip>/.venv/lib/python3.9/site-packages/pluggy/_callers.py\", line 39, in _multicall
res = hook_impl.function(*args)
File \"<snip>/.venv/lib/python3.9/site-packages/pylsp_black/plugin.py\", line 13, in pylsp_format_document
return format_document(document)
File \"<snip>/.venv/lib/python3.9/site-packages/pylsp_black/plugin.py\", line 36, in format_document
config = load_config(document.path)
File \"<snip>/.venv/lib/python3.9/site-packages/pylsp_black/plugin.py\", line 82, in load_config
pyproject_filename = root / \"pyproject.toml\"
TypeError: unsupported operand type(s) for /: 'tuple' and 'str'
"
Looks like the latest version of black, 22.1.0, changed the signature for find_project_root
, now returning a tuple.