Skip to main content

line_is_comment

Function line_is_comment 

Source
pub fn line_is_comment(line: &str, cfg: ReflowConfig<'_>) -> bool
Expand description

Whether line reads as a comment, by its leading marker alone.

Lexical on purpose (§9). A tree-sitter query would also know that a // inside a string literal is not a comment, and would put a parse on the typing path — which paramount #1 does not allow for accuracy that costs a frame. The inaccuracy is a comment marker inside a string, which is rare, and its consequence is one wrapped line the user can undo.