Repository navigation
Conversation
…and min The Go mode lists the predeclared types (error, rune, string, ...) and functions (append, len, make, ...), but not the identifiers the language gained later: any and comparable (Go 1.18, with generics) and clear, max and min (Go 1.21). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
clear, max and min are already scoped as support.function wherever they
are called, because the mode scopes any identifier followed by "(" that
way. Adding them to builtinFunctions only changes how they look outside
call position, where they are ordinary identifiers that a program may
well have shadowed, so leave that alone and keep this change to the two
predeclared types.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Correction to my own PR: I narrowed it to Re-checking against a pristine Sorry for the noise; the two types are unaffected by that rule and remain a real gap. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6011 +/- ##
==========================================
- Coverage 93.92% 93.89% -0.03%
==========================================
Files 647 647
Lines 140792 140802 +10
Branches 14784 14758 -26
==========================================
- Hits 132237 132206 -31
- Misses 8555 8596 +41
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thank you |
Issue #, if available: n/a
Description of changes:
golang_highlight_rules.jslists Go's predeclared identifiers asbuiltinTypes, but not the two the language gained in 1.18 with generics, so they are lexed as ordinary identifiers whileerror,stringand the rest are types:var x anyany→identifiersupport.typetype S[E comparable] intcomparable→identifiersupport.typeTests: a new case in
src/mode/golang_test.jsasserts both, pluserroras a control. It fails on master ('support.type' == 'identifier') and passes with the change;mocha "./src/mode/*_test.js"is green (81 passing, 1 pending).Correction to the original version of this PR: it also added
clear,maxandmintobuiltinFunctionsand claimed they were unstyled. That was wrong — the mode already scopes any identifier followed by(assupport.function, so those three are styled at every call site today. The only thing the addition changed was their appearance outside call position, where they are shadowable identifiers, so I removed that part and narrowed this to the two types.Found by lexing modern-language snippets and flagging identifiers that stay unstyled. AI assistance (Claude) was used for that search and for drafting; I reviewed and tested every line, and the correction above came out of re-verifying the before/after behaviour against a pristine checkout.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Pull Request Checklist:
🤖 Generated with Claude Code
Open kitchen-sink @ e690c632c99727a996d5d4965ea9cfc7ec23453b