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

format fails with TypeError on 'document_path' #102

Open
bgerrity opened this issue Dec 6, 2023 · 1 comment
Open

format fails with TypeError on 'document_path' #102

bgerrity opened this issue Dec 6, 2023 · 1 comment

Comments

@bgerrity
Copy link

bgerrity commented Dec 6, 2023

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']}
@bgerrity bgerrity changed the title format with from command palette fails with TypeError format fails with TypeError on 'document_path' Dec 6, 2023
@amyreese
Copy link
Member

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. 😅

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

No branches or pull requests

2 participants