JoystickGremlin icon indicating copy to clipboard operation
JoystickGremlin copied to clipboard

Question: Inline XML Comments (which won't dissappear after save)

Open TheGoodIdeaFairy opened this issue 2 years ago • 2 comments

I'm trying to come up with a method to add inline comments to my .xml profiles that will stick around after saves through the GUI. I've already tried the standard syntax, which admittedly doesn't give an error on loading, but is omitted from the next save. Any help is appreciated.

TheGoodIdeaFairy avatar Nov 13 '22 21:11 TheGoodIdeaFairy

Short answer, this won't work no matter what you try. The way profiles are used is:

  • Loading: XML -> Python objects
  • Saving: Python objects -> XML

As such any comments that might exist in the XML are removed as loading doesn't care about them, and the Python objects have no notion of comments.

One way around this could be to use the Description action which is just a text field that can contain whatever you want.

WhiteMagic avatar Nov 14 '22 12:11 WhiteMagic

I'd guessed this was the case, but figured it was worth a shot. I've been using Descriptions which works for most of my use cases. I was hoping for inline comments for a few niche cases, such as particularly long macros (logic flag initializers and the like). Thanks for the reply, WM.

TheGoodIdeaFairy avatar Nov 19 '22 23:11 TheGoodIdeaFairy