-
-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Labels
state:reproducibleVerified steps to reproduce included and someone on the team managed to reproduceVerified steps to reproduce included and someone on the team managed to reproduce
Description
Summary
Ty LSP server throws textDocument/didClose error when renaming Python files, causing language server desynchronization.
Description
Ty LSP server is running and working correctly, but when renaming Python files, it throws a textDocument/didClose error with "document not found" message. This causes the language server to lose sync with the editor and may prevent further operations on the renamed file.
The issue occurs on both large projects with 2000+ files and small projects alike.
Currently using basedpyright as a workaround, but it is very slow on large projects during file renaming operations. Looking forward to using Ty once this is fixed.
Steps to reproduce:
- Enable Ty LSP for Python in Zed with pyenv virtualenv
- Open a Python project
- Rename any Python file in the project
- Observe the error in Zed logs
Expected Behavior:
- File renaming should be handled correctly by Ty LSP
- No errors should occur during
textDocument/didCloseevent - Language server should remain in sync with the editor after renaming
Actual Behavior:
- Error occurs:
ERROR An error occurred while running textDocument/didClose: document not found for key: /home/PATH/... - Language server loses synchronization with the editor
- The renamed file may become inaccessible or cause further errors
What i tried:
...
"languages": {
"Python": {
"language_servers": [
"ty",
"!basedpyright",
"!ruff",
"!pylsp",
"!pyright"
],
"preferred_line_length": 80,
"format_on_save": "on",
"formatter": [
{ "code_action": "source.fixAll.ruff" },
{ "code_action": "source.organizeImports.ruff" },
{
"language_server": {
"name": "ruff"
}
}
]
}
},
"lsp": {
"ty": {
"settings": {
"diagnosticMode": "workspace",
"inlayHints": {
"callArgumentNames": true
},
"experimental": {
"rename": true
}
}
},
......
"ty": {
"initialization_options": {
"logLevel": "warn"
},
"settings": {
"disableLanguageServices": false,
// "diagnosticMode": "openFilesOnly",
"diagnosticMode": "workspace",
"inlayHints": {
"variableTypes": true,
"callArgumentNames": true
},
"experimental": {
"rename": false,
"autoImport": true
}
}
},
...Zed Version and System Specs
- Zed: v0.212.5 (or current version)
- OS: Manjaro Linux x86
- Memory: 64 GiB
- Architecture: x86_64
- ty: 0.0.1-alpha.26
If applicable, attach your Zed.log file to this issue.
Zed.log
2025-11-14 12:25:04.574195236 WARN Received notification workspace/didChangeConfiguration which does not have a handler.
2025-11-14 12:25:04.628813597 INFO Indexed 25 file(s) in 0.004s
2025-11-14 12:25:18.538020526 ERROR An error occurred while running textDocument/didClose: document not found for key: /home/bro/30-job/wizard/wizard/services/switchNEWNAME.py
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
state:reproducibleVerified steps to reproduce included and someone on the team managed to reproduceVerified steps to reproduce included and someone on the team managed to reproduce