syntax: highlight the Go predeclared identifiers added since 1.18 - #4253
Open
yu2971512385-ui wants to merge 1 commit into
Open
yu2971512385-ui wants to merge 1 commit into
yu2971512385-ui wants to merge 1 commit 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
Collaborator
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...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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