Stop removing blank line

Answered

Hello,

I have a problem on GoLand (that I don't have on other PyCharm, CLion, Intellij...) I can't leave blank lines for 3 seconds (on auto save), the IDE deletes them directly which drives me crazy and I've just spent 2 hours in the settings but I can't find anything to deactivate it.

Please help me

0
8 comments

Hi,

Does it help if you disable Settings | Tools | Actions on Save | Reformat code?

2

Thanks indeed, it doesn't take away any more lines before I have time to write!

But now I have another problem, at the end when I Reformat code it changes all the tabs (4 spaces) by the tab character while everywhere in the settings I have unchecked Use tab character.

Does anyone know why?

0

Most likely you also should disable Run gofmt on code reformat via Settings | Editor | Code Style | Go | Other.

1

i need to disable removing blank lines only. not formatting all the things

0
Hi there, 

Please navigate to Settings > Editor | Code Style | Go | Tabs and Indents, then look for the option "Keep indents on empty lines". Enable this option and see if this works for you. Let me know how it goes.
0

Svetlana Erokhina  now, it is about not removing indents on an empty line

0

I need goland to stop replacing several empty lines with empty line :(

0
GoLand follows the default Go formatting rules defined by go fmt, and it automatically removes extra empty lines as part of the code formatting process. To work around that, you can try disabling Reformat On Save in Settings | Tools | Actions on Save.
0

Please sign in to leave a comment.