Closed JeremyVyska closed 3 years ago
Hi Jeremy, thanks for your idea. I'm currently on vacation and as it's pretty tricky to code while hiking, I can't make it this week :) I'll come back to you if I find some time. Best, David
Hi Jeremy, I added a new functionality for that. I'll release it shortly :) Here you can already see how it'll look like. Any suggestions? https://github.com/DavidFeldhoff/al-codeactions/blob/develop/images/RefactorValidate.gif
I love it lots! That's marvelous.
Is it possible to expand, just as it is, to be able to select a region of code, say 5 (or even 20 for the crazy) lines of field assignments, and then have the same CodeAction apply to each of 5 the 5 lines?
Don't know exactly what you mean :) So yes, if there are 20 lines directly underneath, you just have to select all of them and execute the codeAction just once. Is that what you're asking for?
Precisely.
So, given these lines, you select all three:
SomethingJournal."Posting Date" := newDate;
SomethingJournal."Document No." := newDocNo;
SomethingJournal."Amount" := newAmount;
And after one CodeAction, that selection becomes:
SomethingJournal.Validate("Posting Date",newDate);
SomethingJournal.Validate("Document No.",newDocNo);
SomethingJournal.Validate("Amount",newAmount);
That'll work :)
I just released it. Feel free to test it and close the issue afterwards :)
Super good. Though I lack permissions in GitHub's Issues to Close this.
Glad to hear !
Not sure if feasible, but would it be possible to select a large chunk of code, then have a Code Action that replaces any
Rec.Field := [something];
With
Rec.Validate(Field,[something]);