Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyCharm: Reformat code breaks django template

If I run "reformat code" PyCharm changes this line:

    {% ajax_dialog_opener url=duplicate_url|add:'?hide_messages=true' reload_on_success=False label='FoooBaar' dialog_title='Foo foo baaar' type='link'

After reformat code:

    {% ajax_dialog_opener url=duplicate_url|add:'?hide_messages=true' reload_on_success=False label='FoooBaar' dialog_title='Foo foo baaar' type='link'
    data_shortcut="mod+d" %}

But this means the new code is broken.

Is there a way to stop PyCharm from breaking above line?

Version: PyCharm community 2018.2

like image 822
guettli Avatar asked Aug 28 '18 10:08

guettli


People also ask

How do you fix an indentation in PyCharm?

Select the whole line and From the Edit Menu choose either Indent Selection or Unindent Selection. This will work on mutliple lines. Select the whole line and press tab to indent the entire line another level, or using Shift Tab to reduce the indentation of the line. You can also use this to indent or outdent mult.

Which formatter does PyCharm use?

PyCharm adheres to PEP8 rules and requirements for arranging and formatting Python code.


1 Answers

Go to

Preferences > Editor > Code Style

Change "Hard Wrap At" value to something bigger like 1000 (max).

like image 104
tanaydin Avatar answered Sep 28 '22 20:09

tanaydin