-
Notifications
You must be signed in to change notification settings - Fork 237
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
Add MerlinLocateImpl, MerlinLocateIntf commands #1208
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These new functions seem redundant with the variable that's already there.
But if people really think they make for a more convenient user interface then why not...
@@ -376,14 +376,34 @@ 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)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😅
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(...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naïve question (because I haven't touched vimscript in years), why can't this function be implemented as:
let l:pref = g:merlin_locate_preference
let g:merlin_locate_preference = 'ml'
call merlin#Locate(...)
let g:merlin_locate_preference = l:pref
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to do roughly this. Vimscript being vimscript, your elegant call syntax needed to be replaced with something much uglier and less obvious:
call call("merlin#Locate", a:000)
Pushed a small change to enable completion for the commands. |
Thanks! |
I added these as part of my debugging for #1202, but they have turned out to be generally useful and low-cost to add.
The commands behave as
MerlinLocate
, but jumping to either the implementation or interface regardless of the contents ofg:merlin_locate_preference
.