diff options
| author | Martin Bielik <mx.bielik@gmail.com> | 2023-04-18 20:17:27 +0200 |
|---|---|---|
| committer | Martin Bielik <mx.bielik@gmail.com> | 2023-04-18 20:17:27 +0200 |
| commit | f1697631eb8652bd676aaa7c3cb86dbe44ac4323 (patch) | |
| tree | cbdb61bad40af2914c8468e79a9a9f61f2ac6230 /autoload/vim_ai.vim | |
| parent | cdba3579d66956d356c424945a346a0f044facea (diff) | |
| download | vim-ai-f1697631eb8652bd676aaa7c3cb86dbe44ac4323.tar.gz | |
seleciton block boundary to eliminate empty response
Diffstat (limited to 'autoload/vim_ai.vim')
| -rw-r--r-- | autoload/vim_ai.vim | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/autoload/vim_ai.vim b/autoload/vim_ai.vim index d1c27a9..ac79f3b 100644 --- a/autoload/vim_ai.vim +++ b/autoload/vim_ai.vim @@ -48,7 +48,14 @@ function! s:MakePrompt(is_selection, lines, instruction) let l:lines = trim(join(a:lines, "\n")) let l:instruction = trim(a:instruction) let l:delimiter = l:instruction != "" && a:is_selection ? ":\n" : "" - let l:selection = a:is_selection || l:instruction == "" ? l:lines : "" + let l:selection = "" + if l:instruction == "" + let l:selection = l:lines + elseif a:is_selection + " TODO: check if lines already contain ##### + " NOTE: surround selection with ##### in order to eliminate empty responses + let l:selection = "#####\n" . l:lines . "\n#####" + endif return join([l:instruction, l:delimiter, l:selection], "") endfunction |