Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬Register for the Oct 27 webinar.

Show and Tell: ClientSide Callback javascript syntax highlighting in Python Multi-line Strings

Hello All,

I have created an extension in VS code which will inject syntax highlighting for javascript within multi-line python strings.
https://marketplace.visualstudio.com/items?itemName=StevenAllenKing.python-string-syntax-highlight

When developing clientside callbacks in Dash Apps, I have found that the lack of syntax highlighting makes it difficult to troubleshoot javascript code when passing that code as a string.

Here is an example of the syntax, all you have to do is add //js at the beginning of your multi-line string and ;// at the end of the string and vscode will pick up the default javascript syntax highlighting.

Before:
image

After:
demo

Here is the link to the repo if anyone wants to contribute or finds any bugs with the extension.
https://github.com/StevenAllenKing/python-string-syntax-highlight

Thank you,
Steven King

2 Likes

This is a godsend! Thank you. Already using it, works great!

This is so great, thanks for sharing!

1 Like

Thank you Chris, I hope it’s helpful for people.

1 Like