@@ -24,7 +24,7 @@ function Source.is_available(self)
24
24
end
25
25
26
26
function Source .get_debug_name ()
27
- return ' tabby '
27
+ return ' Tabby '
28
28
end
29
29
30
30
function Source ._do_complete (self , ctx , callback )
@@ -107,7 +107,7 @@ function Source._do_complete(self, ctx, callback)
107
107
}
108
108
109
109
local item = {
110
- label = newText ,
110
+ label = cur_line_before .. newText ,
111
111
-- removing filterText, as it interacts badly with multiline
112
112
-- filterText = newText,
113
113
data = {
@@ -122,7 +122,7 @@ function Source._do_complete(self, ctx, callback)
122
122
sortText = newText ,
123
123
dup = 0 ,
124
124
cmp = {
125
- kind_text = ' tabby ' ,
125
+ kind_text = ' Tabby ' ,
126
126
},
127
127
documentation = {
128
128
kind = cmp .lsp .MarkupKind .Markdown ,
@@ -133,6 +133,7 @@ function Source._do_complete(self, ctx, callback)
133
133
item [' data' ][' multiline' ] = true
134
134
end
135
135
table.insert (items , item )
136
+ self :view (item )
136
137
end
137
138
end
138
139
end
@@ -148,6 +149,34 @@ function Source._do_complete(self, ctx, callback)
148
149
})
149
150
end
150
151
152
+ --- view
153
+ function Source .view (self , item )
154
+ -- dump(item)
155
+ local req = {
156
+ type = ' view' ,
157
+ completion_id = item .data .id ,
158
+ choice_index = item .data .choice ,
159
+ }
160
+ -- dump(vim.json.encode(req))
161
+ fn .jobstart ({
162
+ ' curl' ,
163
+ ' -s' ,
164
+ ' -H' ,
165
+ ' Content-type: application/json' ,
166
+ ' -H' ,
167
+ ' Accept: application/json' ,
168
+ ' -X' ,
169
+ ' POST' ,
170
+ ' -d' ,
171
+ vim .json .encode (req ),
172
+ conf :get (' host' ) .. ' /v1/events' ,
173
+ }, {
174
+ on_stdout = function (_ , c , _ )
175
+ -- dump(c)
176
+ end ,
177
+ })
178
+ end
179
+
151
180
--- execute
152
181
function Source .execute (self , item , callback )
153
182
-- dump(item)
0 commit comments