
On 18/12/2022 05.07, emil@emilstenstrom.se wrote:
I'm the maintainer of a small django library called django-components. I've run into a problem that I have a language-level solution (tagged strings) to, that I think would benefit the wider python community.
*Problem* ...
Seems simple enough, right? The problem is: There's no syntax highlighting in my code editor for the three other languages. This makes for a horrible developer experience, where you constantly have to hunt for characters inside of strings. You saw the missing quote in js_string right? :)
Is this a problem with Python, or with the tool? « Language injections Last modified: 14 December 2022 Language injections let you work with pieces of code in other languages embedded in your code. When you inject a language (such as HTML, CSS, XML, RegExp, and so on) into a string literal, you get comprehensive code assistance for editing that literal. ... » https://www.jetbrains.com/help/pycharm/using-language-injections.html Contains a specific example for Django scripters. (sadly as an image - probably wouldn't be handled by this ListServer)
If I instead use separate files, I get syntax highlighting and auto-completion for each file, because editors set language based on file type. But should I really have to choose?
In other situations where files need to be collected together, a data-archive may be used (not to be confused with any historical context, nor indeed with data-compression). Might a wrapper around such of PSL's services help to both keep everything together, and yet enable separate editing format-recognition? « Data Compression and Archiving The modules described in this chapter support data compression with the zlib, gzip, bzip2 and lzma algorithms, and the creation of ZIP- and tar-format archives. ... » https://docs.python.org/3/library/archiving.html Disclaimer: JetBrains sponsors our PUG with monthly prizes, eg PyCharm. -- Regards, =dn