-
Notifications
You must be signed in to change notification settings - Fork 498
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
Set-VSCodeHtmlContentView not working / not adding any content to the tab body [Deprecated API] #4872
Comments
@strxngewxrld thanks for the report! These were implemented a long time ago before a major rewrite and likely don't have any tests and were broken as a result. @andyleejordan is this something to fix or deprecate? |
@JustinGrote, @andyleejordan I personally think that's a cool feature for many applications. For example this could be the foundation for a new Out-GridView like function that works inside DevContainers, remote sessions, etc. Also good for reporting or even building small applications like with WinForms back in the days. |
Unfortunately I would probably lean toward deprecating given that these have probably been broken for a long time and not reported as such until now. That said, if you can track down the last known working version of the extension that would go a long way toward us being to fix them instead. |
Perhaps the community isn't aware of this feature at all? It is only mentioned in the 1.4.0 release notes and in an older issue about the possibility of adding css/js support. I stumbled upon this feature while doing some other research. I tested a lot of extension versions with the same vs code version now and never got the feature to work: VS Code 1.85.1
VS Code 1.85.1
VS Code 1.85.1
VS Code 1.85.1
I have also looked in the source code of the extension versions, but haven't found any clue. @andyleejordan would it be possible for me to take a look into the Microsoft.PowerShell.EditorServices.VSCode.dll for further investigation? |
Thanks so much for your testing! |
|
|
Given that the apis got deprecated, and we don't have the resources to maintain in in the current state our plan is to remove the command for the time being....we would be open to a design proposal as to how to do this more maintainably...thanks! |
Correction: on closer inspection it does look like all the stuff was migrated from that deprecated API, but it has all still been broken for quite a while (my guess is another VS Code change), at least a year as I tested v2023.1.0 to the same effect (opens a "view" but it's empty). So unfortunately I think our decision stands. As it took a year (presumably, maybe a more recent VS Code update is what broke it) to come up that indicates its usage is too low for us to go about fixing. If someone wants to figure it out we'll be happy to take a PR. For now we're removing the code (which is also a massive simplification because it was the entirety of the "VSCode" module we had to build and ship with the extension). |
@strxngewxrld when that code was written, webviews didn't exist in vscode, they do now: So that would be a better route. As a perhaps future enhancement, the PS extension could facilitate starting a webview from a PowerShell script that hosts a Pode instance or whatnot as a go forward approach. |
So I'm notorious for being the one person who was using X feature in a project and now it can't be cut. I was there when this was released, and I can tell you that the underlying API was so locked down that it was borderline useless and even I couldn't get anything useful working. It's one of those things that only really worked if you were shipping an extension with static files. I'm sure some similar in theme commands could be made with the newer APIs but it'd be a completely different command shape so it becomes more of a feature request than a bug. I'd also personally say that it would likely be too much code to review and maintain even if it was graciously done as a PR by the community. This is another scenario where it would be most ideal if we instead had a way for folks to make extensions that can interact with the PSES runspace in some way. That would let the community implement their own extension to provide that functionality. This is a long term plan of mine but it's not funded atm and my free time is a little short for the time being. |
Agreed, being able to submit stuff to the PSES runspace "pipeline" and get serialized/jsonified stuff back over some kind of IPC would be great, I know the scaffolding for the plugin API is there, but all you can really do at this point is get the version of PS in use (which Pester Tests does in fact register and use so its background version matches what PSES is using) Pester tests has a library that does this very thing that I eventually plan to spin out into its own NPM package https://github.com/pester/vscode-adapter/blob/main/src/powershell.ts |
We officially removed these in PowerShell/PowerShellEditorServices#2132. |
Prerequisites
Summary
With the vscode-powershell extension comes the PowerShellEditorServices.VSCode module.
These functions were first introduced with extension version 1.4.0.
I have tried to run the snippet that is described in the release notes, but the Set-VSCodeHtmlContentView doesn't add content to the tab body, the Write-VSCodeHtmlContentView cmdlet doesn't work either.
The problem occurs on both Windows and MacOS.
PowerShell Version
Visual Studio Code Version
Version: 1.85.1 (Universal)
Extension Version
ms-vscode.powershell@v2023.8.0
Steps to Reproduce
Run the snippet described in the release notes:
Visuals
Logs
The console log in the vscode developer tools shows the following entries:
webviewElement.ts:513 An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing.
mountTo @ webviewElement.ts:513
M @ overlayWebview.ts:218
claim @ overlayWebview.ts:120
ib @ webviewEditor.ts:178
setInput @ webviewEditor.ts:169
await in setInput (async)
S @ editorPanes.ts:445
L @ editorPanes.ts:270
openEditor @ editorPanes.ts:146
(anonymous) @ editorGroupView.ts:1111
Eb @ editorGroupView.ts:1135
Db @ editorGroupView.ts:1093
openEditor @ editorGroupView.ts:999
openEditor @ editorService.ts:551
openWebview @ webviewWorkbenchService.ts:285
$createWebviewPanel @ mainThreadWebviewPanels.ts:167
S @ rpcProtocol.ts:456
Q @ rpcProtocol.ts:441
M @ rpcProtocol.ts:371
L @ rpcProtocol.ts:297
(anonymous) @ rpcProtocol.ts:161
y @ event.ts:1148
fire @ event.ts:1179
fire @ ipc.net.ts:650
x.onmessage @ localProcessExtensionHost.ts:374
index.html?id=14dfbeda-8d05-4dfe-b50a-7b8119b638b7&origin=ec1b4a75-ad64-403d-b5e6-2c1d782bc3e3&swVersion=4&extensionId=ms-vscode.powershell&platform=electron&vscode-resource-base-authority=vscode-resource.vscode-cdn.net&parentOrigin=vscode-file%3A%2F%2Fvscode-app:273
No service worker controller found. Waiting for controllerchange.
The text was updated successfully, but these errors were encountered: