abrookins / WrapToColumn

An IntelliJ plugin that wraps text
Apache License 2.0
62 stars 12 forks source link

stop paragraph wrapping also when syntax changes #24

Closed maverickwoo closed 3 years ago

maverickwoo commented 7 years ago

At present the plugin detects the end of a paragraph by an empty line. However, in Go, the documentation of a declaration (type, func, etc.) must precede the declaration with no empty line in-between for the documentation tool to work properly. So, given this input and assuming the cursor is in the comment:

// Hello prints hello world.
func Hello() {
    fmt.Println("hello world")
}

It will be wrapped as one paragraph into:

// Hello prints hello world. func Hello() { fmt.Println("hello world") }

Would it be possible to stop a paragraph when the syntax changes? This will avoid taking the code with it. Thank you!

Tested on: CLion 2017.1.1

abrookins commented 7 years ago

I've always wanted to do this, but I've never spent the time to dig deep enough into the editor code to figure out how. I'll see what I can do!

nveeser commented 7 years ago

This is exactly what I am looking for to. In fact I am using Go as well and this is an issue. Thanks.

mhsmith commented 6 years ago

The funny thing is, it detects paragraph breaks within comments, even if the "empty" line contains a comment character, but it doesn't detect the beginning or end of the comment itself.

abrookins commented 3 years ago

Should be fixed in 1.7.0, now published to the Plugins Marketplace.

mhsmith commented 3 years ago

Thanks, this is a great improvement.