Repository navigation
syntax: highlight the Go predeclared identifiers added since 1.18 - #4253
yu2971512385-ui wants to merge 2 commits into
Conversation
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) <noreply@anthropic.com>
Andriamanitra
left a comment
There was a problem hiding this comment.
Nice addition.
I noticed that the built-in functions complex, real, and imag are also missing from the syntax.
It's also pretty weird that println is special but print is preproc (since #1455). I would rather highlight builtin functions as identifier, but maybe we shouldn't mess with it more than we need to if users have already gotten used to this "wrong" highlighting in Go...
Spotted in review: these three are predeclared functions like the rest of the list, and were missing as well. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Good catch — That makes the rule complete against the spec's predeclared functions, with On |
|
Let's just move |
runtime/syntax/go.yamllists Go's predeclared identifiers, but five of them are missing, so they stay unhighlighted while their neighbours in the same rules are highlighted:anytype, likeerrorcomparabletypeclear,min,maxpreproc, likelenChecked with micro's own highlighter (
pkg/highlight):error,lenand everything else are unaffected: the two types join the existing type rule, the three functions the existingpreprocrule that already holdsmake,new,copy,len,capand the rest.AI assistance (Claude) was used to find this — by running language snippets through highlighters and flagging what comes back unstyled — and to draft this description. I verified the before/after with micro's highlighter myself.
🤖 Generated with Claude Code