Strange code reformatting issues

As of .2497 (I think, could have been .2496 or slightly earlier) I am experiencing bizarre issues with my code being reformatted and even changed upon copy-paste. The most common issue is that all indentation is removed, left-justifying everything in the pasted code block. (I have some files space-indented and some tab-indented, so perhaps the issue is related to this?).

I also just had a more critical issue where lines of code like

sDebug := sDebug + 'test'

ended up as

sDebug := ToString + 'test'

or in one case,

sDebug := ToStringyChar + 'test'

I don’t have a method ToStringyChar anywhere in my code, so I have no clue where this came from.

I was in the process of moving some files from my main project to a Shared Code project within my solution so that I can use them in a separate EUnit Test project as well, so I’m not sure if the ToStringyChar bit was after a copy-paste or if I moved the file and then re-opened my project.

Update: just reverted to .2485 and the issue is there too. I must just not have noticed it. Trying to determine which release doesn’t have this bug now

Is this after you moved or renamed a file? can you see oof this issue persists with 2499, as io fixed one (last remaining known) issue related to this, last week.

Moved or renamed which file? I haven’t moved or renamed the file I’m pasting into. I did uninstall and reinstall Water around the time this started though… Also, I’ve confirmed it’s not a new issue, since I’m all the way to .2395 and it exists there too. This definitely was not happening to me in .2395, but I’m not sure what’s changed to make it start all of a sudden…

Ok, “good”, then it’s not the issue I fixed. I’ll need concrete steps or a testcase.

2395 is oder than god, though; we’re at 2499, so that’s over a year ago. a lot changed since then.

Right, I meant it’s in 2395, 2465, 2497. But this has only recently started happening for me, and I update almost every week, so I think it’s something on my system that changed to trigger he bug, not something in Water that changed.

Ah gotcha.

We’ll need to narrow this down to the circumstances when this happens. I assume it’s not for every single paste, but just sometimes, right? Can you think of anything “special” you did between launching Water fresh and the first paste failing? Did you close/reopen a solution within the same instance? Did you anything special in the editor that sands out? Is there anything special about the particular project?

First, to make sure it’s the reformat math causing it, I assume if you turn off “reformat on paste” all is fine?

In the scenario you describe above, whats the old code, and what did you paste?

ie to get from

sDebug := sDebug + 'test'


sDebug := ToString + 'test'

, what part of the code did you select, and what wa sin the clipboard when you press space?

As background, if this is teated to similar issues we had in the past (and the “last” one (I thought) that I fixed last week, where this happened when a file was moved between folders within the project), what happens is that the “managed” text buffer (the code the compiler and IDE smarts see) gets out of sync with what the real editor sees, and contains outdated code. On Paste, the editor updates the “managed” code (which is the part that fails), asks the managed system to reformat the code, and then gets back the reformatted lines — but because the two are out of sync, it gets back OLD code that previously lived at the same line(s).

How readily does this reproduce for you?

1 Like

:man_facepalming: This was what changed on my system. I had “reformat on paste” turned off, but when I had to reinstall Water recently I did not uncheck that option.

This definitely could have been the cause here. I moved the file from my main project to a Shared project, and then again to a subfolder of the Shared project. I’m not able to reproduce it now, so this was probably the issue.

Ok, this one should have be fixed in 2499 though. :(.

I was on 2497, so it could have been. I am actually about to give it another go on 2499, so I’ll let you know whether or not it reproduces.

1 Like