dfinity / vscode-motoko

Motoko language support for VS Code.
Apache License 2.0
42 stars 15 forks source link

How to disable autoformating of comments? #222

Closed atengberg closed 1 year ago

atengberg commented 1 year ago

Motokodoc will create a new line if there are two empty trailing characters of the last line, however now I've noticed the formatter trims any trailing empty space breaking intentional formatting of Motokodoc. Is there a way to disable this for Motokodoc?

If that's not clear, in code:

Legend: ∅ -> a white space


/** Some Method's Motokodoc Title...∅∅
More info such as params etc and finally end of Motokodoc. */
public func aFunMethod() : async Text { debug_show(this) }; 
Previously this would generate a tooltip like: ---------------------------------------------------------------------------------- () -> Text Some Method's Motokdoc Title.. More info such as params etc and finally end of Motokodoc.

But now it's all one run on line.

rvanasa commented 1 year ago

I see what you're saying and will look into it. Since Motoko doc comments render using standard Markdown, you could also include an additional newline in between the two lines:

/** Some Method's Motokodoc Title...

More info such as params etc and finally end of Motokodoc. */
public func aFunMethod() : async Text { debug_show(this) }; 

Alternatively:

/// Some Method's Motokodoc Title...
///
/// More info such as params etc and finally end of Motokodoc.
public func aFunMethod() : async Text { debug_show(this) }; 
atengberg commented 1 year ago

Ah, thanks--that'll work for the time being. Should I close this for now?

rvanasa commented 1 year ago

Sure, and I will keep this in mind for the formatter. Cheers!