Skip to content
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: comments on type aliases are now recognized as comments #39

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions syntaxes/wit.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,9 @@
"name": "meta.types.type-item.wit",
"include": "#types"
},
{
"include": "#comment"
},
{
"include": "#whitespace"
}
Expand Down
4 changes: 2 additions & 2 deletions tests/grammar/integration/issue573.wit
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ interface types-interface {
// type aliases are allowed to primitive types and additionally here are some
// examples of other types
type t1 = u32
type t2 = tuple<u32, u64>
type t2 = tuple<u32, u64> // tuple
type t3 = string
type t4 = option<u32>
type t4 = option<u32> // option
/// no "ok" type
type t5 = result<_, errno> // no "ok" type
type t6 = result<string> // no "err" type
Expand Down
6 changes: 4 additions & 2 deletions tests/grammar/integration/issue573.wit.snap
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
# ^ source.wit meta.interface-item.wit meta.type-item.wit punctuation.equal.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.numeric.wit
> type t2 = tuple<u32, u64>
> type t2 = tuple<u32, u64> // tuple
#^^ source.wit meta.interface-item.wit meta.whitespace.wit
# ^^^^ source.wit meta.interface-item.wit meta.type-item.wit keyword.declaration.type.type-item.wit storage.type.wit
# ^ source.wit meta.interface-item.wit meta.type-item.wit
Expand All @@ -176,6 +176,7 @@
# ^ source.wit meta.interface-item.wit meta.type-item.wit meta.tuple.ty.wit meta.whitespace.wit
# ^^^ source.wit meta.interface-item.wit meta.type-item.wit meta.tuple.ty.wit entity.name.type.numeric.wit
# ^ source.wit meta.interface-item.wit meta.type-item.wit meta.tuple.ty.wit punctuation.brackets.angle.end.wit
# ^^^^^^^^^ source.wit meta.interface-item.wit meta.type-item.wit comment.line.double-slash.wit
> type t3 = string
#^^ source.wit meta.interface-item.wit meta.whitespace.wit
# ^^^^ source.wit meta.interface-item.wit meta.type-item.wit keyword.declaration.type.type-item.wit storage.type.wit
Expand All @@ -185,7 +186,7 @@
# ^ source.wit meta.interface-item.wit meta.type-item.wit punctuation.equal.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.string.wit
> type t4 = option<u32>
> type t4 = option<u32> // option
#^^ source.wit meta.interface-item.wit meta.whitespace.wit
# ^^^^ source.wit meta.interface-item.wit meta.type-item.wit keyword.declaration.type.type-item.wit storage.type.wit
# ^ source.wit meta.interface-item.wit meta.type-item.wit
Expand All @@ -197,6 +198,7 @@
# ^ source.wit meta.interface-item.wit meta.type-item.wit meta.option.ty.wit punctuation.brackets.angle.begin.wit
# ^^^ source.wit meta.interface-item.wit meta.type-item.wit meta.option.ty.wit entity.name.type.numeric.wit
# ^ source.wit meta.interface-item.wit meta.type-item.wit meta.option.ty.wit punctuation.brackets.angle.end.wit
# ^^^^^^^^^^ source.wit meta.interface-item.wit meta.type-item.wit comment.line.double-slash.wit
> /// no "ok" type
#^^^^^ source.wit meta.interface-item.wit comment.line.documentation.wit
# ^^^^^^^^^^^^^ source.wit meta.interface-item.wit comment.line.documentation.wit
Expand Down
3 changes: 2 additions & 1 deletion tests/grammar/unit/interface.wit
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@ interface another-interface {
// ^^^^^^^^^^^^^^^^^ entity.name.type.id.interface-item.wit
// ^ meta.interface-item.wit punctuation.brackets.curly.begin.wit

type my-type = string
type my-type = string // comment
//^^^^ keyword.declaration.type.type-item.wit
// ^^^^^^^ entity.name.type.id.type-item.wit
// ^ meta.type-item.wit punctuation.equal.wit
// ^^^^^^ entity.name.type.string.wit
// ^^^^^^^^^^ comment.line.double-slash.wit

record my-record {
//^^^^^^ keyword.declaration.record.record-item.wit
Expand Down
Loading