@@ -87,31 +87,32 @@ fu! s:gocodeCurrentBufferOpt(filename)
87
87
return ' -in=' . a: filename
88
88
endf
89
89
90
- fu ! s: gocodeCursor ()
90
+ fu ! go#complete# gocodeCursor ()
91
91
if &encoding != ' utf-8'
92
92
let sep = &l: fileformat == ' dos' ? " \r \n " : " \n "
93
93
let c = col (' .' )
94
94
let buf = line (' .' ) == 1 ? " " : (join (getline (1 , line (' .' )-1 ), sep) . sep)
95
95
let buf .= c == 1 ? " " : getline (' .' )[:c - 2 ]
96
96
return printf (' %d' , len (iconv (buf , &encoding , " utf-8" )))
97
97
endif
98
+
98
99
return printf (' %d' , line2byte (line (' .' )) + (col (' .' )-2 ))
99
100
endf
100
101
101
102
fu ! s: gocodeAutocomplete ()
102
103
let filename = s: gocodeCurrentBuffer ()
103
104
let result = s: gocodeCommand (' autocomplete' ,
104
105
\ [s: gocodeCurrentBufferOpt (filename), ' -f=vim' ],
105
- \ [expand (' %:p' ), s: gocodeCursor ()])
106
+ \ [expand (' %:p' ), go#complete# gocodeCursor ()])
106
107
call delete (filename)
107
108
return result
108
109
endf
109
110
110
- function ! go#complete#GetInfo ( )
111
+ function ! go#complete#GetInfoFromOffset (offset )
111
112
let filename = s: gocodeCurrentBuffer ()
112
113
let result = s: gocodeCommand (' autocomplete' ,
113
114
\ [s: gocodeCurrentBufferOpt (filename), ' -f=godit' ],
114
- \ [expand (' %:p' ), s: gocodeCursor () ])
115
+ \ [expand (' %:p' ), a: offset ])
115
116
call delete (filename)
116
117
117
118
" first line is: Charcount,,NumberOfCandidates, i.e: 8,,1
@@ -147,6 +148,11 @@ function! go#complete#GetInfo()
147
148
return " "
148
149
endfunction
149
150
151
+ function ! go#complete#GetInfo ()
152
+ let offset = go#complete#gocodeCursor ()
153
+ return go#complete#GetInfoFromOffset (offset)
154
+ endfunction
155
+
150
156
function ! go#complete#Info ()
151
157
let result = go#complete#GetInfo ()
152
158
if ! empty (result)
0 commit comments