Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>syninpyNew to Visual Studio Code? Get it now.
syninpy

syninpy

Johno Whitaker

|
41 installs
| (0) | Free
syntax highlighting for snippets within python files
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

syninpy README

Hackily adding syntax highlighting to JS snippets in python

Extension page: https://marketplace.visualstudio.com/items?itemName=JohnoWhitaker.syninpy

Warning: experimental, not tested much, use at your own risk :)

Usage

Include your snippets in the code like this to get syntax highlighting:


def python_function():
    print("Hello World")

#js
script = """
document.addEventListener('DOMContentLoaded', function() {
    var accordionItems = document.querySelectorAll('.accordion-item');

    accordionItems.forEach(function(item) {
        item.addEventListener('shown.bs.collapse', function() {
            var headerElement = this.querySelector('.accordion-header');
            var yOffset = -10; // Adjust this value to fine-tune the scroll position
            var y = headerElement.getBoundingClientRect().top + window.pageYOffset + yOffset;
            window.scrollTo({top: y, behavior: 'smooth'});
        });
    });
});
"""

def another_python_function():
    print("Hello World")

You can also end with #end-js. Note it skips the line immediately after the #js tag.

# js and # end-js now also work, for those with linters.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft