-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Support 'logUri' and 'extension' (partially) to PluginContext #10650
Support 'logUri' and 'extension' (partially) to PluginContext #10650
Conversation
- Ensure 'logUri' and 'extension' property are present in context - 'extension' currently has always theia.Plugin type, even in vscode Fixes #10033
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you clarify your question about the plugin type a bit? Am I correct that you'd like to use the asVsCodeExtension
converter in the plugin-manager.ts
file when you build the context for the plugin, if the plugin is in fact a VSCode plugin?
My inclination would be to just add the fields that asVsCodeExtension
adds anyway, since they're unlikely to do any harm to a plugin that isn't expecting them, but perhaps others have better ideas.
@colin-grant-work Thank you for your fast reply! Yes, exactly, the plugin manager also needs to be aware of the additional properties that were added to the Theia plugin so that it can also be used as a VSCode extension. Previously this was only done for the vscode API calls (vscode.extensions.all, vscode.extensions.getExtension) but we need the same conversion for the 'extension' property used in the PluginContext (or ExtensionContext in VSCode). As you suggested, I now simply moved the additional properties directly into the class so that it automatically covers all aspects of a Theia plugin and a VSCode extension. This also made the conversion within the vscode.extension.* calls unnecessary. With that everything seems to work for me: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me and better satisfies the expectations of VSCode plugins.
…e-theia#10650) * Support 'logUri' and 'extension' (partially) to PluginContext - Ensure 'logUri' and 'extension' property are present in context - 'extension' currently has always theia.Plugin type, even in vscode Fixes eclipse-theia#10033 * Move VSCode extension mapping directly into Plugin creation * Fix conversion with correct fields * Incorporate feedback about naming and exports
Fixes #10033
What it does
How to test
Review checklist
Reminder for reviewers
** To Note: ** This PR adds the 'extension' property but it is currently ALWAYS of type TheiaPlugin even if the plugin is a VS Code extension. There is already a conversion available in the VS Code package for the 'vscode.extensions.getExtension' API. However, I did not find the proper way to use that functionality in the plugin manager as it probably requires some RPC calls. So if someone could point me in the right direction, I could also have a look at this. Until then, the custom VS Code extension properties (extensionPath, extensionUri and extensionKind) are not available through the context. However, they are available if you get the extension through vscode.extensions.getExtension.