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

Add MerlinLocateImpl, MerlinLocateIntf commands #1208

Merged
merged 4 commits into from
Dec 7, 2020

Conversation

mrmr1993
Copy link
Contributor

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 of g:merlin_locate_preference.

Copy link
Contributor

@trefis trefis left a 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)"
Copy link
Contributor

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(...)
Copy link
Contributor

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

Copy link
Contributor Author

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)

@mrmr1993
Copy link
Contributor Author

mrmr1993 commented Dec 1, 2020

Pushed a small change to enable completion for the commands.

@trefis trefis merged commit 3219e9c into ocaml:master Dec 7, 2020
@trefis
Copy link
Contributor

trefis commented Dec 7, 2020

Thanks!

voodoos pushed a commit to voodoos/merlin that referenced this pull request Jul 20, 2021
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

Successfully merging this pull request may close these issues.

2 participants