Skip to content

Commit af9da64

Browse files
committed
Copilot.vim 1.5.4
1 parent 1bfbaf5 commit af9da64

File tree

5 files changed

+34
-36
lines changed

5 files changed

+34
-36
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Terms](https://docs.github.com/en/site-policy/github-terms/github-terms-for-addi
2020

2121
## Getting started
2222

23-
1. Install [Neovim][] or the latest patch of [Vim][] (9.0.0162 or newer).
23+
1. Install [Neovim][] or the latest patch of [Vim][] (9.0.0185 or newer).
2424

2525
2. Install [Node.js][] version 16. (Other versions should work too, except
2626
Node 18 which isn't supported yet.)

autoload/copilot.vim

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ let g:autoloaded_copilot = 1
66
scriptencoding utf-8
77

88
let s:has_nvim_ghost_text = has('nvim-0.6') && exists('*nvim_buf_get_mark')
9-
let s:has_vim_ghost_text = has('patch-9.0.0162') && has('textprop')
9+
let s:has_vim_ghost_text = has('patch-9.0.0185') && has('textprop')
1010
let s:has_ghost_text = s:has_nvim_ghost_text || s:has_vim_ghost_text
1111

1212
let s:hlgroup = 'CopilotSuggestion'
@@ -374,10 +374,10 @@ function! s:UpdatePreview() abort
374374
else
375375
call prop_add(line('.'), col('.'), {'type': s:hlgroup, 'text': text[0]})
376376
for line in text[1:]
377-
call prop_add(line('.'), col('.'), {'type': s:hlgroup, 'text_align': 'below', 'text': line})
377+
call prop_add(line('.'), 0, {'type': s:hlgroup, 'text_align': 'below', 'text': line})
378378
endfor
379379
if !empty(annot)
380-
call prop_add(line('.'), col('$'), {'type': s:annot_hlgroup, 'text': ' ' . annot[1][0]})
380+
call prop_add(line('.'), col('$'), {'type': s:annot_hlgroup, 'text': ' ' . annot})
381381
endif
382382
endif
383383
if uuid !=# get(s:, 'uuid', '')
@@ -656,33 +656,6 @@ function! s:commands.setup(opts) abort
656656

657657
let user = get(status, 'user', '<unknown>')
658658

659-
if status.status ==# 'NoTelemetryConsent'
660-
let terms_url = "https://github.co/copilot-telemetry-terms"
661-
echo "I agree to these telemetry terms as part of the GitHub Copilot technical preview."
662-
echo "<" . terms_url . ">"
663-
let prompt = '[a]gree/[r]efuse'
664-
if len(browser)
665-
let prompt .= '/[o]pen in browser'
666-
endif
667-
while 1
668-
let input = input(prompt . '> ')
669-
if input =~# '^r'
670-
redraw
671-
return 'echoerr ' . string('Copilot: Terms must be accepted.')
672-
elseif input =~# '^[ob]' && len(browser)
673-
if copilot#job#Stream(browser + [terms_url], v:null, v:null) != 0
674-
echo "\nCould not open browser."
675-
endif
676-
elseif input =~# '^a'
677-
break
678-
else
679-
echo "\nUnrecognized response."
680-
endif
681-
endwhile
682-
redraw
683-
call copilot#Call('recordTelemetryConsent', {})
684-
endif
685-
686659
echo 'Copilot: Authenticated as GitHub user ' . user
687660
endfunction
688661

autoload/copilot/agent.vim

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ let g:autoloaded_copilot_agent = 1
55

66
scriptencoding utf-8
77

8-
let s:plugin_version = '1.5.3'
8+
let s:plugin_version = '1.5.4'
99

1010
let s:error_exit = -1
1111

@@ -395,6 +395,10 @@ function! s:Command() abort
395395
return [node + [agent], node_version, '']
396396
endfunction
397397

398+
function! s:UrlDecode(str) abort
399+
return substitute(a:str, '%\(\x\x\)', '\=iconv(nr2char("0x".submatch(1)), "utf-8", "latin1")', 'g')
400+
endfunction
401+
398402
function! copilot#agent#EditorInfo() abort
399403
if !exists('s:editor_version')
400404
if has('nvim')
@@ -403,9 +407,23 @@ function! copilot#agent#EditorInfo() abort
403407
let s:editor_version = (v:version / 100) . '.' . (v:version % 100) . (exists('v:versionlong') ? printf('.%04d', v:versionlong % 1000) : '')
404408
endif
405409
endif
406-
return {
410+
let info = {
407411
\ 'editorInfo': {'name': has('nvim') ? 'Neovim': 'Vim', 'version': s:editor_version},
408412
\ 'editorPluginInfo': {'name': 'copilot.vim', 'version': s:plugin_version}}
413+
if type(get(g:, 'copilot_proxy')) == v:t_string
414+
let proxy = g:copilot_proxy
415+
else
416+
let proxy = ''
417+
endif
418+
let match = matchlist(proxy, '\C^\%([^:]\+://\)\=\%(\([^/:#]\+@\)\)\=\%(\([^/:#]\+\)\|\[\([[:xdigit:]:]\+\)\]\)\%(:\(\d\+\)\)\=\%(/\|$\)')
419+
if !empty(match)
420+
let info.networkProxy = {'host': match[2] . match[3], 'port': empty(match[4]) ? 80 : match[4]}
421+
if !empty(match[1])
422+
let info.networkProxy.username = s:UrlDecode(matchstr(match[1], '^[^:]*'))
423+
let info.networkProxy.password = s:UrlDecode(matchstr(match[1], ':\zs.*'))
424+
endif
425+
endif
426+
return info
409427
endfunction
410428

411429
function! s:GetCapabilitiesResult(result, agent) abort

copilot/dist/agent.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/copilot.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,14 @@ g:copilot_node_command Tell Copilot what `node` binary to use with
7373
>
7474
let g:copilot_node_command =
7575
\ "~/.nodenv/versions/16.15.0/bin/node"
76-
76+
<
77+
*g:copilot_proxy*
78+
g:copilot_proxy Tell Copilot what proxy server to use. This is a
79+
string in the format of `hostname:port` or
80+
`username:password@host:port`.
81+
>
82+
let g:copilot_proxy = 'localhost:3128'
83+
<
7784
MAPS *copilot-maps*
7885

7986
*copilot-i_<Tab>*

0 commit comments

Comments
 (0)