Zulip Chat Archive
Stream: lean4
Topic: Errors from widgets
Joachim Breitner (Nov 16 2022 at 17:06):
I’m playing around with writing widgets, and my JS code is certainly buggy. But where would error messages or exceptions or output from console.log
be shown in VSCode? I see nothing in Problems, Output or Debug Console.
(Pinging @Edward Ayers who just ran to his bus, but no hurry, I’m wrapping up for today and will tackle that tomorrow.)
Wojciech Nawrocki (Nov 16 2022 at 17:13):
@Joachim Breitner they will show up when you Open Webview Developer Tools
Edward Ayers (Nov 16 2022 at 17:22):
Ctrl+Shift+P and then type "webview developer tools", there is also a debugger (which you can trigger with the debugger;
keyword.)
Joachim Breitner (Nov 16 2022 at 19:24):
Spot on, thanks!
Taro Naoi (Nov 16 2022 at 19:25):
Speaking of devtools, does anyone know how to integrate React devtools into the devtools provided by VSCode?
Taro Naoi (Nov 16 2022 at 19:27):
Tried a couple approaches, but nothing has worked so far. Currently thinking of using something like this as a way to check for re-renders instead of React devtools: https://github.com/welldone-software/why-did-you-render.
Wojciech Nawrocki (Nov 16 2022 at 22:05):
Taro Naoi said:
Speaking of devtools, does anyone know how to integrate React devtools into the devtools provided by VSCode?
I was able to get React devtools to work in the Lean4 infoview by injecting the <script>
tag that React devtools requires into the infoview html in the vscode-lean4
extension and then rebuilding the extension. It would be cool if it worked without that much fiddling though.
Taro Naoi (Nov 16 2022 at 22:21):
Nice! Was the <script>
injection in the string returned by initialHtml
in infoview.ts
? Also, did you have to install the react-devtools
package via npm?
Taro Naoi (Nov 16 2022 at 22:23):
I think I tried something like that, but because the infoview is embedded in an <iframe>
I don't think it was being picked up by devtools.
Wojciech Nawrocki (Nov 16 2022 at 22:35):
Taro Naoi said:
Nice! Was the
<script>
injection in the string returned byinitialHtml
ininfoview.ts
? Also, did you have to install thereact-devtools
package via npm?
Yes exactly, and yes. You also need to run devtools on the command line as their readme indicates.
Taro Naoi (Nov 16 2022 at 22:44):
Hmmm, not sure why it wasn't working, but if I had to guess, it's because I was running stuff in the windows subsystem for linux and devtools doesn't have access to whatever is running outside of the subsystem. I'll try testing it in a different environment to see if I can get it working. Thanks for the help!
Last updated: Dec 20 2023 at 11:08 UTC