On 18/12/2022 05.07, e...@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
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python-ideas@python.org/message/VO3EOR7FFVFVERM2MXRNC2GFR2FQHZ6J/
Code of Conduct: http://python.org/psf/codeofconduct/