mirror of https://github.com/helix-editor/helix
perf: Do not unnecessarily call `commen::get_line_comment_token`
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>pull/12759/head
parent
aca1b0e2f0
commit
a23b0bc3a9
|
@ -3673,14 +3673,17 @@ fn open(cx: &mut Context, open: Open, comment_continuation: CommentContinuation)
|
||||||
|
|
||||||
let above_next_new_line_num = next_new_line_num.saturating_sub(1);
|
let above_next_new_line_num = next_new_line_num.saturating_sub(1);
|
||||||
|
|
||||||
let continue_comment_token = comment::get_line_comment_token(
|
let continue_comment_token = continue_comments
|
||||||
|
.then(|| {
|
||||||
|
comment::get_line_comment_token(
|
||||||
&loader,
|
&loader,
|
||||||
syntax,
|
syntax,
|
||||||
text,
|
text,
|
||||||
doc_default_tokens,
|
doc_default_tokens,
|
||||||
curr_line_num,
|
curr_line_num,
|
||||||
)
|
)
|
||||||
.filter(|_| continue_comments);
|
})
|
||||||
|
.flatten();
|
||||||
|
|
||||||
// Index to insert newlines after, as well as the char width
|
// Index to insert newlines after, as well as the char width
|
||||||
// to use to compensate for those inserted newlines.
|
// to use to compensate for those inserted newlines.
|
||||||
|
|
Loading…
Reference in New Issue