dn wrote: > > 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)
I touched upon this solution in the original post. If all editors could agree to use # language=html it would be an ok solution. That API creates lots of ambiguity around to what the comment should be applied. Some examples which are non-obvious imho: ------------ "<div>" # language=html "<span> ------------ # language=html "<div>" ------------ # language=html process_html("<html>") ------------ # language=html concat_html("<html>", "<span>") ------------ > > 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). The point here is to have everything in one file, editable and syntax highlighted in that same file. I don't think this tip applies to that? _______________________________________________ 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/TX35CCY4YLJEGWCODYHTWXWDM2SSANE4/ Code of Conduct: http://python.org/psf/codeofconduct/