-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 Webview Views #10137
Support Webview Views #10137
Conversation
f322ac9
to
ff70576
Compare
Added API to support Webview based views contributions Signed-off-by: ChayaLau <[email protected]>
af0b1d8
to
d12ce31
Compare
@vince-fugnitto , @msujew, @colin-grant-work |
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.
The functionality looks good to me so far. The sample webview-view extension works perfectly without impacting other webview related extensions like the webview-sample. 👍
I have a few remarks on the code. Nonetheless, impressive work for being quite new to the project.
packages/plugin-ext/src/main/browser/view/plugin-view-registry.ts
Outdated
Show resolved
Hide resolved
packages/plugin-ext/src/main/browser/view/plugin-view-registry.ts
Outdated
Show resolved
Hide resolved
packages/plugin-ext/src/main/browser/webview-views/webview-views-main.ts
Outdated
Show resolved
Hide resolved
packages/plugin-ext/src/main/browser/webview-views/webview-views-main.ts
Outdated
Show resolved
Hide resolved
Hi - @msujew, |
Added API to support Webview based views contributions Signed-off-by: ChayaLau <[email protected]>
hi @msujew |
packages/plugin-ext/src/main/browser/webview-views/webview-views-main.ts
Show resolved
Hide resolved
packages/plugin-ext/src/main/browser/webview-views/webview-views-main.ts
Outdated
Show resolved
Hide resolved
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.
A first batch of comments: I think this PR could be simpler, but maybe we should just get the code in an then refactor 🤷
packages/plugin-ext/src/main/browser/webview-views/webview-views.ts
Outdated
Show resolved
Hide resolved
packages/plugin-ext/src/main/browser/webview-views/webview-views.ts
Outdated
Show resolved
Hide resolved
packages/plugin-ext/src/main/browser/webview-views/webview-views.ts
Outdated
Show resolved
Hide resolved
packages/plugin-ext/src/main/browser/webview-views/webview-views.ts
Outdated
Show resolved
Hide resolved
packages/plugin-ext/src/main/browser/webview-views/webview-views.ts
Outdated
Show resolved
Hide resolved
packages/plugin-ext/src/main/browser/webview-views/webview-views.ts
Outdated
Show resolved
Hide resolved
const view = this.views.get(viewId); | ||
if (view?.[1]?.type === PluginViewType.Webview) { | ||
const webviewWidget = this.widgetManager.getWidget(WebviewWidget.FACTORY_ID, <WebviewWidgetIdentifier>{ id: webviewId }); |
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.
Welcome content (https://code.visualstudio.com/api/references/contribution-points#contributes.viewsWelcome) is not handled for webview views. I guess the right thing to do would be to move the welcome content handling out of the tree view and into the PluginViewWidget class. The less protocol we require from the view widget, the more we can reuse.
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.
do you recommend stop working on this for now until the refactoring is done? or we should do the refactoring after all?
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.
No, it's better to get the functionality in with limitations than not to have it at all: it's just missing functionality, it does not break anything beyond the new stuff.
packages/plugin-ext/src/main/browser/webview-views/webview-views.ts
Outdated
Show resolved
Hide resolved
packages/plugin-ext/src/main/browser/webview-views/webview-views.ts
Outdated
Show resolved
Hide resolved
I'm thinking this area of the code needs some refactoring, in particular the "welcome content" support in views (which right now is tied to tree view, when it would not have to be). It's like the old joke about the englishman who wanted to go to Letterfrack: "I wouldn't start from here" ;-) |
Added API to support Webview based views contributions Signed-off-by: ChayaLau <[email protected]>
i want to try to get this merged before next release.
|
@ChayaLau I'm not sure it will be completed in time for the next release unfortunately (Thursday 28th), as there are currently limitations, and I believe CQs are still necessary:
Is there a committer at SAP that can help you register CQs? |
yes, i will ask @amiramw to help me with CQ |
|
Happy to see this feature getting implemented. I am waiting for this feature to be available in Eclipse-Che. Any update on when this can be merged and available? |
Is there anything blocking this to be merged? Can someone please let me know If I can expect this to be available in the next few releases? |
Looking at the history, I do not see major outstanding comments. It could be that reviewers have postponed a thorough review until the CQ was obtained and need to have another look. The PR currently has conflicts. Please rebase it to the latest |
@marcdumais-work Thank you for the update. @ChayaLau I am glad that you implemented this feature and looking forward to it being available. Can you please rebase this to the master branch which can help In merging this feature? |
@msujew or @vince-fugnitto I think we as reviewers kinda dropped the ball on this one. I won't be able to address this PR in the next month. Can one of you pick this one up? |
@tsmaeder I will continue with the review at the start of January 👍 |
thanks |
@ChayaLau do you mind rebasing the pull-request against the latest master? There have been conflicts since #10137 (comment) and they would need to be resolved before we can proceed with a proper review (likely the review took time since there was no activity for a while in order to rebase). |
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.
The code looks mostly good to me. I have added some minor comments.
The feature still works as expected, @ChayaLau do you mind rebasing your branch soonish?
Everything looks good to me from an achitectural viewpoint, @colin-grant-work do you have something to add?
@@ -319,6 +326,68 @@ export class PluginViewRegistry implements FrontendApplicationContribution { | |||
return toDispose; | |||
} | |||
|
|||
public async registerWebviewView(viewId: string, resolver: WebviewViewResolver): Promise<Disposable> { |
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.
Minor: methods in JavaScript/TypeScript are public by default, the public
modifier is not necessary.
await this.prepareView(view, webviewView.webview.identifier.id); | ||
} | ||
})); | ||
const unsubscribe = () => toDisposeOnDidExpandView.dispose(); |
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.
Suggestion: Rename this to dispose
. Keeps it more in line with our usual naming conventions.
let _description: string | undefined; | ||
|
||
return { | ||
webview: webview, |
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.
Nitpick:
webview: webview, | |
webview, |
dispose(): void { | ||
webview.dispose(); | ||
}, | ||
|
||
show(preserveFocus: boolean): void { | ||
webview.show(); | ||
} |
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.
Nitpick:
dispose(): void { | |
webview.dispose(); | |
}, | |
show(preserveFocus: boolean): void { | |
webview.show(); | |
} | |
dispose: webview.dispose, | |
show: webview.show |
protected getWebviewView(handle: string): WebviewView { | ||
const webviewView = this.webviewViews.get(handle); | ||
if (!webviewView) { | ||
throw new Error('unknown webview view'); |
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.
Suggestion: Add the handle to the error message to better determine what went wrong when this error actually occurs.
@ChayaLau Are you still interested in contributing this feature? |
@vince-fugnitto Yes, I think this one in particular is basically done 👍 |
Added API to support Webview based views contributions
Signed-off-by: ChayaLau [email protected]
What it does
This commit adds support to install and use webview views extensions - to be shows in the views - side panel
as described in the issue:
#8740
How to test
install the VSCode webview-view-sample extension.
go to the explorer side panel menu and click the button
the list of views should include the
calico colors
titleexpand the view -> expected results - the webview should appear presenting the webview view contribution.
Review checklist
Reminder for reviewers