-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for typst #39
Comments
Adding Typst is a great idea. Of course, I cannot announce a delivery date. Feel free to submit a pull request to support Typst. |
As this topic was requested by two persons (see ltex-plus/vscode-ltex-plus#74), I gave this topic priority. I added some basic support for Typst with commit 61f20fd. You can start testing and give me some feedback. Be aware that it is not nearly as sophisticated as LaTeX support. |
Could you please add the following test, to check inline and multiline math equations?
|
As far as I can tell, on the current nightly build, it is not working correctly. |
Can you explain in more detail what is not working? Is it not working at all for you? |
If I download and run the nightly build from last night, version For example, in the following typst document = Title
Thiss is a typo.
And an equation
$
macron(lambda_s)
$ I would expect to get one diagnostic pertaining I cross checked by running |
There was a request to spell check the content of the math mode, see ltex-plus/vscode-ltex-plus#74 (comment) That's why I activated the spell checking for the math mode again. I will try to find a solution. |
Ahh I see, that makes sense. I think the best way so tackle this would be to not spell check math BUT strings, i.e. text delimited by Thanks a lot! |
Your idea is good. I will provide an update in the upcoming days. |
I just tested the latest nightly build 09.11.24. The first file I tested contains the example from the test: This is the math mode $ A = pi r^2 $
in Typst.
This is also math $ "exercice" 3 + 4$ in Typst.
This is the multi line math mode
$
A = pi r^2
$
in Typst. Running
Running the same command with the file Thiss is a typo.
And an equation
$ macron(lambda_s) $ results in
Running All 3 case do not seem to work correctly, even with different errors |
Maybe your issue is related to the lsp-cli instead of Typst? Do you get the same error message if you change the file ending to |
I added Typst to lsp-cli-plus, see 9db8dec. Because it was not included in lsp-cli-plus, your files were checked as plaintext. |
If I change the extension to If I run The log has the following content (if it helps):
Note that I remove the content of my dictionary since it contains some private details.
I'll test tomorrow. Thanks a lot! |
On the nightly build from 10.11.24, I still get the same error. Is it possible that an incorrect version of Also, |
Your guess is right, see commit: 2b60af6 I will trigger a nightly release manually so you can start testing again. |
Perfect, thanks a lot! Using the newest nightly build, The only issue that remains is that, at least for me, the lsp does not seem to initialize properly. For reference, the last 2 lines of the log file. The lsp is starting, but does not finish initializing:
|
I have good news! ltex-ls-plus seems to work correctly, I had some problems with my setup, but now the language server starts correctly. Additionally, formulas are not spell checked, but strings inside are! Some feedback: Math modeThis snippet At time $t$ I go home. causes the following error
which, if I understand your implementation correctly, is the correct error, but caused by the implementation. After all, you completely remove the equation, and afterwards, there are 2 consecutive spaces. I propose to replace the equation instead, for example with A similar problem happens for This is the end at time $t$. with error message
Also Some text is #text("bold", weight: 800). causes
Again, replacing the full expression with i.e. Finally, I'm unsure if spell-checking strings in formulas is worth it: in some cases it definitely helps. In just as many, however, it will just produce false-positives: For example $ mat(delim: "(", A, B)$ with Maybe it could be a configurable flag? In any case, I think it would be helpful to replace math equations like At time $t_"end" "maybe"$ I go home. with LabelsI observed that some labels are spellchecked:
Is the Thank you very much, it is already much more usable! |
Similarly, strings in functions are spellchecked, for example, in the following function:
This potentially creates a significant number of false-positives. |
File names in functions can be filtered with a regex. What do you think? |
Regarding the math mode: There is already a Dummy generator for LaTeX which can we use. It supports also German and French. The space issues can be handled this way. Is there a documentation about labels in Typst? The labels in the official Typst documentation look different compared to your example. |
I think the easiest thing to do would be the following: if there is a function, everything following the function in I'm unsure how to handle #fun(asd: none)[
Some text
#anotherfunction()
] To get started, it probably would be the easiest to just NOT spell check anything in Function (seem to) start with
That's what I meant!
see https://typst.app/docs/reference/foundations/label/:
Basically, |
You can use
This would cause that documents like this https://typst.app/universe/package/classy-german-invoice wouldn't be spell checked at all, because everything is in brackets. I don't think this is a good approach. |
Didn't know that. Thanks! Personally, however, I still think that strings in equations should not be spellchecked.
I see your point. That would indeed be problematic. From my point of view, the most pressing issues are:
In my case, addressing those 2 should fix 90% of all false-positives. When those are done, I can start using ltex "full-time" and report further problems. Again, thanks a lot for all your work! |
I am still working on your issues. The label topic is quite simple to solve, but the space issue is hard. But I am sure that there will be a solution. |
That's great to hear! If I can help by doing any testing, let me know! |
…nd handle labels and file names as markup See #39
I'm currently testing it. It's already working much better, thanks a lot! I'll get back to you after using it for a bit. |
@TheZoq2 Thank you for your hint. It's fixed now and you can test again using the next nightly release. |
I also observed that sometimes functions in multiline equations are spellchecked, even if they should not be. Inlining them solves the issue. Sadly, I have no code reproducing the issue. |
@ju6ge @cgahr |
Thanks I will test it as soon as there is a new nightly release. Regarding Tree Sitter … It is quite a nice tool, though the richness of the Grammatic does depend on the implementation of tree sitter for the specific language. But especially for cases like Spell checking it its quite awesome. Though redesigning LTeX around tree sitter would probably not be any easy task at all. I have no clue if there are any libraries for kotlin availible. |
I have seen similar stuff, I probably can dig up an example case from somewhere. |
Maybe it's a good point in time to create a release and handle the remaining issues (like the math issue you mentioned) in a separate issue and create a 18.3.1 release later on. Unless there is a justified veto, I will create a release in the upcoming days. |
I think that's a good idea, I've been daily driving in the last 10 days+, and it's absolutely usable now (it was not before). |
I agree, all further edge case can be handled in separate issues. |
Hi,
thank you for continuing to maintain ltex after issue 884! ltex+ is a real game changer!
It would be great if you could add support for the new typesetting system typst.
Typst is a new markup-based typesetting system that is designed to be as powerful as LaTeX while being much easier to learn and use (https://github.com/typst/typst). (I highly recommend checking it out!)
Thank you very much!
The text was updated successfully, but these errors were encountered: