sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
806 stars 39 forks source link

`join_lines` should discard leading comment punctuation of following lines #6170

Open FichteFoll opened 11 months ago

FichteFoll commented 11 months ago

Problem description

Similar to the wrap_lines command, the join_lines command should discard any leading comment punctuation characters on the following lines.

Preferred solution

When joining these lines, caret indicated by the pipe character:

# line| 1
# line 2

It should result in the following:

# line 1| line 2

Alternatives

None.

Additional Information

No response

sweettyler commented 11 months ago

There is no reason to discard/add leading comment punctuation. If you ask for joining, then simply just do the joining. If you want to remove the punctuation, that's another thing.

deathaxe commented 11 months ago

Sure you can, but ST is about productivity.

I often find myself frustrated with needing to manually remove leading comment punctuation, when refactoring comments

With wrap_lines adding them, it would just be consequent for opposite operation (join_lines) to remove them.

I like how plugins like Doxygen or MarkdownEditing help create a more convinient feeling when working with higher level constructs (beyound plain text) and save some nasty key strokes.

sweettyler commented 11 months ago

Productivity is not meant to breaking basic logic: in your cases you need something like "wrap_lines_and_add_leading_comment_punctuation()" and "join_lines_and_delete_leading_comment_punctuation()". Most of time we only something that simply wrap or join two lines no matter what they are.

Another bad example in ST is "replace in selection". Somehow it locks the selection after the operation. For me, it is more productive for some corner cases, but not for more general cases.

sweettyler commented 11 months ago

So if you say "join_lines", just simply join lines. If you say wrap_line(), simply wrap lines - not more, and not less.

frou commented 11 months ago

It will only happen if the characters are semantically comments according to the syntax that is active. If the Plaintext syntax is active then it will have plaintext semantics.

FichteFoll commented 11 months ago

Most of time we only something that simply wrap or join two lines no matter what they are.

I disagree (which is also why I created the ticket in the first place). I want ST to make me more productive, as deathaxe mentioned, and I have never found myself in the situation where I would have wanted to keep the comment punctuation of the following line when I join it into the current line.

I also have been using DocBlockr for years (comparable to DoxyGen), which automatically adds comment punctuation when a new line is started from a commented line, but that is a bit inconsistent across languages. Ideally ST could also do this similar to how it can do it when wrapping lines. When I know for sure I don't want the next line to be commented, I can simply use ctrl+enter.