diff --git a/src/analysis.zig b/src/analysis.zig index 357e8ef..bb568fe 100644 --- a/src/analysis.zig +++ b/src/analysis.zig @@ -2828,7 +2828,9 @@ fn makeScopeInternal(allocator: std.mem.Allocator, context: ScopeContext, node_i } }, .switch_case, + .switch_case_inline, .switch_case_one, + .switch_case_inline_one, .switch_range, => { return; diff --git a/src/ast.zig b/src/ast.zig index 29d433a..5056a9c 100644 --- a/src/ast.zig +++ b/src/ast.zig @@ -437,6 +437,8 @@ pub fn lastToken(tree: Ast, node: Ast.Node.Index) Ast.TokenIndex { .array_type, .switch_case_one, .switch_case, + .switch_case_inline_one, + .switch_case_inline, .switch_range, => n = datas[n].rhs, diff --git a/src/inlay_hints.zig b/src/inlay_hints.zig index ad95c13..70f4fef 100644 --- a/src/inlay_hints.zig +++ b/src/inlay_hints.zig @@ -548,8 +548,10 @@ fn writeNodeInlayHint(builder: *Builder, arena: *std.heap.ArenaAllocator, store: .switch_case_one, .switch_case, + .switch_case_inline_one, + .switch_case_inline, => { - const switch_case = if (tag == .switch_case) tree.switchCase(node) else tree.switchCaseOne(node); + const switch_case = if (tag == .switch_case or tag == .switch_case_inline) tree.switchCase(node) else tree.switchCaseOne(node); try callWriteNodeInlayHint(allocator, .{ builder, arena, store, switch_case.ast.target_expr, range }); }, diff --git a/src/references.zig b/src/references.zig index 5905259..5176e52 100644 --- a/src/references.zig +++ b/src/references.zig @@ -176,13 +176,17 @@ fn symbolReferencesInternal( try symbolReferencesInternal(builder, case, handle); } }, - .switch_case_one => { + .switch_case_one, + .switch_case_inline_one, + => { const case_one = tree.switchCaseOne(node); try symbolReferencesInternal(builder, case_one.ast.target_expr, handle); for (case_one.ast.values) |val| try symbolReferencesInternal(builder, val, handle); }, - .switch_case => { + .switch_case, + .switch_case_inline, + => { const case = tree.switchCase(node); try symbolReferencesInternal(builder, case.ast.target_expr, handle); for (case.ast.values) |val| diff --git a/src/semantic_tokens.zig b/src/semantic_tokens.zig index ab0bf10..a1a49fe 100644 --- a/src/semantic_tokens.zig +++ b/src/semantic_tokens.zig @@ -518,8 +518,11 @@ fn writeNodeTokens(builder: *Builder, maybe_node: ?Ast.Node.Index) WriteTokensEr }, .switch_case_one, .switch_case, + .switch_case_inline_one, + .switch_case_inline, => { - const switch_case = if (tag == .switch_case) tree.switchCase(node) else tree.switchCaseOne(node); + const switch_case = if (tag == .switch_case or tag == .switch_case_inline) tree.switchCase(node) else tree.switchCaseOne(node); + try writeToken(builder, switch_case.inline_token, .keyword); for (switch_case.ast.values) |item_node| try callWriteNodeTokens(allocator, .{ builder, item_node }); // check it it's 'else' if (switch_case.ast.values.len == 0) try writeToken(builder, switch_case.ast.arrow_token - 1, .keyword);