dominikh / go-mode.el

Emacs mode for the Go programming language
BSD 3-Clause "New" or "Revised" License
1.38k stars 211 forks source link

Fix fontification of multiplicand after index expr. #383

Closed muirdm closed 3 years ago

muirdm commented 3 years ago

In "foo[1]10" we were interpreting "[1]10" as an array with element type "10". At first I was going to fix the identifier regex to disallow leading numbers (so "10" couldn't be a type name), but that is involved and doesn't fix the similar case of "foo[1]foo[2]". Instead fix the array type detection to disallow an identifier character preceding the opening bracket.

Fixes #382.

dominikh commented 3 years ago

Does that mean var x chan[5]int will not highlight correctly now?

dominikh commented 3 years ago

I guess that's acceptable, since that's never gofmt'ed. I missed that foo[1]*10 can actually occur in a gofmt'ed context.

muirdm commented 3 years ago

This breaks fontification of "float64" in map[string]map[string]float64. It appears we were depending [string]float64 looking like an array.

muirdm commented 3 years ago

Closing for now.

muirdm commented 3 years ago

OK - I think I resolved the "map" issues I noted above.