Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auto: do not create anonymous snippet #3603

Merged
merged 1 commit into from
Nov 19, 2023
Merged
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
9 changes: 9 additions & 0 deletions autoload/go/auto.vim
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ function! s:ExpandSnippet() abort
" the snippet may have a '{\}' in it. For UltiSnips, that should be spelled
" \{}. fmt.Printf is such a snippet that can be used to demonstrate.
let l:snippet = substitute(v:completed_item.word, '{\\}', '\{}', 'g')

" If there are no placeholders in the returned text, then do not expand
" the snippet, because Ultisnip does not support nested snippets, and the
" user may already be in an expanded snippet. While this isn't foolproof,
" because there may be placeholders in the snippet, it at least solves the
" simple case.
if stridx(l:snippet, '$') == -1
return
endif
call UltiSnips#Anon(l:snippet, v:completed_item.word, '', 'i')
" elseif l:engine is 'neosnippet'
" " TODO(bc): make the anonymous expansion for neosnippet work
Expand Down
Loading