Source compare with OmniStudio JSON embedded in xml

15 views
Skip to first unread message

Greg Shaw

unread,
Sep 10, 2024, 9:18:37 AMSep 10
to Illuminated Cloud Q&A
I'm not sure whether the solution to my question lives in IntelliJ or IC2.
With the advent of OmniStudio and the use of JSON embedded in the xml metadata file instead of straight up xml I'm finding it really difficult to compare the files looking for changes. Whether it is 'Compare with Server' or git compare or Local File History compare the JSON just messes it up.
Is there a way to dynamically convert the embedded JSON into a multi-line source format so that we can see the individual lines and the comparator has a fighting chance to isolate which lines have change?
I know the JSON cannot be converted and saved as a multi-line value but can it be done just for comparison purposes?
Thanks, Greg.

Scott

unread,
Sep 10, 2024, 9:28:55 AMSep 10
to Illuminated Cloud Q&A, Greg Shaw
Hi, Greg. Any of the file/folder comparison functionality is going to come from the underlying JetBrains IDE based on the provided files. So if the provided files are malformed or inconsistent, any comparison is going to be difficult. This can be the case, for example, with some metadata XML files that aren't returned by the Salesforce metadata retrieval APIs with consistent ordering.

Otherwise IC2 just tells the IDE to launch its diff tool for the project's version of the file and the retrieved version of the file. Now to be totally candid, while I love JetBrains' IDEs, I don't find their file/folder diff tools to be all that great. As a result, I immediately configure all JetBrains IDEs for an external diff tool, specifically Beyond Compare. I find that tool to have many more options for isolating the true differences in text files. The one thing that it notably lacks, even vs the JetBrains diff tool, is a true grammar-aware alignment, so changes that span multiple lines, e.g., something as simple as changing braces from end-of-line to next line (or vice versa), can result in noisy diffs. Otherwise, though, I find these types of dedicated diff tools to provide a much better signal-to-noise ratio.

There are many other options than Beyond Compare including Araxis Merge, KDiff3, Kompare, WinDiff, etc.

Now...having said all that, I don't know that using an external diff tool will help much if the issue is that the files being compared are "dense" and composition-based. In that specific case, you might actually have to extract the relevant portion of the respective files into separate editors -- I use scratch editors for this purpose -- use the language-specific formatter on them, and diff those portions explicitly. Yes, it can be a pain, but there are certainly specific situations that require such an approach.

Certainly if you have specific thoughts on how IC2 can help to automate something like this, feel free to log an enhancement request with a description of such a process in the public issue tracker and I'll be happy to take a look. The whole goal of IC2 is to help simplify Salesforce dev, so if this is a frequent and tedious issue for you, let's brainstorm a bit on specific case and see if we can come up with a solution that might work for everyone.

Regards,
Scott Wells

Greg Shaw

unread,
Sep 10, 2024, 6:08:58 PMSep 10
to Illuminated Cloud Q&A, Scott, Greg Shaw
Scott,
Thank you for your very detailed answer. I didn't really expect that the solution would live in IC2 but I was hoping that someone in the IC2 community might have a solution. Re-configuring the diff tool used by IntelliJ is something I hadn't thought of so thank you for that. I now have something new to explore!

Thanks, Greg.

Reply all
Reply to author
Forward
0 new messages