Skip to content

fix refactor-nrepl option passthrough #5

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

Merged
merged 3 commits into from
May 9, 2019
Merged

fix refactor-nrepl option passthrough #5

merged 3 commits into from
May 9, 2019

Conversation

ltriant
Copy link
Contributor

@ltriant ltriant commented May 6, 2019

The method of passing through refactor-nrepl options does not work. Instead of attempting to configure via a stringified Clojure map to send to nrepl, allow the user to set options explicitly in a way that is more integrated into the vim ecosystem.

Only supports the prune-ns-form and prefix-rewriting so far.

This should address #3

The method of passing through refactor-nrepl options does not work.
Instead of attempting to configure via a stringified Clojure map to send
to nrepl, allow the user to set each option explicitly in a way that is
more integrated into the vim ecosystem.
@SevereOverfl0w
Copy link
Member

This appears to include some unrelated changes to keybindings?

@SevereOverfl0w
Copy link
Member

clojure-emacs/refactor-nrepl@3a2fa38#diff-9d54d18d9837001d8284bccf5d4c50b0 looks like this commit changed the behavior.

Is it worth just making this option a map which will be merged into? Then it will support all of the available options.

@ltriant
Copy link
Contributor Author

ltriant commented May 7, 2019

This appears to include some unrelated changes to keybindings?

That's to get the vim docs inline with what the actual keybindings are. The keybindings were altered some time in the past.

Is it worth just making this option a map which will be merged into? Then it will support all of the available options.

Good idea! I'll check out how to do that. Vimscript isn't my strongpoint :)

Rather than having a global per option, have a single global dictionary
for refactor-nrepl options. This is more versatile and resilient to any
future additions or removals to these options from the refactor-nrepl
project.
@ltriant
Copy link
Contributor Author

ltriant commented May 8, 2019

I've made the options a map. I think that's more versatile now.

plugin/cider.vim Outdated
let opts = { 'op': 'clean-ns', 'path': p }

if exists('g:refactor_nrepl_options')
for [opt_k, opt_v] in items(g:refactor_nrepl_options)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can use extend function here. Might not even need the if.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably do something like extend(get(g:,'refactor_nrepl_options', {}), opts)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extend modifies the first given dict so you should create local opts dict so the global options dict is not accidentally modified.

let opts = {'op': 'clean-ns', 'path': p}
extend(opts, get(g:,'refactor_nrepl_options', {}))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thank you. Of course there's an extend function! Much better :)

Manually iterating through the items and adding them to the dictionary
is unnecessary as the extend() functions exists to extend a dictionary
with the items of another dictionary.
@Deraen Deraen merged commit 11dfd96 into clojure-vim:master May 9, 2019
@Deraen
Copy link
Member

Deraen commented May 9, 2019

Tested & merged, thanks.

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.

3 participants