keymap-editor icon indicating copy to clipboard operation
keymap-editor copied to clipboard

Preserve whitespace for inline comments

Open nickcoutsos opened this issue 1 year ago • 0 comments

When encountering lines in the devicetree such as

foo;         // bar

this gets parsed into two nodes: property, and comment. Then two steps are followed:

  1. the preceding whitespace is removed (ignored, rather, because the comment node only starts at the //)
  2. the contents of the comment node are added to the contents of its preceding sibling node

which means the output is

foo;// bar

In order to add the comment text to the same line it is already checking that both nodes are on the same line, so this same property can be used to see how much whitespace exists between the two nodes and copy it.

nickcoutsos avatar Jul 10 '22 04:07 nickcoutsos