Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion autoload/llama.vim
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,13 @@ function! s:fim_render(pos_x, pos_y, data)
" endif
"endfor

let l:content[-1] .= l:line_cur_suffix
" only add suffix if not already there to workaround confused llms,
" only match if word chars are in the suffix to avoid miscounting brackets
" or other important punctuation from correct llm output,
" may need tweaking if a bad pattern comes up
if !(l:content[-1] =~# '\V' . escape(l:line_cur_suffix, '/\') . '\$' && l:line_cur_suffix =~# '\w\w' )
let l:content[-1] .= l:line_cur_suffix
endif

" if only whitespaces - do not accept
if join(l:content, "\n") =~? '^\s*$'
Expand Down