Skip to content

Commit f53af00

Browse files
committed
Load the config before viewing a prompt
Lazy-load the Neural config before viewing a prompt, and update tests to reset state better.
1 parent db8b774 commit f53af00

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

autoload/neural.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,9 @@ endfunction
294294

295295
" Print the prompt that Neural will use in full.
296296
function! neural#ViewPrompt(...) abort
297+
" Reload the Neural config on a prompt request if needed.
298+
call neural#config#Load()
299+
297300
" Take the first argument or nothing.
298301
let l:prompt = get(a:000, 0, '')
299302
let l:buffer = bufnr('')

test/vim/test_buffer.vader

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ Before:
1111
call add(g:calls, ['neural#Run', a:prompt, a:options])
1212
endfunction
1313

14+
let g:output = ''
15+
1416
After:
1517
unlet! g:calls
18+
unlet! g:output
1619

1720
runtime autoload/neural/job.vim
1821

test/vim/test_view_prompt.vader

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1+
Before:
2+
Save g:neural
3+
4+
unlet! g:neural
5+
let g:output = ''
6+
17
After:
8+
Restore
9+
210
unlet! g:output
311

412
Given markdown(An empty Markdown file):

0 commit comments

Comments
 (0)