-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Source date handler improvement #824
Conversation
Signed-off-by: Liam Barry Allan <[email protected]>
Signed-off-by: Liam Barry Allan <[email protected]>
Signed-off-by: Liam Barry Allan <[email protected]>
Signed-off-by: Liam Barry Allan <[email protected]>
Signed-off-by: Liam Barry Allan <[email protected]>
Signed-off-by: Liam Barry Allan <[email protected]>
Signed-off-by: Liam Barry Allan <[email protected]>
Signed-off-by: Liam Barry Allan <[email protected]>
Signed-off-by: Liam Barry Allan <[email protected]>
Signed-off-by: Liam Barry Allan <[email protected]>
…ibmi into cleanup/sourcedates
@jkyeung A new build is available which should solve this issue. Check it out and let me know what you find. |
Signed-off-by: Liam Barry Allan <[email protected]>
Signed-off-by: Liam Barry Allan <[email protected]>
Signed-off-by: Liam Barry Allan <[email protected]>
Signed-off-by: Liam Barry Allan <[email protected]>
Signed-off-by: Liam Barry Allan <[email protected]>
Well, the good news is that I haven't been able reproduce the problem using the latest build (which is the first one with 1.5.10 listed as the version). The bad news is I haven't been able to reproduce the problem using the previous build either. Why this is bad is that I therefore cannot really establish that the new build fixed anything. And not being able to reproduce a behavior... certainly doesn't inspire confidence. So we're back to where we were yesterday, which is: I doubt this code is bug-free, but I also doubt that I can reliably find any more buggy behavior in a short time, so probably the best thing to do is just release it, and if there are any remaining bugs, at least there will be a lot more testers. |
Signed-off-by: Liam Barry Allan <[email protected]>
Signed-off-by: Liam Barry Allan <[email protected]>
@jkyeung I actually found the issue again and think I solved it this time. Try this last build and if you're still happy, then we will release. |
Yeah, I stumbled on a way to reproduce the thing I just said I couldn't reproduce, and you probably stumbled on it too. Just tried the latest build, and this time I can confirm: Couldn't reproduce the buggy behavior in the latest build, but reinstalling the previous build, I could reproduce it. So, this does make me feel better, and I'm excited for its release! |
This is truly just a comment, and not a bug report. It's interesting. I've been using the latest and greatest build, and I observed more weirdness when cutting a bunch of lines and pasting them a few lines down from where they had been. Here's before the cut: What I expected was that the 5 lines I pasted would get today's date, and everything else would stay the same. From my perspective, I moved the 5 lines marked by the blue box and didn't touch the 3 lines marked by the red box. I was dismayed at first, but then it hit me: As far as the diff algorithm is concerned, the net result of moving the blue box lines down is indistinguishable from moving the red box lines up! In this case, it chose to update the lines producing the smaller diff. In this light, I went back and looked at a previous "bug" report and saw the same thing: From my perspective, I moved line A below lines B and C; but I could just as well have moved lines B and C above line A. So, ultimately the exhibited behavior may be "correct" in some sense, but it feels kind of spooky and out of my control. And this precisely illustrates my initial doubts about a diff-based approach, rather than tracking actual user actions. When I asked "What will be diffed against what?" I guess what I was after (now that I can see it in action) is: Will you be able to treat a cut followed by a paste as two separate actions? Because it seems like the general diff approach could still produce intuitive behavior if only we could force a snapshot to be taken after a cut, and have the result of the paste diffed against that. |
OK, I've been trying to just go about my business and adjust my expectations regarding "equivalent edits". But in a particularly intricate sequence of individual user actions (delete a line, delete another nearby line, copy a different line and paste it a few lines down, copy another line and paste it on the line after that), the date behavior was just getting weirder and weirder until I couldn't reason about it anymore, even armed with the insight I expressed in my previous comment. I can produce some screenshots if you really need them, but I am getting the distinct impression that what's happening is the differ is comparing the current buffer contents against the previous saved buffer contents. So some old dates from deleted lines can be resurrected if you happen to create a new line with the same content in the right place. From a user's perspective, it is utterly bizarre. You did say, from the very early stages of tossing around the idea of using diffs, that you could compare the current buffer to the last saved buffer, and I kind of challenged you on that. I'm not sure everything I said at that time really sunk in for you, perhaps because there were multiple conversations going on at the same time. Besides completely unrelated stuff, even the conversation about source dates essentially had two concurrent threads going (one focused on the change-event scheme, the other on the diff scheme). Here is an excerpt from Ryver, starting on "Tue Aug 16 at 2:20pm" (I don't know if everyone sees their own localized time; that's just what was on my screen): John Y. Tue Aug 16 at 2:20pm Liam Barry John Y. Liam Barry John Y. Liam Barry John Y. Liam Barry John Y. John Y. Liam Barry John Y. Liam Barry So, as it stands, this PR is significantly better than what it replaces. And for relatively simple maintenance (which is typical for RPG codebases at most places, I'll bet), it works well. But for intensive editing... I don't know. My comment about contorting one's editing style had been about the change event, but it also applies to the current diff scheme, since neither captures enough information about the state of the buffer immediately before any given change. For example, what I've been doing while testing, and what I'll probably have to continue to do to be confident I'm not making the dates wonky, is to make a copy of the member I really want to work on, work on the copy in VS Code, save it, and then replicate the changes in SEU on the real member, until both versions match (aside from the dates). Perhaps if I can get into the habit of saving after every change in VS Code, then I can skip the SEU step. Or maybe use VS Code's autosave? |
@jkyeung Thanks for the feedback here. It goes a long way. I am starting to get more worried about merging this PR in, and instead should consider keeping the existing method but just adding minor improvements to that instead. At least with the existing method, it's much easier to track changes (since we track every change and don't use a diff). I will have to look into if I can just make the original stuff better. |
Signed-off-by: Liam Barry Allan <[email protected]>
I have decided to re-open this as I am more confident after finding a new way to test that the new diff based method is ok to you. When you have a member open with dates, open the command palette with F1 and search 'compare active file with saved'. This will show you a diff, but will allow you to see that the lines that have changed have the correct dates based on the diff. |
Signed-off-by: Liam Barry Allan <[email protected]>
@jkyeung Take a look at my above comment and give that a go for me. Let me know what you think. |
👋 A new build is available for this PR based on 4581933. |
@worksofliam in reference to your comment Decided to test this out. It's improved but there's still some weirdness. Simple Test:
Highlighting is good. Date codes are just wrong. Oddly enough if I exit this compare, delete my code, and add it again the dates appear. Dates are better. Highlighting is fine, it looks like it is a little confused on an existing endif; but it's not wrong there was an endif; added. The only weirdness I see is the fact the highlighted dates don't match up with the highlighting from the diff. Ideally I'd expect to see something like this where all the date and diff highlighting align. |
@Wright4i Good find and great review. I will have to see about finding that issue later this week. This source date branch is tricky to get right, but when it's right it will be great. |
So, this seems understandably stalled, but it would be great if there were some way to opt in to this source date handling, even though it's experimental. Installing from VSIX isn't hard, but the last one was for 1.5.10, and as of this writing, the released version is 1.5.23. Obviously the most user-friendly way would be some kind of setting/configuration in the released extension that enables this. I don't know how difficult it would be to have two selectable source date handlers in the same extension. Some other alternatives that I can think of, with varying levels of annoyingness for either the extension maintainer or users or both:
What might be the least annoying of all, for both maintainer and users, is to just go ahead and merge this. Right now, as I see it, the released source date handling is not producing Now, I should say that it's possible that my editing style and way of using VS Code is incredibly different than most other people, and perhaps there are plenty of Code for i users that have source dates turned on and are reasonably happy with it. If that's the case, then I guess merging this may be risky. But in its current state, I cannot really use the release version of Code for i except as an occasional read-only source browser. |
@jkyeung Sorry that it has stalled. I will do two things:
Liam |
Signed-off-by: Liam Barry Allan <[email protected]>
Signed-off-by: Liam Barry Allan <[email protected]>
Signed-off-by: Liam Barry Allan <[email protected]>
👋 A new build is available for this PR based on 7bda55c. |
If I had known it was not a big deal to have both source date schemes in production, I would have suggested it way earlier! 😀:tada: |
Changes
Closes #819 and #279.
To test
Checklist
console.log
s I added