Skip to content

Commit

Permalink
Add MerlinLocateImpl, MerlinLocateIntf commands (ocaml#1208)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmr1993 authored and voodoos committed Jul 20, 2021
1 parent f38ed23 commit da14f19
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion vim/merlin/autoload/merlin.vim
Original file line number Diff line number Diff line change
Expand Up @@ -385,14 +385,28 @@ endfunction

function! merlin#Locate(...)
if (a:0 > 1)
echoerr "Locate: to many arguments (expected 0 or 1)"
echoerr "Locate: too many arguments (expected 0 or 1)"
elseif (a:0 == 0) || (a:1 == "")
MerlinPy merlin.vim_locate_under_cursor()
else
MerlinPy merlin.vim_locate_at_cursor(vim.eval("a:1"))
endif
endfunction

function! merlin#LocateImpl(...)
let l:pref = g:merlin_locate_preference
let g:merlin_locate_preference = 'implementation'
call call("merlin#Locate", a:000)
let g:merlin_locate_preference = l:pref
endfunction

function! merlin#LocateIntf(...)
let l:pref = g:merlin_locate_preference
let g:merlin_locate_preference = 'interface'
call call("merlin#Locate", a:000)
let g:merlin_locate_preference = l:pref
endfunction

function! merlin#Jump(...)
if (a:0 > 1)
echoerr "Jump: too many arguments (expected 0 or 1)"
Expand Down Expand Up @@ -579,6 +593,8 @@ function! merlin#Register()

""" Locate ------------------------------------------------------------------
command! -buffer -complete=customlist,merlin#ExpandPrefix -nargs=? MerlinLocate call merlin#Locate(<q-args>)
command! -buffer -complete=customlist,merlin#ExpandPrefix -nargs=? MerlinLocateImpl call merlin#LocateImpl(<q-args>)
command! -buffer -complete=customlist,merlin#ExpandPrefix -nargs=? MerlinLocateIntf call merlin#LocateIntf(<q-args>)
command! -buffer -nargs=0 MerlinILocate call merlin#InteractiveLocate()


Expand Down

0 comments on commit da14f19

Please sign in to comment.