DrString icon indicating copy to clipboard operation
DrString copied to clipboard

No way to concatenate continuous lines

Open dduan opened this issue 4 years ago • 2 comments

When an docstring entry spans multiple lines, there's no option to join them in addition to breaking over-the-column-limit lines up to newlines. Sometimes user may prefer automatic joining behavior. For example, when authoring comments, I may add some words in one line of comment as an edit and it would be nice when this comment gets folded into multiple lines, the next line can join up with end of the last newly created lines, as opposed to stay on the next line.

dduan avatar Jan 03 '20 23:01 dduan

The biggest challenge is the formatting logic is a big hairball right now and working on it is unpleasant. I have some intuition for how to improve but it requires some energy and dedication to get it going.

dduan avatar Jan 27 '20 20:01 dduan

I can make a case for there being three desirable behaviors here:

  • Do nothing: Generate warnings, but don't change the input.
  • Column Wrap: If a line exceeds a specified width, insert a new line at the first whitespace counting backward from that width.
  • Re-render: Parse and re-render everything with CommonMark at a specified width, wiping out any soft line breaks.

If a user is sensitive to ragged edges caused by inserted newlines, then they'd be likely to want the more drastic "re-render everything to the 'one true format'" option (a la gofmt / prettier). I think any attempt to fill in ragged edges by changing downstream content will be a lot of work for something that's worse than the alternatives.

There's also a school of thought that Markdown's whitespace insensitivity can be exploited to make prose easier to read and write. For folks like me who subscribe to that, the first option (warn only) would be the most appealing.

mattt avatar Jan 30 '20 00:01 mattt