Skip incomplete fn_protos when generating folding ranges (#958)

This commit is contained in:
nullptrdevs
2023-02-02 20:38:09 -08:00
committed by GitHub
parent 5ec4770ac2
commit 75f0617279

View File

@@ -181,6 +181,8 @@ pub fn generateFoldingRanges(allocator: std.mem.Allocator, tree: Ast, encoding:
const list_start_tok = fn_proto.lparen; const list_start_tok = fn_proto.lparen;
const list_end_tok = ast.lastToken(tree, node) -| 1; const list_end_tok = ast.lastToken(tree, node) -| 1;
if (list_start_tok > list_end_tok) continue; // Incomplete, ie `fn a()`
try builder.add(null, list_start_tok, list_end_tok, .exclusive, .exclusive); try builder.add(null, list_start_tok, list_end_tok, .exclusive, .exclusive);
}, },