Possible to wrap code, including string literals?
Thanks to PEP8 and Guido, some members of the Python community get very excitable about code that is wider than 79 characters.
I notice that there is limited support for smart code wrapping, but it would be "pleasurable" if this support were extended.
How nice would it be to be able to automatically reformat this:
file_name = models.CharField(max_length=256,
help_text='The original filename from the source lab, as uploaded to the FTP site, '
'including any subdirectories if those exist (Note: All files will be renamed using '
'a standard format along with a unique id before being made public) String composed '
'of standard allowed filename characters (e.g. "s_1_1_sequence.txt")')
Please sign in to leave a comment.
Hello Kevin,
There are in fact options for that: Settings | Code Style | Wrapping and
Braces | Ensure right margin is not exceeded, Settings | Code Style | General
| Wrap when typing reaches right margin.
The formatter engine is currently not smart enough to perform word-by-word
reflow of multiline string literals, and I don't expect this to become supported
in the near future, but for simpler cases these should do what you need.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Summary: the formatter is not sophisticated enough yet. I'll just have to fantasize in the meantime. The option to wrap when typing reaches the right margin is slightly annoying when dealing with string literals.