Feature request: When saving a file to choose if we want to keep the tabs/newline characters (i.e. v5.1.0) or not (i.e. v6.0.0).

76 views
Skip to first unread message

Vasileios Pothos

unread,
Sep 18, 2023, 11:00:58 AM9/18/23
to StarUML
Hi.

I noticed that In the version 6.0.0 when saving a file, the tabs & new-line characters are now not used anymore (thus all the file is 1 line of text). That's good regarding the size of the file (I noticed a significant file size reduction in some large model files I had). However personally I would prefer to save with the new-line characters, or be able to do that on-demand, when for instance I want to manually edit the JSON file in order to merge diagrams/models from different development branches (on git) over the same file [exporting and later importing fragments, alters the unique ids of the elements thus it's a no go for me]. Or if I need to use git-diff to see what really has been altered.

There are workarounds for this, like opening the .mdj files as JSON from an editor, and apply an auto-format function to add the tabs and newlines. These can be now stored, edited manually as required and loaded without problem by StarUML from what I've tested (this is how I do it currently).

However I would find it very useful to be able to have the option if we want to keep the tabs/newlines (v5.1.0 behavior) or discard them (v6.0.0 behavior). This could be an option in the general preferences, or an on-demand implementation like a checkbox option in the "File->Save As..." window.




StarUML

unread,
Sep 18, 2023, 9:06:25 PM9/18/23
to StarUML
Hi,

As you know, we removed white spaces in mdj file to reduce the size of the file.

We strongly discourage to edit directly inside the .mdj file, it is very dangerous and you may loose the entire content if there some fault in file format.

Nevertheless, If you need, we recommend to use JSON formatter/prettier.

Thank you,
StarUML Team

2023년 9월 19일 화요일 오전 12시 0분 58초 UTC+9에 vasileio...@gmail.com님이 작성:

Anil Krishnan

unread,
Sep 22, 2023, 10:26:22 AM9/22/23
to StarUML
Hi

We are a 4 member team. We are experiencing a lot git merge conflicts after 6.0.

Our model file is medium sized. As part of design/development, we update different parts (e.g. classes in the class diagram) and use git to commit changes.

In 5.0 this process used to work, as changes were spread across lines and git could track this well.
In 6.0 all these changes appear on one line, and git has a limit to how much it can merge changes in a line leading to merge conflicts.

I understand the aspect of size reduction introduced in 6.x, but can you please consider adding a setting, that at least keeps line breaks

Attaching some figures FYR (design.mdj is the model file and it has a size of 4.1M)

% ls -lh design/design.mdj
-rw-r--r--@ 1 anilk  staff   4.1M Sep 22 18:21 design/design.mdj

# Option 1 - format keeping tabs and line breaks
% python3 -m json.tool design/design.mdj design/design.mdj

% ls -lh design/design.mdj
-rw-r--r--@ 1 anilk  staff    20M Sep 22 18:29 design/design.mdj

# Option 2 - format keeping line breaks only
% python3 -m json.tool --indent 0 design/design.mdj design/design.mdj

% ls -lh design/design.mdj
-rw-r--r--@ 1 anilk  staff   4.6M Sep 22 19:12 design/design.mdj


Looking at option 1, I agree that there is significant savings in size when compacting the model file - 4.1M vs 20M, but we could also consider option 2 - keeping line breaks only which increases the size to 4.6M. This is small (12%) increase in size but on the plus side, git works well like before over changes spread across multiple lines leading to minimal conflicts.

Would you please consider adding a setting to enable this behavior?

Thanks,
Anil

StarUML

unread,
Sep 22, 2023, 9:31:27 PM9/22/23
to StarUML
Hi Anil,

Thank you for your feedback. The issue has been posted in the our issue tracking system.
We have identified this issue that could be problematic in git. We will consider maintaining line breaks.

Thanks,
StarUML Team
2023년 9월 22일 금요일 오후 11시 26분 22초 UTC+9에 an...@enable-technologies.com님이 작성:

StarUML

unread,
Mar 11, 2024, 3:56:29 AMMar 11
to StarUML
Now resolved in v6.1.0 release.

Anil Krishnan

unread,
Mar 11, 2024, 7:53:08 AMMar 11
to StarUML
Hi, thanks for the update. After the update, I notice that you are adding tabs as well, leading to increased size of mdj file. Is this intentional? because the whole premise of your earlier change (in 6.0.0) was to reduce the overall file size.

Thanks, 
Anil


StarUML

unread,
Mar 11, 2024, 9:29:18 PMMar 11
to StarUML
Yes, it's better to make it readable rather than just adding a new line.

2024년 3월 11일 월요일 오후 8시 53분 8초 UTC+9에 an...@enable-technologies.com님이 작성:
Reply all
Reply to author
Forward
0 new messages