microsoft / microsoft/TypeScript
Add support for `willDeleteFiles`/`didDeleteFiles` to tsserver
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Go
- Star
- 111k
- Fork
- 14.4k
- Merge trung bình
- 1 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 117
Mô tả
Suggestion
🔍 Search Terms
willDeleteFiles/didDeleteFiles
update errors after deleting file
deleting file
removing file
renaming file
✅ Viability Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
⭐ Suggestion
Add support for willDeleteFiles/didDeleteFiles (https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_willDeleteFiles)
As for my current knowledge, tsserver right now watches filesystem on its own, as mentioned in this article. Unfortunately this method is not always correct and sometimes (specifically in larger repositories) after renaming files, or deleting them - tsserver does not know that the filesystem was changed resulting in out-of-sync error messages.
Adding support for such methods would allow editors to notify tsserver that something has changed and then tsserver could internally update it's state about the files.
📃 Motivating Example
https://github.com/microsoft/TypeScript/assets/35625949/1eec8678-8af6-43d0-bf2f-25eecbac0b96
In this example, when file is deleted by the user, the diagnostic about file not existing is not shown. It might be shown after some time in the future, but an editor can send this notification to the server immediately after user performs an action
💻 Use Cases
For now the only way to deal with this is to restart tsserver. While this solution works it would be nicer user experience for this to happen automatically.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng việc xem xét hành vi theo dõi hệ thống tệp của tsserver và đặc tả Language Server Protocol được liên kết về các thông báo xóa tệp trong workspace. Theo dõi cách việc xóa và đổi tên tệp hiện đến được tsserver, sau đó xác định cách xử lý thông báo cần thiết. Được xem là hoàn tất khi các trình chỉnh sửa có thể thông báo cho tsserver thông qua willDeleteFiles/didDeleteFiles và các chẩn đoán của nó vẫn được đồng bộ mà không cần khởi động lại.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- typescript
- Lĩnh vực
- devtools
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100