From 0d5b5c9b4e3f8e9854ed7a658638bd4bb8325271 Mon Sep 17 00:00:00 2001 From: yu2971512385-ui <287936273+yu2971512385-ui@users.noreply.github.com> Date: Thu, 1 Oct 2026 11:02:18 +0800 Subject: [PATCH] syntax: highlight the Go predeclared identifiers added since 1.18 The Go syntax file lists the predeclared types and functions, but stops before any (1.18), comparable (1.18) and clear/min/max (1.21), so they are left unhighlighted while error and len next to them are not. Co-Authored-By: Claude Opus 5 (1M context) --- runtime/syntax/go.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/syntax/go.yaml b/runtime/syntax/go.yaml index 3885c7b17d..ee0f0455fa 100644 --- a/runtime/syntax/go.yaml +++ b/runtime/syntax/go.yaml @@ -7,13 +7,13 @@ rules: # Conditionals and control flow - special: "\\b(break|case|continue|default|go|goto|range|return|println|fallthrough)\\b" - statement: "\\b(else|for|if|switch|select)\\b" - - preproc: "\\b(package|import|const|var|type|struct|func|defer|iota|make|new|copy|len|cap|panic|append|close|delete|print|recover)\\b" + - preproc: "\\b(package|import|const|var|type|struct|func|defer|iota|make|new|copy|len|cap|panic|append|close|delete|print|recover|clear|min|max)\\b" - symbol.operator: "[-+/*=<>!~%&|^]|:=" # Types - symbol: "(,|\\.)" - type: "\\b(u?int(8|16|32|64)?|float(32|64)|complex(64|128))\\b" - - type: "\\b(uintptr|byte|rune|string|interface|bool|map|chan|error)\\b" + - type: "\\b(uintptr|byte|rune|string|interface|bool|map|chan|error|any|comparable)\\b" - type.keyword: "\\b(struct)\\b" - constant.bool: "\\b(true|false|nil)\\b"