From 887312768789dff65a7ec2733f02b0f5d440cff9 Mon Sep 17 00:00:00 2001 From: Swastik Baranwal Date: Mon, 19 Dec 2022 15:42:46 +0530 Subject: [PATCH] v doc: properly highlight the new generics syntax `[]` in the CLI results of `v doc arrays` etc (#16703) --- cmd/tools/vdoc/utils.v | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/tools/vdoc/utils.v b/cmd/tools/vdoc/utils.v index 4bd6f504e..81aaff9db 100644 --- a/cmd/tools/vdoc/utils.v +++ b/cmd/tools/vdoc/utils.v @@ -211,15 +211,15 @@ fn color_highlight(code string, tb &ast.Table) string { && (next_tok.kind != .lpar || prev.kind !in [.key_fn, .rpar]) { tok_typ = .builtin } else if - (next_tok.kind in [.lcbr, .rpar, .eof, .comma, .pipe, .name, .rcbr, .assign, .key_pub, .key_mut, .pipe, .comma, .comment, .lt] + (next_tok.kind in [.lcbr, .rpar, .eof, .comma, .pipe, .name, .rcbr, .assign, .key_pub, .key_mut, .pipe, .comma, .comment, .lt, .lsbr] && next_tok.lit !in builtin) && (prev.kind in [.name, .amp, .lcbr, .rsbr, .key_type, .assign, .dot, .question, .rpar, .key_struct, .key_enum, .pipe, .key_interface, .comment, .ellipsis] && prev.lit !in builtin) && ((tok.lit != '' && tok.lit[0].is_capital()) || prev_prev.lit in ['C', 'JS']) { tok_typ = .symbol } else if next_tok.kind == .lpar - || (!(tok.lit != '' && tok.lit[0].is_capital()) && next_tok.kind == .lt - && next_tok.pos == tok.pos + tok.lit.len) { + || (!(tok.lit != '' && tok.lit[0].is_capital()) + && next_tok.kind in [.lt, .lsbr] && next_tok.pos == tok.pos + tok.lit.len) { tok_typ = .function } else if next_tok.kind == .dot { if tok.lit in ['C', 'JS'] { -- 2.30.2