Skip to content

TypeError in definition.py when handling line and column values #623

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

Open
liaochangmei opened this issue Mar 4, 2025 · 0 comments
Open

Comments

@liaochangmei
Copy link

I’m encountering a TypeError in the definition.py file when the plugin attempts to calculate line - 1 for the start position in the definition response. The error occurs because d.line is None, even though I’ve verified that the line and column values passed to pylsp are valid integers.

Error Details:
Error from pylsp: File "/usr/local/python39/lib/python3.9/site-packages/pylsp/plugins/definition.py", line 69, in
Error from pylsp: "start": {"line": d.line - 1, "character": d.column},
Error from pylsp: TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'

Steps to Reproduce:
Send a textDocument/definition request with valid line and column values (verified as integers),like this:
b'Content-Length: 202\r\n\r\n{"jsonrpc": "2.0", "method": "textDocument/definition", "params": {"textDocument": {"uri": "file:///home/dev/server/udc_tools_flask/public_project/wsj11.py", "position": {"line": 23, "character": 18}}}}'
The server processes the request but encounters the error when constructing the response.

Thank you for your attention to this issue. Let me know if you need further details or debugging information.

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

1 participant