antonWetzel / typst-languagetool

LanguageTool Integration for Typst for spell and grammer check
MIT License
36 stars 9 forks source link

False positive spelling mistake when using table #9

Closed Andrew15-5 closed 7 months ago

Andrew15-5 commented 7 months ago

The example from the https://typst.app/docs/guides/table-guide/#merge-cells gives a false error:

Possible spelling mistake found. [MORFOLOGIK_RULE_EN_US]
code ```typst #let ofi = [Office] #let rem = [_Remote_] #let lea = [*On leave*] #show table.cell.where(y: 0): set text( fill: white, weight: "bold", ) #table( columns: 6 * (1fr,), align: (x, y) => if x == 0 or y == 0 { left } else { center }, stroke: (x, y) => ( // Separate black cells with white strokes. left: if y == 0 and x > 0 { white } else { black }, rest: black, ), fill: (_, y) => if y == 0 { black }, table.header( [Team member], [Monday], [Tuesday], [Wednesday], [Thursday], [Friday] ), [Evelyn Archer], table.cell(colspan: 2, ofi), table.cell(colspan: 2, rem), ofi, [Lila Montgomery], table.cell(colspan: 5, lea), [Nolan Pearce], rem, table.cell(colspan: 2, ofi), rem, ofi, ) ```

image

Andrew15-5 commented 7 months ago

I quickly opened and closed this file a couple of times and the server said this at least once:

Error: RequestEncode(reqwest::Error { kind: Request, url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Ipv4(127.0.0.1)), port: Some(8081), path: "/v2/check", query: Some("data=%7B%22annotation%22%3A%5B%7B%22text%22%3A%22%22%7D%2C%7B%22markup%22%3A%22%23let+ofi+%3D+%5B%22%7D%2C%7B%22text%22%3A%22Office%22%7D%2C%7B%22markup%22%3A%22%5D%22%7D%2C%7B%22text%22%3A%22%5Cn%22%7D%2C%7B%22markup%22%3A%22%23let+rem+%3D+%5B_%22%7D%2C%7B%22text%22%3A%22Remote%22%7D%2C%7B%22markup%22%3A%22_%5D%22%7D%2C%7B%22text%22%3A%22%5Cn%22%7D%2C%7B%22markup%22%3A%22%23let+lea+%3D+%5B*%22%7D%2C%7B%22text%22%3A%22On+leave%22%7D%2C%7B%22markup%22%3A%22*%5D%22%7D%2C%7B%22interpretAs%22%3A%22%5Cn%5Cn%22%2C%22markup%22%3A%22%5Cn%5Cn%22%7D%2C%7B%22markup%22%3A%22%23show+table.cell.where%28y%3A+0%29%3A+set+text%28%5Cn++fill%3A+white%2C%5Cn++weight%3A+%5C%22bold%5C%22%2C%5Cn%29%22%7D%2C%7B%22interpretAs%22%3A%22%5Cn%5Cn%22%2C%22markup%22%3A%22%5Cn%5Cn%22%7D%2C%7B%22markup%22%3A%22%23%22%7D%2C%7B%22interpretAs%22%3A%22%22%2C%22markup%22%3A%22%22%7D%2C%7B%22markup%22%3A%22table%28%5Cn++columns%3A+6+*+%281fr%2C%29%2C%5Cn++align%3A+%28x%2C+y%29+%3D%3E+if+x+%3D%3D+0+or+y+%3D%3D+0+%7B+left+%7D+else+%7B+center+%7D%2C%5Cn++stroke%3A+%28x%2C+y%29+%3D%3E+%28%5Cn++++%2F%2F+Separate+black+cells+with+white+strokes.%5Cn++++left%3A+if+y+%3D%3D+0+and+x+%3E+0+%7B+white+%7D+else+%7B+black+%7D%2C%5Cn++++rest%3A+black%2C%5Cn++%29%2C%5Cn++fill%3A+%28_%2C+y%29+%3D%3E+if+y+%3D%3D+0+%7B+black+%7D%2C%5Cn%5Cn++table.header%28%5Cn++++%5B%22%7D%2C%7B%22text%22%3A%22Team+member%22%7D%2C%7B%22markup%22%3A%22%5D%2C%5Cn++++%5B%22%7D%2C%7B%22text%22%3A%22Monday%22%7D%2C%7B%22markup%22%3A%22%5D%2C%5Cn++++%5B%22%7D%2C%7B%22text%22%3A%22Tuesday%22%7D%2C%7B%22markup%22%3A%22%5D%2C%5Cn++++%5B%22%7D%2C%7B%22text%22%3A%22Wednesday%22%7D%2C%7B%22markup%22%3A%22%5D%2C%5Cn++++%5B%22%7D%2C%7B%22text%22%3A%22Thursday%22%7D%2C%7B%22markup%22%3A%22%5D%2C%5Cn++++%5B%22%7D%2C%7B%22text%22%3A%22Friday%22%7D%2C%7B%22markup%22%3A%22%5D%5Cn++%29%2C%5Cn++%5B%22%7D%2C%7B%22text%22%3A%22Evelyn+Archer%22%7D%2C%7B%22markup%22%3A%22%5D%22%7D%2C%7B%22interpretAs%22%3A%22%5Cn%22%2C%22markup%22%3A%22%22%7D%2C%7B%22markup%22%3A%22%2C%5Cn++++table.cell%28colspan%3A+2%2C+ofi%29%2C%5Cn++++table.cell%28colspan%3A+2%2C+rem%29%2C%5Cn++++ofi%2C%5Cn++%5B%22%7D%2C%7B%22text%22%3A%22Lila+Montgomery%22%7D%2C%7B%22markup%22%3A%22%5D%22%7D%2C%7B%22interpretAs%22%3A%22%5Cn%22%2C%22markup%22%3A%22%22%7D%2C%7B%22markup%22%3A%22%2C%5Cn++++table.cell%28colspan%3A+5%2C+lea%29%2C%5Cn++%5B%22%7D%2C%7B%22text%22%3A%22Nolan+Pearce%22%7D%2C%7B%22markup%22%3A%22%5D%22%7D%2C%7B%22interpretAs%22%3A%22%5Cn%22%2C%22markup%22%3A%22%22%7D%2C%7B%22markup%22%3A%22%2C%5Cn++++rem%2C%5Cn++++table.cell%28colspan%3A+2%2C+ofi%29%2C%5Cn++++rem%2C%5Cn++++ofi%2C%5Cn%29%22%7D%2C%7B%22interpretAs%22%3A%22%5Cn%5Cn%22%2C%22markup%22%3A%22%5Cn%5Cn%22%7D%5D%7D&language=auto"), fragment: None }, source: hyper::Error(IncompleteMessage) })
antonWetzel commented 7 months ago

I fixed the function name detection to find cell in table.cell and added a rule to insert a linebreak before and after a call to cell. I added a rule to insert linebreaks between arguements for header function calls.

This fixes the problems. I did not test alot with typst v0.11, so problems probably exist.

Andrew15-5 commented 7 months ago

Thanks!