dominikh/go-mode.el — pull request #54 by rui314 (2014-06-29 22:31:36+00:00)
Title: Highlight type names in function parameter list

Currently go-mode does not set font-lock-type-face to type
names in a function parameter list. This patch is to set it
to highlight them.

Context matters to find type names in a parameter list. For
example, X and Y are type names in "func(X, Y)" but are not
in "func(X, Y int)", so we cannot say if they are type names
until we see int or a closing parenthesis in this case. In
this patch, we first scan a parameter list to see whether or
not the list has names, and scan it again to get positions
of type names.

All "T"s (and not "x"s and "y"s) in the following code are
highlighted with this patch.

func (T)
func (x T)
func (x, y T, z T)

func ([]T, T)
func (*T, T)

func (T) T
func (T) *T
func (T) (T)
func (T) (*T)
func (T) (T, T)
func (T) (n T, err T)
func (T) (m, n T)

func fn(T)
func fn(T, T, T)
func fn(x T)
func fn(x, y T, z T)

func (T) method(T) T
func (x T) method(T) (T, T)
func (x T) method(T) (n T, err T)

func (x func(x T), y func(T, T) T) func() T

This change has already been reviewed at
https://codereview.appspot.com/81240047