harper icon indicating copy to clipboard operation
harper copied to clipboard

Harper thinks a `typst` function call is a sentence

Open seffradev opened this issue 1 year ago • 4 comments

Description

I don't know if this counts as a false positive or a bug so please correct me.

I use Typst and Harper for my thesis, which leads to me having the following in a Typst-file. The excerpt begins on line 1 (see provided screenshot). On thesis.with(, on line 3, Harper declares thesis.typ|3 col 8 note| This sentence is 84 words long though I'd call it a function call with separate strings that should count as separate sentences.

Is it only flagging a non-error or is a spurious fix also suggested?

Harper is not suggesting any fixes.

Screenshots

If applicable, add screenshots to help explain the false positive.

Image

seffradev avatar Apr 29 '25 12:04 seffradev

@grantlemons, any insight?

elijah-potter avatar Apr 29 '25 19:04 elijah-potter

pub(crate) fn is_sentence_terminator(&self) -> bool {
    match self {
        TokenKind::Punctuation(punct) => [
            Punctuation::Period,
            Punctuation::Bang,
            Punctuation::Question,
        ]
        .contains(punct),
        TokenKind::ParagraphBreak => true,
        _ => false,
    }
}

I think it may be a lack of ParagraphBreaks. Most of those are lexed to Unlintable.

grantlemons avatar Apr 29 '25 20:04 grantlemons

I'm not sure how same this is, but:

#math.lr(size: 1em)
#show: rect.with()
#set math.lr(size: 1em)

Image

I guess it can detect mistakes in function names, if it does, but it should ignore stuff from std.

Andrew15-5 avatar Jun 09 '25 15:06 Andrew15-5

I think it may be a lack of ParagraphBreaks. Most of those are lexed to Unlintable.

What needs to happen to get this fixed?

elijah-potter avatar Jun 09 '25 17:06 elijah-potter