test and simplify semantic tokens on function call

This commit is contained in:
Techatrix
2023-03-31 20:49:25 +02:00
parent 3fefcfb398
commit ae5fa110b5
2 changed files with 36 additions and 6 deletions

View File

@@ -226,6 +226,42 @@ test "semantic tokens - field access" {
});
}
test "semantic tokens - call" {
try testSemanticTokens(
\\fn foo() void {}
\\const alpha = foo();
, &.{
.{ "fn", .keyword, .{} },
.{ "foo", .function, .{ .declaration = true } },
.{ "void", .type, .{} },
.{ "const", .keyword, .{} },
.{ "alpha", .variable, .{ .declaration = true } },
.{ "=", .operator, .{} },
.{ "foo", .function, .{} },
});
try testSemanticTokens(
\\const ns = struct {
\\ fn foo() void {}
\\};
\\const alpha = ns.foo();
, &.{
.{ "const", .keyword, .{} },
.{ "ns", .type, .{ .namespace = true, .declaration = true } },
.{ "=", .operator, .{} },
.{ "struct", .keyword, .{} },
.{ "fn", .keyword, .{} },
.{ "foo", .function, .{ .declaration = true } },
.{ "void", .type, .{} },
.{ "const", .keyword, .{} },
.{ "alpha", .variable, .{ .declaration = true } },
.{ "=", .operator, .{} },
.{ "ns", .type, .{ .namespace = true } },
.{ "foo", .function, .{} },
});
}
test "semantic tokens - catch" {
try testSemanticTokens(
\\var alpha = a catch b;