antonWetzel / typst-languagetool

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

Files with #include are not included in typst-languagetool check (v0.1.0) #27

Closed 1dancook closed 1 month ago

1dancook commented 1 month ago

The title summarizes it, but the below expands: b.typ contains errors but it is not evaluated. (Evaluating it on it's own does work).

To reproduce:

1. Create two files:

File: a.typ

haves problims.

#include ("b.typ")

File: b.typ

has a speeeling mistacke

2. Run:

typst-languagetool check --host=http://localhost --port=8081 -p a.typ

Output:

Checking Document

Checking Document

info[UPPERCASE_SENTENCE_START]: Checks that a sentence starts with an uppercase letter
 --> a.typ:1:1
  |
1 | haves problims.
  | ----- info: This sentence does not start with an uppercase letter.
  |      - help: Haves
  |
info[MORFOLOGIK_RULE_EN_GB]: Possible spelling mistake
 --> a.typ:1:7
  |
1 | haves problims.
  |       -------- info: Possible spelling mistake found.
  |               - help: problems
  |

Impact and importance

This is particularly impactful for a document structure that is broadly defined in one file. The actual content will not be evaluated. I.e.

main.typ

#import(...)
#include("section1.typ")
#include("section2.typ")
#include("section3.typ")
#include("section4.typ")
#bibliography(...)
1dancook commented 1 month ago

I now see this is in #21 but the issue is closed.

antonWetzel commented 1 month ago

If you want to check all files in a project, use the --main=<...> argument instead of path.

1dancook commented 1 month ago

Aye, indeed that works. My apologies for not trying it.

I think the wording in the readme and the cli tool led me to believe that --main will just use --path:

Different main file can be used
- defaults to path
- --main=<file>

Perhaps: "To check a main project file that has included sub-files, use --main=" or similar.

I will close this.