diff --git a/autoload/copilot/handlers.vim b/autoload/copilot/handlers.vim index 8c3a364..9e4de1e 100644 --- a/autoload/copilot/handlers.vim +++ b/autoload/copilot/handlers.vim @@ -3,9 +3,15 @@ function! copilot#handlers#window_logMessage(params, ...) abort endfunction function! copilot#handlers#window_showMessageRequest(params, instance, ...) abort - let choice = inputlist([a:instance.name . "\n" . a:params.message . "\n\nRequest Actions:"] + - \ map(copy(get(a:params, 'actions', [])), { i, v -> (i + 1) . '. ' . v.title})) - return choice > 0 ? get(a:params.actions, choice - 1, v:null) : v:null + if exists('g:copilot_dontask') && g:copilot_dontask + let l:message = substitute(a:params.message, "Upgrade your plan to Copilot Pro (30-day Free Trial) or w", "W", "") + echomsg l:message + return v:null + else + let choice = inputlist([a:instance.name . "\n" . a:params.message . "\n\nRequest Actions:"] + + \ map(copy(get(a:params, 'actions', [])), { i, v -> (i + 1) . '. ' . v.title})) + return choice > 0 ? get(a:params.actions, choice - 1, v:null) : v:null + endif endfunction function! s:BrowserCallback(into, code) abort