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

Option to always show webview developer tools while developing a custom editor extension #118919

Closed
Tyriar opened this issue Mar 14, 2021 · 6 comments
Assignees
Labels
invalid Issue identified as not relevant or not valid

Comments

@Tyriar
Copy link
Member

Tyriar commented Mar 14, 2021

I have set up this keybinding to lessen the pain of opening up the webview's devtools every time I open an image tab:

{ "key": "ctrl+shift+i",     "command": "workbench.action.webview.openDeveloperTools", "when": "activeCustomEditorId == 'luna.editor' && !isMac" },
{ "key": "cmd+alt+i",        "command": "workbench.action.webview.openDeveloperTools", "when": "activeCustomEditorId == 'luna.editor' &&isMac" },

It would be much nicer if we could have some way while developing an extension to open the webview devtools for a particular webview automatically when the webview is shown. This would probably make the most sense as part of the launch.json, eg:

    {
      "name": "Extension",
      "type": "extensionHost",
      "request": "launch",
      "runtimeExecutable": "${execPath}",
      "args": [
        "--extensionDevelopmentPath=${workspaceFolder}/..",
        "--autoOpenDevtoolsForWebview=luna.editor"
      ],
      "outFiles": [
        "${workspaceFolder}/out/**/*.js"
      ]
    },
@Tyriar
Copy link
Member Author

Tyriar commented Mar 14, 2021

@connor4312 is there a better way to do this? I see #96626, is there a way to debug extension contributed webviews within VS Code?

@connor4312
Copy link
Member

Yes, you can do this. Check out #101320

@Tyriar
Copy link
Member Author

Tyriar commented Mar 15, 2021

@connor4312 "webview.experimental.useIframes": true seems to break the extension, there's no errors in the console and debugging doesn't want to work.

Maybe I'm doing something wrong wrt debugging though, I do have a warning in launch.json still:

image

@connor4312
Copy link
Member

Set your launch type to pwa-extensionHost isntead of extensionHost

"webview.experimental.useIframes": true seems to break the extension,

cc @mjbvz

@mjbvz
Copy link
Collaborator

mjbvz commented Mar 15, 2021

Please open a separate issue if something about iframe based webviews is not working

@Tyriar Tyriar assigned Tyriar and unassigned mjbvz Mar 15, 2021
@Tyriar Tyriar added this to the March 2021 milestone Mar 15, 2021
@Tyriar Tyriar added the under-discussion Issue is under discussion for relevance, priority, approach label Mar 15, 2021
@Tyriar
Copy link
Member Author

Tyriar commented Mar 19, 2021

It works 😍 I'm having issues getting ts breakpoints bound but that's likely a sourcemaps issue on my end since js breakpoints are hit. Thanks for the help!

@Tyriar Tyriar closed this as completed Mar 19, 2021
@Tyriar Tyriar added invalid Issue identified as not relevant or not valid and removed under-discussion Issue is under discussion for relevance, priority, approach labels Mar 19, 2021
@Tyriar Tyriar removed this from the March 2021 milestone Mar 19, 2021
@github-actions github-actions bot locked and limited conversation to collaborators May 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
invalid Issue identified as not relevant or not valid
Projects
None yet
Development

No branches or pull requests

3 participants