Skip to content
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

TypeScrip: Support forward commands between ts plugin and ts server. #146879

Closed
Kingwl opened this issue Apr 6, 2022 · 6 comments
Closed

TypeScrip: Support forward commands between ts plugin and ts server. #146879

Kingwl opened this issue Apr 6, 2022 · 6 comments
Assignees

Comments

@Kingwl
Copy link
Contributor

Kingwl commented Apr 6, 2022

We have issues: #119489 and PRs: #129382, #146608

And in the ts side. There's already implemented add custom handler in ts plugin via microsoft/TypeScript#44291.

I think It's better to register a builtin command such as forwardTsServer or others.
And with that, we can shell command in our own vscode extension to send some command into tsserver. And handle the command in ts plugin.
In this way, we can share the current ts program instance rather than create a new tsserver. And we can avoid tons of config/setup for the new tsserver which nearly no one can do that.

image

@Kingwl
Copy link
Contributor Author

Kingwl commented Apr 6, 2022

@mjbvz
Copy link
Collaborator

mjbvz commented Apr 6, 2022

@Kingwl For inline values, I assumed that we were going to add this functionality to VS Code's built-in TypeScript extension. Were you planning this ship this as a separate extension instead? Or do you have additional use cases for allowing a VS Code extension talk directly to a TS Server plugin?

@Kingwl
Copy link
Contributor Author

Kingwl commented Apr 7, 2022

For inline values, I assumed that we were going to add this functionality to VS Code's built-in TypeScript extension. Were you planning this ship this as a separate extension instead?

I'm ok with both of them.

Or do you have additional use cases for allowing a VS Code extension talk directly to a TS Server plugin?

Basically, it's like this one: Do something what VSCode builtin extension does not implemented yet.
For example, inline completions support(before VSCode's and TypeScript support), inlay hints preview (before VSCode's support), code lens (using type informations), or some other standard lsp features who TypeScript does not provided yet.

For developers, It's more powerful for TypeScript and VSCode's integration.

And there's also a additional gift for VSCode's team and TypeScript team is: preview / early access editor features by provide some offical VSCode's extension. rather than follow the release schedule.

@Kingwl Kingwl changed the title TypeScript extension: Support forward commands between tsplugin and ts server. TypeScrip: Support forward commands between tsplugin and ts server. Apr 7, 2022
@Kingwl Kingwl changed the title TypeScrip: Support forward commands between tsplugin and ts server. TypeScrip: Support forward commands between ts plugin and ts server. Apr 7, 2022
@mjbvz
Copy link
Collaborator

mjbvz commented Apr 7, 2022

Thanks for the details.

I think we inline values support should be built into VS Code. However I can see how this might be useful for other extensions, although we should probably hold off on adding this until we have more concrete use cases

When I discussed this with the TS team, we also had a few concerns:

  • We want to prevent extensions from corrupting the TS server's state

    We likely want want to block any standard tsserver commands that could modify the server state, such as updateOpene

  • How does an extension know if a custom command is available or not? (basically, how do you tell if the TS Server plugin is loaded?)

    Do we just let extensions make the request and have it fail? Do we also need some way where extensions can tell us the minimum TS version they require?

  • For debugging and diagnostic purposes, we should include a flag that lets us tell if a command comes from VS Code or from an extension

Anything I missed from our discussion @DanielRosenwasser?

@Kingwl
Copy link
Contributor Author

Kingwl commented Apr 8, 2022

Well... I just realized that we can start a tcp/websocket between ts plugin and vscode extensions.

So this feature request will not be required.

@Kingwl Kingwl closed this as completed Apr 8, 2022
@Kingwl
Copy link
Contributor Author

Kingwl commented Apr 14, 2022

preview / early access editor features by provide some offical VSCode's extension. rather than follow the release schedule.

For example:
screen

We can support some features what TypeScript/VSCode extension doesn't supported yet!
Repo: https://github.com/Kingwl/power-ts-plugin

@github-actions github-actions bot locked and limited conversation to collaborators May 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants