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

fix: plugin doesn't show welcome view (#12458) #12466

Closed

Conversation

helloworldmygithub
Copy link
Contributor

@helloworldmygithub helloworldmygithub commented Apr 27, 2023

What it does

Closes: #12458
The pull-request checks the view data provider after the start of a plugin to show the plugin's welcome view.

How to test

  1. start theia
  2. download the plugin installation package postcode 1.3.9)
  3. install the plugin using isntall from vsix...

Before:
image

After:
image

Review checklist

Reminder for reviewers

The commit check view data provider after start plugin
to show plugin welcom view.

Signed-off-by: zhangyi <1401457589@qq.com>
@@ -303,6 +303,9 @@ export class HostedPluginSupport {
}
await this.startPlugins(contributionsByHost, toDisconnect);

// check data provider after start plugin to show welcom view
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor:

Suggested change
// check data provider after start plugin to show welcom view
// check data provider after plugin start to show welcome view

Comment on lines 783 to 805
checkViewDataProvider(): void {
for (const viewId of this.views.keys()) {
if (!this.viewDataProviders.has(viewId)) {
this.getView(viewId).then(async view => {
if (view) {
if (view.isVisible) {
await this.prepareView(view);
} else {
const toDisposeOnDidExpandView = new DisposableCollection(this.onDidExpandView(async id => {
if (id === viewId) {
unsubscribe();
await this.prepareView(view);
}
}));
const unsubscribe = () => toDisposeOnDidExpandView.dispose();
view.disposed.connect(unsubscribe);
toDisposeOnDidExpandView.push(Disposable.create(() => view.disposed.disconnect(unsubscribe)));
}
}
});
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code duplicates a lot of what registerViewDataProvider already does, I don't think it is the proper solution as is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I ask if the meaning here is that I should try to reuse code? Or should we solve the problem in a different way

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I mean that we should not have duplication, and it looks like the current solution duplicates a lot of what registerViewDataProvider already does without any clear reason as to why it does. We should find a solution which does not duplicate the code, either by seeing what can be reused once we better understand the problem, or a completely different solution if necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I understand. In Theia,widgets should be opened only when view data providers are registered, but some vscode plugins only have some welcomeViews and do not register a viewDataProvider. So I want to check if the plugin view where the welcome view is located has been registered a viewDataProvider after the plugin is launched, and if not, give a default

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your previous suggestion, but I can't find a simpler solution. I will create a new PR to remove the commit messages and wait for other results

@vince-fugnitto vince-fugnitto added the vscode issues related to VSCode compatibility label May 1, 2023
The commit remove some duplicate code.

Signed-off-by: zhangyi <1401457589@qq.com>
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
Archived in project
Development

Successfully merging this pull request may close these issues.

The default welcome view of the plugin is not displayed
2 participants