question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Chrome Dev Tools Scope

See original GitHub issue

Hello,

Firstly, thank you for this amazing tool. CodeSwing is a part of my daily development workflow. I use it all the time — especially when building-up Tailwind components and fiddling with all of those utility classes.

At one point in time, it seemed like the Chrome DevTools integration was working really well, but it now seems that when I use them, the DevTools scope is set to top — giving me VSCode’s Electron context instead of the CodeSwing preview window. If I adjust this, it retains for a moment, but then jumps back to the top context as soon as I save my swing to render the next preview.

Is there something I’m missing or perhaps a setting I need to adjust? As this is a tool I use daily, I’m more than happy to troubleshoot and open a pull request, but before I start investigating, I figured I should first see if there’s an easy fix.

Thanks!

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
stephancasascommented, Jul 26, 2021

@egamma, after installing the extension, run the CodeSwing: New Swing... activity from the command palette:

05d2193d0667442b955e675a72b08fc3

Then, choose one of the pre-defined templates. Here, I’m using the HTML/CSS/JS template:

84ffd54980294832ac8671dc5934374c

Next, use either the toolbar shortcut or the command palette to show developer tools, and use the context selector to choose the CodeSwing document/iframe component:

db9852dbf29d4efca2e4f9b1194dd601


That last step is where the trouble begins. Traditionally, the inspector would immediately focus on the CodeSwing doc, and remain focused. However, as the CodeSwing doc is saved/updated, focus is lost, and the context of the console/devtools returns to the top scope.

Indeed, if we add some console.log() statements to script.js, and save/execute (with the preserve log option enabled), we can observe that the log messages originate from a different context each time.

0reactions
mjbvzcommented, Aug 12, 2021

We changed the behavior of Developer: Open webview developer tools when we moved to use standard iframes to host the webview. The command is intended to be used by developers who are building webview extension and we believe that using a single unified developer tools makes sense for that use case: https://github.com/microsoft/vscode/issues/129437#issuecomment-897889739

It doesn’t seem like we can easily go back to the old behavior. I think connecting the edge dev tools sounds like a better approach for this use case, as presumably you could also then hide all the webview implementation details from users so that they just see their code

Read more comments on GitHub >

github_iconTop Results From Across the Web

Debug JavaScript - Chrome Developers
DevTools provides a lot of tools for examining variable values. # Method 1: The Scope pane. When you're paused on a line of...
Read more >
Learn JavaScript function scope - Chrome DevTools - Dev Tips
Chrome DevTools - Learn more about JavaScript function scope with this inspection technique.
Read more >
How do I search through scope variables in Google Chrome ...
Navigate to the console tab and start typing, the console will autocomplete variables within scope. For more information about Chrome DevTools ...
Read more >
Inspect Scope During a Breakpoint
In Chrome, when your Javascript execution is paused during a breakpoint, you can interact with and inspect all variables and objects in the...
Read more >
Store as Global | Down and Dirty with Chrome Developer Tools
This is convenient in debugging an application where you want to continuously inspect the contents of an object as a global variable. Right...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found