Skip to content

Commit 585e1a9

Browse files
committed
Copilot.vim 1.3.4
1 parent bd6efea commit 585e1a9

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

autoload/copilot.vim

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,8 @@ function! s:commands.setup(opts) abort
687687
echo 'Copilot: Authenticated as GitHub user ' . user
688688
endfunction
689689

690+
let s:commands.auth = s:commands.setup
691+
690692
function! s:commands.help(opts) abort
691693
return a:opts.mods . ' help ' . (len(a:opts.arg) ? ':Copilot_' . a:opts.arg : 'copilot')
692694
endfunction
@@ -743,6 +745,8 @@ function! s:commands.split(opts) abort
743745
return mods . ' pedit copilot://'
744746
endfunction
745747

748+
let s:commands.open = s:commands.split
749+
746750
function! copilot#CommandComplete(arg, lead, pos) abort
747751
let args = matchstr(strpart(a:lead, 0, a:pos), 'C\%[opilot][! ] *\zs.*')
748752
if args !~# ' '
@@ -755,22 +759,22 @@ endfunction
755759

756760
function! copilot#Command(line1, line2, range, bang, mods, arg) abort
757761
let cmd = matchstr(a:arg, '^\%(\\.\|\S\)\+')
762+
if !empty(cmd) && !has_key(s:commands, tr(cmd, '-', '_'))
763+
return 'echoerr ' . string('Copilot: unknown command ' . string(cmd))
764+
endif
758765
let arg = matchstr(a:arg, '\s\zs\S.*')
759-
let opts = copilot#Call('checkStatus', {})
760766
try
767+
let err = copilot#Agent().StartupError()
768+
if !empty(err)
769+
return 'echo ' . string('Copilot: ' . string(cmd))
770+
endif
771+
let opts = copilot#Call('checkStatus', {})
761772
if empty(cmd)
762773
if opts.status !=# 'OK' && opts.status !=# 'MaybeOK'
763774
let cmd = 'setup'
764775
else
765776
let cmd = 'panel'
766777
endif
767-
elseif cmd ==# 'auth'
768-
let cmd = 'setup'
769-
elseif cmd ==# 'open'
770-
let cmd = 'split'
771-
endif
772-
if !has_key(s:commands, tr(cmd, '-', '_'))
773-
return 'echoerr ' . string('Copilot: unknown command ' . string(cmd))
774778
endif
775779
call extend(opts, {'line1': a:line1, 'line2': a:line2, 'range': a:range, 'bang': a:bang, 'mods': a:mods, 'arg': arg})
776780
let retval = s:commands[tr(cmd, '-', '_')](opts)

autoload/copilot/agent.vim

Lines changed: 1 addition & 1 deletion
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.3.3'
8+
let s:plugin_version = '1.3.4'
99

1010
let s:error_exit = -1
1111

0 commit comments

Comments
 (0)