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

Support 'logUri' and 'extension' (partially) to PluginContext #10650

Merged
merged 4 commits into from
Jan 26, 2022
Merged

Support 'logUri' and 'extension' (partially) to PluginContext #10650

merged 4 commits into from
Jan 26, 2022

Conversation

martin-fleck-at
Copy link
Contributor

  • Ensure 'logUri' and 'extension' property are present in context
  • 'extension' currently has always theia.Plugin type, even in vscode

Fixes #10033

What it does

  • Add support for 'logUri' and 'extension' property to the PluginContext

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.

image

- Ensure 'logUri' and 'extension' property are present in context
- 'extension' currently has always theia.Plugin type, even in vscode

Fixes #10033
Copy link
Contributor

@colin-grant-work colin-grant-work left a 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.

@martin-fleck-at
Copy link
Contributor Author

@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:
image

Copy link
Contributor

@colin-grant-work colin-grant-work left a 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.

@JonasHelming JonasHelming merged commit 582e596 into eclipse-theia:master Jan 26, 2022
@vince-fugnitto vince-fugnitto added this to the 1.22.0 milestone Jan 27, 2022
@vince-fugnitto vince-fugnitto added the vscode issues related to VSCode compatibility label Jan 27, 2022
mcgordonite pushed a commit to ARMmbed/theia that referenced this pull request May 13, 2022
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ExtensionContext.logUri
4 participants