Skip to content

Commit 5f5c54b

Browse files
committed
remove symbol references on test decl with string literal name
fixes #2064
1 parent 26b73d7 commit 5f5c54b

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/features/references.zig

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,16 @@ const Builder = struct {
113113
.identifier,
114114
.test_decl,
115115
=> |tag| {
116-
const name_token, const name = switch (tag) {
117-
.identifier => blk: {
118-
const name_token = ast.identifierTokenFromIdentifierNode(tree, node) orelse return;
119-
break :blk .{
120-
name_token,
121-
offsets.identifierTokenToNameSlice(tree, name_token),
122-
};
116+
const name_token = switch (tag) {
117+
.identifier => ast.identifierTokenFromIdentifierNode(tree, node) orelse return,
118+
.test_decl => blk: {
119+
const name_token = ast.testDeclNameToken(tree, node) orelse return;
120+
if (tree.tokens.items(.tag)[name_token] != .identifier) return;
121+
break :blk name_token;
123122
},
124-
.test_decl => ast.testDeclNameAndToken(tree, node) orelse return,
125123
else => unreachable,
126124
};
125+
const name = offsets.identifierTokenToNameSlice(tree, name_token);
127126

128127
const child = try builder.analyser.lookupSymbolGlobal(
129128
handle,

tests/lsp_features/references.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ test "test with identifier" {
158158
try testReferences(
159159
\\pub fn <0>() bool {}
160160
\\test <0> {}
161+
\\test "placeholder" {}
161162
\\test {}
162163
);
163164
}

0 commit comments

Comments
 (0)