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

[tss plugin] What is configurePlugin actually do? #106567

Closed
CGQAQ opened this issue Sep 13, 2020 · 8 comments
Closed

[tss plugin] What is configurePlugin actually do? #106567

CGQAQ opened this issue Sep 13, 2020 · 8 comments
Assignees
Labels
*dev-question VS Code Extension Development Question

Comments

@CGQAQ
Copy link

CGQAQ commented Sep 13, 2020

what is configurePlugin(pluginId: string, configuration: ConfigurationField): void; from vscode.typescript-language-features actually do?
like I asked in microsoft/vscode#106465

I've changed the flag, and tsserver.log show that it is worked, but the change still didn't apply at all

@mjbvz said in #106402

configurePlugin essentially just lets you post messages to a plugin from a vs code extension. Again the specifics depend on your use case but all the tools you need should be there to enable/disable the plugin's functionality based on some configuration

I tried do this, but didn't work

code
I also tried restart tsserver by run command commands.executeCommand("typescript.restartTsServer"); and reload project by
commands.executeCommand("typescript.reloadProjects"); after configurePlugin, didn't work either

@vscodebot
Copy link

vscodebot bot commented Sep 13, 2020

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@mjbvz
Copy link
Collaborator

mjbvz commented Sep 13, 2020

What isn't working? If you have a minimal example I can take a look but I can't debug your complete extension/plugin.

As a reference, the tslint extension/plugin is using this api without issue:

@mjbvz mjbvz added the info-needed Issue requires more information from poster label Sep 13, 2020
@CGQAQ
Copy link
Author

CGQAQ commented Sep 13, 2020

@mjbvz this one doesn't work, you can see in the tsserver.log, the return value has changed, but types declared in the d.ts file didn't show up in IntelliSense

@mjbvz
Copy link
Collaborator

mjbvz commented Sep 13, 2020

The server log shows that configure plugin is working (at least from the server's point of view).

Again configurePlugin just sends a json serializable object from VS Code to the extension. It does not have anything to do with d.ts loading. That's all up to your plugin

@CGQAQ
Copy link
Author

CGQAQ commented Sep 13, 2020

The server log shows that configure plugin is working (at least from the server's point of view).

Again configurePlugin just sends a json serializable object from VS Code to the extension. It does not have anything to do with d.ts loading. That's all up to your plugin

but this is back to the microsoft/TypeScript#40503 again, how to load it. I also tried restart tsserver by run command commands.executeCommand("typescript.restartTsServer"); and reload project by
commands.executeCommand("typescript.reloadProjects"); after configurePlugin, didn't work either. the return value of getScriptNames has changed! why tssever don't pick d.ts up?

@CGQAQ
Copy link
Author

CGQAQ commented Sep 13, 2020

How the plugin tell tssever to change files in the project(add/remove files from project), I'm so confused.

getProgram and getScriptFileNames, there is no documentation at all

@mjbvz
Copy link
Collaborator

mjbvz commented Sep 13, 2020

There is no api for that, your plugin needs to implement it. I suggest you wait for someone on the TS team to respond to microsoft/TypeScript#40503

I'm closing this issue since there does not appear to be a bug. Please follow up in the TypeScript issue.

(also typescript.restartTsServer and typescript.reloadProjectsare commands a user can trigger if they get into a bad state. Your extension/plugin should not need to use them and we do not guarantee they will work for extensions)

@mjbvz mjbvz closed this as completed Sep 13, 2020
@mjbvz mjbvz added *dev-question VS Code Extension Development Question and removed info-needed Issue requires more information from poster labels Sep 13, 2020
@CGQAQ
Copy link
Author

CGQAQ commented Sep 13, 2020

There is no api for that, your plugin needs to implement it.

@mjbvz can you tell me which API should I use to implement it

@github-actions github-actions bot locked and limited conversation to collaborators Oct 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*dev-question VS Code Extension Development Question
Projects
None yet
Development

No branches or pull requests

2 participants