From 66fa4f127892c2d3eb1827eeb6ca2e47c49d162e Mon Sep 17 00:00:00 2001 From: Robert Schiele Date: Wed, 5 Mar 2025 07:20:38 +0100 Subject: [PATCH 1/2] introduce config variable to prevent Copilot asking questions --- autoload/copilot/handlers.vim | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/autoload/copilot/handlers.vim b/autoload/copilot/handlers.vim index 8c3a364..b4fab8d 100644 --- a/autoload/copilot/handlers.vim +++ b/autoload/copilot/handlers.vim @@ -3,9 +3,14 @@ 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 + echomsg a:params.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 From 13d795e82240681b15a9f9b2b476aa7f1c7b7b9b Mon Sep 17 00:00:00 2001 From: Robert Schiele Date: Thu, 6 Mar 2025 07:01:17 +0100 Subject: [PATCH 2/2] shorten message --- autoload/copilot/handlers.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autoload/copilot/handlers.vim b/autoload/copilot/handlers.vim index b4fab8d..9e4de1e 100644 --- a/autoload/copilot/handlers.vim +++ b/autoload/copilot/handlers.vim @@ -4,7 +4,8 @@ endfunction function! copilot#handlers#window_showMessageRequest(params, instance, ...) abort if exists('g:copilot_dontask') && g:copilot_dontask - echomsg a:params.message + 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:"] +