-
Notifications
You must be signed in to change notification settings - Fork 56
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
feat: Typst Language Support #302
base: master
Are you sure you want to change the base?
Conversation
9a7ae81
to
6b5d78a
Compare
…of an environment's span
… possessives or conjunctions
…ove dict parsing to fit better
…ntent in span so quotes aren't escaped
6b5d78a
to
550cf20
Compare
Mostly just needs more tests. I'm no expert in Typst syntax, so if someone wants to help it would be much appreciated. |
If I can understand the core concepts mentioned above (what should/could be checked), then I maybe be able to add some tests. |
…non-mut The parser trait's parse method took an &mut, but it wasn't used anywhere and was causing significant problems interacting with closures. If it is needed in the future, I would suggest creating a seperate mutable parse method.
…ctly handle optional components
- Only consolidate adjacent space spans - Typst spaces distinguish between newlines and spaces - Typst spaces count number of spaces - Spans command now defaults to not show newlines
- Remove unneeded &mut impl Parser in document
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but I have some questions.
@@ -284,6 +284,12 @@ impl Document { | |||
} | |||
|
|||
let child_tok = ©[cursor]; | |||
|
|||
// Only condense adjacent spans | |||
if start_tok.span.end != child_tok.span.start { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add this change to condense_newlines
as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did that originally, but it broke a test so I reverted it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test might be wrong then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, it's because newlines in comments need to be merged for paragraph breaks.
// I am a comment
//
// My span starts after the //
There is no paragraph break in between because the newline on line 2's span isn't contiguous with the newline at the end of line 1.
739ccc2
to
5f83275
Compare
Re-opening of #289 from my fork instead of a branch