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

inserting function prototype on complete #51

Closed
7belrhalmia opened this issue Oct 9, 2015 · 2 comments
Closed

inserting function prototype on complete #51

7belrhalmia opened this issue Oct 9, 2015 · 2 comments

Comments

@7belrhalmia
Copy link

@Shougo you made a beautiful work on that by using neosnnipet but i think there is a lot of problem with that due to neosnnipet features .

i find another way using ultisnips . take a look at and hope it will hwlp the users of deoplete and neosnnipet

function! MyOnCompleteDone()
    if !exists('v:completed_item') || empty(v:completed_item)
       return
   endif

let complete_str = v:completed_item.word
if complete_str == ''
    return
endif
let abbr = v:completed_item.abbr
let startIdx = match(abbr,"(")
let endIdx = match(abbr,")")
if endIdx - startIdx > 1
    let argsStr = strpart(abbr, startIdx+1, endIdx - startIdx -1)
    let argsList = split(argsStr, ",")
    let snippet = "" 
    let c = 1
    for i in argsList
        if c > 1 
            let snippet = snippet. ", "
        endif
        " strip space
        let arg = substitute(i, '^\s*\(.\{-}\)\s*$', '\1', '') 
        let snippet = snippet . '${'.c.":".arg.'}'
        let c += 1
    endfor
    let snippet = snippet . ")$0"
    call UltiSnips#Anon(snippet)
endif
 endfunction
 autocmd CompleteDone *.go  call MyOnCompleteDone()
@Shougo
Copy link
Owner

Shougo commented Oct 10, 2015

@Shougo you made a beautiful work on that by using neosnnipet but i think there is a lot of problem with that due to neosnnipet features .

You don't explain the problems.
Please explain it.

@Shougo Shougo closed this as completed Nov 21, 2015
@Shougo
Copy link
Owner

Shougo commented Nov 21, 2015

Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants