@@ -37,11 +37,8 @@ func filterOutShebang(data []byte) ([]byte, int) {
3737// Formatter interfaces
3838//-------------------------------------------------------------------------
3939
40- type FormatterEmpty interface {
40+ type Formatter interface {
4141 WriteEmpty ()
42- }
43-
44- type FormatterCandidates interface {
4542 WriteCandidates (names , types , classes []string , num int )
4643}
4744
@@ -106,6 +103,9 @@ func (*VimFormatter) WriteCandidates(names, types, classes []string, num int) {
106103
107104type EmacsFormatter struct {}
108105
106+ func (* EmacsFormatter ) WriteEmpty () {
107+ }
108+
109109func (* EmacsFormatter ) WriteCandidates (names , types , classes []string , num int ) {
110110 for i := 0 ; i < len (names ); i ++ {
111111 name := names [i ]
@@ -123,6 +123,9 @@ func (*EmacsFormatter) WriteCandidates(names, types, classes []string, num int)
123123
124124type CSVFormatter struct {}
125125
126+ func (* CSVFormatter ) WriteEmpty () {
127+ }
128+
126129func (* CSVFormatter ) WriteCandidates (names , types , classes []string , num int ) {
127130 for i := 0 ; i < len (names ); i ++ {
128131 fmt .Printf ("%s,,%s,,%s\n " , classes [i ], names [i ], types [i ])
@@ -153,7 +156,7 @@ func (*JSONFormatter) WriteCandidates(names, types, classes []string, num int) {
153156
154157//-------------------------------------------------------------------------
155158
156- func getFormatter () interface {} {
159+ func getFormatter () Formatter {
157160 switch * format {
158161 case "vim" :
159162 return new (VimFormatter )
@@ -260,15 +263,10 @@ func cmdAutoComplete(c *rpc.Client) {
260263 formatter := getFormatter ()
261264 names , types , classes , partial := Client_AutoComplete (c , file , filename , cursor )
262265 if names == nil {
263- if f , ok := formatter .(FormatterEmpty ); ok {
264- f .WriteEmpty ()
265- }
266+ formatter .WriteEmpty ()
266267 return
267268 }
268-
269- if f , ok := formatter .(FormatterCandidates ); ok {
270- f .WriteCandidates (names , types , classes , partial )
271- }
269+ formatter .WriteCandidates (names , types , classes , partial )
272270}
273271
274272func cmdClose (c * rpc.Client ) {
0 commit comments