yioneko / vtsls

LSP wrapper for typescript extension of vscode
Other
366 stars 6 forks source link

Select TypeScript version not working. #180

Closed gxanshu closed 1 day ago

gxanshu commented 2 days ago

I want to integrate vtsls into Sublime Text. after so much of research i'm able to run vtsls but i want that when i work on some inner project on monorepo it change its typescript version according to working project.

i tried to create a workspace in VSCode and when i run select typescript version in vs code it gives me all the available typescript versions but its not giving any versions when i run same command on sublime text. any solutions for this ?

also please explain how to setup a workspace or how to use multiple typescript versions with vtsls.

yioneko commented 2 days ago

Note that where the workspace located is determined by the client during the initialization phase, so I could not well learn what happened in your case. The workspace version of typescript is searched relative to the workspace folder provided by the client, so maybe the client didn't send your expected place of workspace folder to the server.

You can try to open the workspace root folder first before opening files in sublime, then sublime lsp will corectly send the opened folder to server. This is just from my testing, not sure it will work for everyone.

Another thing you might need to learn about is that the selection result of typescript version won't be memozied in this server due to the protocol limit, which is different to VSCode. That means if you close the project and reopen it, you must trigger the popup and do selection again. Therefore, we introduce an option vtsls.autoUseWorkspaceTsdk for the case you want the server to automatically pick up the workspace version of typescript, and you might want to toggle it on in your local project.

gxanshu commented 2 days ago

What you mean by workspace folder. seems like i'm making mistake here, cause i'm just creating project-name.code-workspace file like it mentioned on VSCode docs. its was working for VSCode so i thought its right.

from workspace folder you mean .vscode code folder ?

please provide a guide how can i create a workspace and use vtsls.autoUseWorkspaceTsdk

yioneko commented 1 day ago

The workspace folder refers to a concept defined in LSP, and the client is responsible to determine it. Different clients usually use different mechanism for it, so it is expected that sublime LSP won't recognize VSCode workspace root marker *.code-workspace. You should refer to the sublime doc to learn how to create a workspace/project in editor's scope.

For custom server settings, check the sublime LSP doc (set the settings field).

gxanshu commented 1 day ago

@yioneko thanks a lot its working now. i found out that if we create a sublime project and define workspace there then vtsls show typescript version to select.

Thanks for creating this wonderful package. ❤️