omnilib / vscode-ufmt

VS Code extension for µfmt
https://ufmt.omnilib.dev
MIT License
5 stars 4 forks source link

format fails with TypeError on 'document_path' #102

Closed bgerrity closed 2 weeks ago

bgerrity commented 11 months ago
Screenshot 2023-12-06 at 12 29 22 PM

Output

formatting via rpc
Failed to handle request 4 textDocument/formatting DocumentFormattingParams(text_document=TextDocumentIdentifier(uri='file:///Users/brendan.gerrity/go/src/github.com/DataDog/dd-source/domains/atlas/shared/libs/py3/worker/atlas_worker.py'), options=FormattingOptions(tab_size=4, insert_spaces=True, trim_trailing_whitespace=None, insert_final_newline=None, trim_final_newlines=None), work_done_token=None)
Traceback (most recent call last):
  File "/Users/brendan.gerrity/.vscode/extensions/omnilib.ufmt-2023.4.3-darwin-arm64/bundled/libs/pygls/protocol.py", line 340, in _handle_request
    self._execute_request(msg_id, handler, params)
  File "/Users/brendan.gerrity/.vscode/extensions/omnilib.ufmt-2023.4.3-darwin-arm64/bundled/libs/pygls/protocol.py", line 264, in _execute_request
    self._send_response(msg_id, handler(params))
  File "/Users/brendan.gerrity/.vscode/extensions/omnilib.ufmt-2023.4.3-darwin-arm64/bundled/tool/server.py", line 100, in formatting
    edits = _formatting_helper(document)
  File "/Users/brendan.gerrity/.vscode/extensions/omnilib.ufmt-2023.4.3-darwin-arm64/bundled/tool/server.py", line 110, in _formatting_helper
    result = _run_tool_on_document(document, use_stdin=True)
  File "/Users/brendan.gerrity/.vscode/extensions/omnilib.ufmt-2023.4.3-darwin-arm64/bundled/tool/server.py", line 278, in _run_tool_on_document
    result = jsonrpc.run_over_json_rpc(
TypeError: run_over_json_rpc() got an unexpected keyword argument 'document_path'
/opt/homebrew/bin/python3.10 -m ufmt format - /Users/brendan.gerrity/go/src/github.com/DataDog/dd-source/domains/atlas/shared/libs/py3/worker/atlas_worker.py
CWD Linter: /Users/brendan.gerrity/go/src/github.com/DataDog/dd-source
[Error - 12:24:30 PM] Request textDocument/formatting failed.
  Message: TypeError: run_over_json_rpc() got an unexpected keyword argument 'document_path'
  Code: -32602 
{'traceback': ['  File "/Users/brendan.gerrity/.vscode/extensions/omnilib.ufmt-2023.4.3-darwin-arm64/bundled/libs/pygls/protocol.py", line 340, in _handle_request\n    self._execute_request(msg_id, handler, params)\n', '  File "/Users/brendan.gerrity/.vscode/extensions/omnilib.ufmt-2023.4.3-darwin-arm64/bundled/libs/pygls/protocol.py", line 264, in _execute_request\n    self._send_response(msg_id, handler(params))\n', '  File "/Users/brendan.gerrity/.vscode/extensions/omnilib.ufmt-2023.4.3-darwin-arm64/bundled/tool/server.py", line 100, in formatting\n    edits = _formatting_helper(document)\n', '  File "/Users/brendan.gerrity/.vscode/extensions/omnilib.ufmt-2023.4.3-darwin-arm64/bundled/tool/server.py", line 110, in _formatting_helper\n    result = _run_tool_on_document(document, use_stdin=True)\n', '  File "/Users/brendan.gerrity/.vscode/extensions/omnilib.ufmt-2023.4.3-darwin-arm64/bundled/tool/server.py", line 278, in _run_tool_on_document\n    result = jsonrpc.run_over_json_rpc(\n']}
amyreese commented 10 months ago

Hi Brendan, can you confirm what your ufmt settings were in VS Code when you hit this error? I'm not sure I've ever known how to exercise this codepath, and I'd like to better understand your use case here.

Also, would using the "bundled" import strategy resolve this error? I'm making that the default in the next release, but would like to know if that is sufficient before I drop the code paths that end up going down the RPC method, because I don't think that ever worked. 😅