Repository navigation
Conversation
|
@bobcozzi you'll need to clean up that PR before it gets reviewed.
The Please clean it up so only what's related to the PR can be reviewed. Thanks! |
2ec1c91 to
e2bf551
Compare
|
PR cleaned up - all unrelated files and changes have been removed:
Branch now contains only the two main features:
All unit tests pass (7/7) |
|
Okay, left it in draft mode, but it is really ready to be test. Just don't have time today to do more testing... will get to it later this weekend, likely. |
|
Thanks @bobcozzi for giving a shot at the Besides, the Any second opinion @codefori/core ? |
To be honest, I haven't looked at the PR. |
|
The goal is to have one that works well in all contexts. The "new" Save/Save As simply replace the existing/original save method. Once you guys actually look at it, we can decide to include it and for compatibility I have made it optional via a setting. So users have to turn it on to enable it. Why? So we don't just push out a replacement that isn't thoroughly tested. When users say 'Hey we have a 75,000 line rpg that isn't saving, we say "Turn on Use Mapepire Save" and it'll suddenly start working for them. |
|
In my view, "Copy" should make a copy of the existing unsaved source member on the IBM i host. Save As... should save the currently open member with edits to a target source member. Likely when Liam added Change Dates, the Save As feature wasn't taken into account. |
SummaryThis change aligns the native Save As flow with the existing Mapepire/SQL-backed source member save path when
This keeps Save As consistent with the SQL-based save behavior instead of bypassing it. Related noteThe extension's "Copy member" function is a separate feature from this Save As work. If the team wants to incorporate it later, it could be added as a follow-up enhancement, but it is not required for this change. |
|
This change introduces the SQL/Mapepire-based source member save flow and ensures the native Save As path and new member context-menu Save As are wired into it. The latest commit routes the native Save As behavior with the new SQL-based save as implementation instead of bypassing it. The original "Copy Member" action is unchanged as copying a host member should not copy the open edited file; it should copy whatever is on the host. Note that the entire PR is conditioned on setting |
|
This PR connects the native Save As flow to the new Mapepire/SQL-based source-member save path introduced here, so the target member preserves the expected source-date metadata when a member is created or saved as a copy. The existing Copy member command remains a separate feature from this work; it is not part of the native Save As behavior and could still be considered later if the team wants to align the two capabilities. |
In addition to routing the legacy (built-in) save as to the new mapepire save as, I also addressed your concerns for the test cases. |
From what I tested so far, I am getting the same impression. It is essentially the same (or similar) behavior to copy but with a UI. I also feel that this is unnecessary and kinda a hack around the fact that VS Code's native In my opinion, the simplest solution around all of this is to drop the new
Can we modify this prompt to ask whether to copy the original or copy the version with changes? In this way, we essentially cover both scenarios. As a side note on the topic of webviews, while custom UIs are nice and have their place for complex features, I think we should always try to make use of native VS Code UI features when possible (quick pick, info messages, input boxes, etc, etc.). As per, VS Code's guidelines, it also recommends to "Only use webviews when absolutely necessary". While this is just a guideline and we can do whatever we like, I also lean towards this when possible to minimize introducing new UI unnecessarily. Just my thought on this and I'm open to hearing other people's thoughts on this as well. In regards to some of the other changes in this PR...
Another side note, when possible, can we try to scope out these PRs and limit them to one feature/fix per PR? Introducing multiple features in a single PR ends up resulting in a lot of file changes that become hard to review. Several scoped PRs is much easier to review and test than a single large one. In the case that one feature depends on another, you can alway just:
|
|
Are you saying the PR doesn't work for you or you don't want the ability to save large source file members (which was the origin of this PR)? Please clarify. I am also getting a bit confused between the mantra of "Only one feature per PR" and then when I do that I hear "Why two PRs? So to me, if I understand the team's code-speak: |
My comment was more just a request for clarification on what was being addressed and not that this PR doesn't work for me. Not sure if my wording was just bad 😅 So given that you mentioned it supports saving large source file members, my next question is whether this a matter of improving performance or did saving large source file members just not work before?
I'm not sure when "Why don't you combine them into one PR?" was mentioned, but I personally have always been in the boat of scoping PRs to a single feature/fix when possible. Has nothing to do with whether we want the feature or not. I have also opened plenty of PRs that have covered multiple features in one as well, but I try my best not to. I was just sharing my thoughts and suggestions on how to make code reviews easier. @codefori/core Curious what others prefer? |
|
You nailed the Save As date issues @bobcozzi. Since the active editor is always the one Save As is run from, that's reliable. Good thinking! (Hopefully that was you and not the AI thinking for you 😄) The new save method seems to work too. That's good. But before I review the code though, I'd request you remove these bits:
Why: that prompt doesn't serve any purpose and stands out with the rest of the UI. The new save method and Save As fix work as intended and that's what I would like to focus on. And after a while, I hope to get rid of the current date-preserving save method and make the one from this PR the only save method.
Come on @bobcozzi, you know better than being judgemental. And sadly, yes, you saw it coming: "it depends". For example here, why craming the Save As fix into this PR and make it work only with the improved save method, since it would work the same with the current save method? What was the primary intent?
It goes beyond a binary "me likey/me no likey" rule 😉 |
Custom member prompt. I can hide it, but I still prefer it to the built-in "prompt" line. I think most RPG developers would too. I will remove the original test case for that prompt, however. |
The code-for-ibmi.testSourceMemberPrompt command was a development scaffold for the custom source member prompt. The prompt is now wired to the live Save As flow, so the test command, its keybinding, and its registration are no longer needed.
The 'Copy' suffix on the save-as staging helpers read as though they were related to the host-based Copy... member command (CPYSRCF), which is a separate feature. Renamed to plain Save As terms to avoid the confusion: prepareSourceMemberSaveAsCopy -> prepareSourceMemberSaveAs consumeSourceMemberSaveAsCopy -> consumeSourceMemberSaveAs prepareNativeSaveAsSourceDateCopy -> prepareNativeSaveAsSourceDates SaveAsCopyEntry -> SaveAsEntry SAVE_AS_COPY_* -> SAVE_AS_* No behavior change.
- Send the staging INSERT through the mapepire server's JDBC batch path (single-row VALUES (?,?,?) with a 2D bindings array) instead of a multi-row VALUES block. mapepire-server 2.3.6's JT400 driver throws 07006 NumberFormatException when deriving parameter metadata for multi-row VALUES against DDS-described zoned-decimal columns. - Add explicit cast(? as numeric(...)) for SRCSEQ/SRCDAT so parameter types come from the statement text, not table metadata derivation. - Log the SQLSTATE, message, and first-row preview when a batch fails so future failures are diagnosable from the output log. Verified against mapepire-server 2.3.5 and 2.3.6.
|
Updates pushed addressing the latest issues: Removed
Renamed
Fixed: Mapepire batch insert failing against mapepire-server 2.3.6
Still under discussion
|
@bobcozzi I still vote for removing the prompt and the command (remove it, don't comment it). I see where it's coming from, but:
So, better remove it now and proceed with the improved save and Save As fix reviewed. |
bobcozzi
left a comment
There was a problem hiding this comment.
- I don't quite understand the need for "Secondary Feature: Local source save archive". What exactly is the purpose of this feature and what use case is this for? I am not sure users will like the sound of making local copies of their source (which may be proprietary). While this can be the reason for making this a customizable setting, personally I would not want to overly complicate users with too many customizable settings for the simple act of reading and writing to files (unless there is a reason to).
- For the main feature "SQL-based source member save using Mapepire", can you also clarify what exactly wasn't working in the existing implementation which resulted in introducing this new staging flow? In my opinion, not everything needs to be a setting meaning that whatever we decide is best for simple things like how things are saved, we should decide and pick one instead of relying on the user (unless I am again missing a reason why this should be configurable).
The Local archive is a safety protocol to avoid anyone loosing their source code during save, power outage, failed connection (e.g., network failure/timeout). It just happens to also allow you to go "back in time" in a limited fashion to get that prior version before you uploaded it to the host. IIRC, I set the max archive count to something like 20 but that could be modified or even placed into a Setting. But the problem it is solving is just that--you go to save to a source member, something goes wrong, and you end up with an empty source member, which VSCODE can then re-open into the editor--updating your existing code. I did mention this to Liam during our meetup last week and he seemed to think it was a cool feature--but I don't want to speak for him.
As for the updated save itself. There was an Issue open that stated for larger source file member, there is a length (minutes) lag in the save and sometimes would fail. The solution was to use the INSERT as a Mapapire SQL statement directly rather than build up some huge source file member and potentially have it fail upstream. The new method saves a batch-at-a-time of rows until the entire source file member is saved. So now, the member size is IBM i dependent not a save mechanism limitation.
- New code-for-ibmi.sourceArchive.openSnapshotForMember command, shown directly below 'Save As...' on member items, opening the source archive picker scoped to that member's snapshots. - When the member has no snapshots, the picker search box is pre-filled with the member name so global matching kicks in immediately; clearing the box lists the full archive. - Extracted the snapshot-open flow into openSnapshotPicker, shared by the palette command (active editor) and the new context menu command. - Archive listing now logs snapshot counts and surfaces read errors in the output channel instead of failing silently.
|
New commit: Member Archive... on the member context menu (e114ba9) The local source save archive is now reachable from the Object Browser without the command palette:
Also of note: a separate one-file fix for members failing to open when SRCDTA contains NUL bytes went up as its own PR (#3510) per the one-feature-per-PR preference — not part of this PR. |
…he UI Rename the archive setting labels with a 'Source Member Save:' prefix so they read as a group directly below 'Use Mapepire for Source Member Saves' in connection settings. Setting IDs and defaults unchanged (max snapshots per member remains 25).
So to summarize: |
Per review discussion: the 'Save As...' member context menu command and the custom source member prompt webview duplicated what users already do with VS Code's built-in File > Save As, and the webview stood out from the extension's UX guidelines. Removed entirely rather than hidden: - code-for-ibmi.saveMemberAs command and its member context menu entry - code-for-ibmi.promptSourceMember API command and typings export - sourceMemberPrompt webview, its utils, and its test suite The native Save As flow continues to route through the filesystem Save As date-preservation logic (prepareNativeSaveAsSourceDates / consumeSourceMemberSaveAs in QSysFs), so dates are preserved when saving a member under a new name with the built-in Save As.
|
@sebjulliand Done — removed, not commented (fd33386):
What remains is the built-in VS Code Save As routing through the filesystem date-preservation logic (prepareNativeSaveAsSourceDates / consumeSourceMemberSaveAs in QSysFs), so dates survive File > Save As to a new member name — the part you confirmed worked. The improved save and archive features are unchanged. |
|
Thank you very much @bobcozzi 🙏🏻 |


Summary
Main Feature: SQL-based source member save using Mapepire
Save As updated:
Secondary Feature: Local source save archive
Technical Details
Mapepire SQL save flow
Archive snapshot structure
Testing
Notes