6

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

guettli
  • 25,042
  • 81
  • 346
  • 663
  • Is there anything missing in the first code snippet you have send? I can't find the what is the issue with both the snippets. – Arun T Aug 28 '18 at 16:30
  • @ArunT PyCharm inserts a new-line character. This breaks it. Maybe django templates are different then pure Jinja. I don't know. – guettli Aug 29 '18 at 10:26
  • Hello @guettli, isn't that worked for you? – tanaydin Sep 13 '18 at 12:21
  • Possible duplicate of [How do I set the maximum line length in PyCharm?](https://stackoverflow.com/questions/17319422/how-do-i-set-the-maximum-line-length-in-pycharm) – tanaydin Sep 14 '18 at 08:27

1 Answers1

8

Go to

Preferences > Editor > Code Style

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

tanaydin
  • 5,171
  • 28
  • 45