-
Notifications
You must be signed in to change notification settings - Fork 4
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
fix: Separate rules for result
keyword with and without <>
#36
base: main
Are you sure you want to change the base?
Conversation
# ^^ source.wit meta.interface-item.wit meta.type-item.wit | ||
# ^ source.wit meta.interface-item.wit meta.type-item.wit meta.whitespace.wit | ||
# ^^ source.wit meta.interface-item.wit meta.type-item.wit entity.name.type.id.wit | ||
# ^ source.wit meta.interface-item.wit meta.type-item.wit meta.whitespace.wit | ||
# ^ source.wit meta.interface-item.wit meta.type-item.wit | ||
# ^^ source.wit meta.interface-item.wit meta.type-item.wit entity.name.type.id.wit | ||
# ^ source.wit meta.interface-item.wit meta.type-item.wit | ||
# ^ source.wit meta.interface-item.wit meta.type-item.wit meta.whitespace.wit | ||
# ^^^^ source.wit meta.interface-item.wit meta.type-item.wit entity.name.type.id.wit |
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.
These should be source.wit meta.interface-item.wit meta.type-item.wit meta.result.ty.wit comment.line.double-slash.wit
.
However, this issue applies to other types as well, and the result type worked fine only because it was treated as a special case. We should address this with a more general approach in a separate PR.
type x = i32 // hello <- this line comments will be colored with 0.3.1
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.
fix bytecodealliance#35 This commit separates the syntax highlighting rules for `result` types with angle brackets (`result<...>`) and `result` types without type parameters. Previously, both types were handled in a single rule, `meta.result.ty.wit`, which ended at a newline (technically "after"), comma, or closing bracket. However, if a `result` type appeared as a parameter, the scope wouldn't end until one of these conditions was met. (As observed, the scope didn’t end even when a newline was encountered, likely because it was captured by other rules, though...). This change simplifies the `meta.result.ty.wit` scope by splitting the handling of `result<...>` and `result`. Now, `result<...>` is handled similarly to `list<...>` and `tuple<...>`, while `result` without `<...>` is handled by `result-base`, which marks the `result` keyword as `entity.name.type.result.wit`. As a consequence of this change, line comments on `result<xxx> // comment` will no longer be ignored. However, this is a known issue for other types as well.
Seems like this also fixes #33 ? |
result
keyword with and without <>result
keyword with and without <>
before

after

fix #35
This commit separates the syntax highlighting rules for
result
types with angle brackets (result<...>
) andresult
types without type parameters.Previously, both types were handled in a single rule,
meta.result.ty.wit
, which ended at a newline (technically "after"), comma, or closing bracket. However, if aresult
type appeared as a parameter, the scope wouldn't end until one of these conditions was met. (As observed, the scope didn’t end even when a newline was encountered, likely because it was captured by other rules, though...).This change simplifies the
meta.result.ty.wit
scope by splitting the handling ofresult<...>
andresult
. Now,result<...>
is handled similarly tolist<...>
andtuple<...>
, whileresult
without<...>
is handled byresult-base
, which marks theresult
keyword asentity.name.type.result.wit
.As a consequence of this change, line comments on
result<xxx> // comment
will no longer be ignored. However, this is a known issue for other types as well.