Closed matthewhughes934 closed 8 months ago
can you add tests for this to
autoload/go/highlight_test.vim
? The first test in that file,Test_gomodVersion_highlight
, is a good template to follow.
Oh, that's really nice to have some tests for the highlighting. I've added some new ones: 92af479
In addition to the comments I made inline
:thinking: I don't see any comments from you besides this one
This directive was added to
go.mod
with Go 1.21[1] So that this directive can be highlighted ingo.mod
.It's not entirely clear exactly what the fully supported syntax is. The docs[1] suggests any Go release version, e.g.
go1.20
go1.21.1
go1.21.1rc1
golang.org/x/mod
gives a much more relaxed definition, requiring just that things match against the regex^default$|^go1($|\.)
[2]Finally there's
FromToolchain
from the stdlib's internals for processing versions[3] which is broader than that from[1] but more limited than that from[2], supporting arbitrary suffixes (after any of" \t-"
) appended to the version, e.g.The approach taken for the syntax matching here is closest to this final condition, and will not include some toolchain verison's that would be supported by the
modfile
regex, e.g.Since these would be rejected by the
go
tool itself with an error like