code-d icon indicating copy to clipboard operation
code-d copied to clipboard

Syntax error prevents from saving a file

Open webloft opened this issue 3 years ago • 3 comments

If I have a syntax error in my file I cannot save it because dfmt locks it or prevents from saving. A popup appears

Saving 'abc.d': Running 'D Programming Language (code-d)' Formatter (configure)

which is annoying since it doesn't display the error and compiler cannot tell me since the file isn't updated yet.

webloft avatar Aug 08 '21 19:08 webloft

Can you share the code that breaks this? Normally dfmt shouldn't run on save or prevent the save process from running, did you manually enable format on save?

Also it's possible if you try using serve-d nightly (change user setting d.servedReleaseChannel to nightly, then reload window) it might be fixed

WebFreak001 avatar Aug 08 '21 19:08 WebFreak001

Yes, I have enabled Format on Save.

The code can be arbitrary, it can happen if I just forget a bracket. Sometimes than the code gets just deformatted on save but sometimes it also hangs till the syntax was fixed. I see this popup sometime also if the file was updated already. It just not disappears then.

I'm on Windows. Ok, I 'll try the nightly and let you know if it happen again.

webloft avatar Aug 08 '21 19:08 webloft

So it happens again. There can be various reasons - that one that the compiler sees as fatal and cannot recover - for example:

Error: import ABC is used as a type

will trigger this.

webloft avatar Aug 30 '21 21:08 webloft