[ty] Support LSP go-to with vendored typeshed stubs#19057
Conversation
b2ece26 to
b0689e9
Compare
b0689e9 to
dc1c401
Compare
|
|
ba5f5d9 to
81add77
Compare
sharkdp
left a comment
There was a problem hiding this comment.
This looks (and works) great! Thank you.
dhruvmanila
left a comment
There was a problem hiding this comment.
This is a great start!
The approach of using a file on disk on-demand is great especially given that it'll automatically provide the user with full LSP capabilities on those vendored files as well.
The one, very small, downside that I see is that the server will also store the file content in the Index while the file is open in the editor to keep track of the open files. This is done because whenever this file will be opened in the editor, the server will receive the didOpen notification from the client.
In the future, we might also want to make sure that these files are immutable by the system given that a user can apply any code actions if there are any.
Do we have any rough idea on how we want to solve this in the playground? Is it possible to use the same approach there?
|
I just saw this in VS Code extension document: https://code.visualstudio.com/api/extension-guides/virtual-documents which, I think, is what Sorbet is doing as well from reading:
This solution is limited to the clients that would implement this extension endpoint which for now would be just VS Code. I don't think we should change the implementation as I believe the current solution is more robust in the sense that it doesn't require additional support on the client side. |
81add77 to
61fd717
Compare
I'm not too familiar with how the playground works, but I imagine we could create a in-memory "file" and display it in a new tab, yeah. |
Summary
Extracts the vendored typeshed stubs lazily and caches them on the local filesystem to support go-to in the LSP.
Resolves astral-sh/ty#77.
Test Plan
go-to-vendored.mp4