Jedi-vim: Feature request: specify buffer type per command

Created on 10 Jun 2020  路  10Comments  路  Source: davidhalter/jedi-vim

I have a small feature request that I'd like to take a stab at if it's a change you'd be willing to merge.

I use the splits mode for buffers in this plugin, which works great for jumping to definitions. However refactoring in this mode on a larger project will often end up creating 4+ splits which is an annoyance to deal with. So I propose these new configuration settings:

jedi#use_tabs_not_buffers_goto
jedi#use_splits_not_buffers_goto
jedi#use_tabs_not_buffers_refactor
jedi#use_splits_not_buffers_refactor

The above settings would override the current g:jedi#use_(tabs/splits)_not_buffers options if set, but otherwise the current option in place would not be modified.

Thanks for your work on jedi and jedi-vim!

feature

Most helpful comment

I think we should probably just not split in case a refactoring happens. IMO that's the best way forward. People that want splits want one split and not a lot of them.

All 10 comments

Is your problem just with refactoring?

Yes, that's what motivated me to file this issue.

I think we should probably just not split in case a refactoring happens. IMO that's the best way forward. People that want splits want one split and not a lot of them.

@blueyed What do you think?

Can I move forward with implementing this in the manner you suggested above @davidhalter?

@ethan-leba yeah, give it a try - I agree that we should probably not have different settings for this.

It might help to clarify your use case before, so we can try it ourselves based on your example/steps.
Do I understand it correctly that you are using jedi#rename() (<leader>r) with g:jedi#use_splits_not_buffers set to e.g. "right"?
I've just tried it resulting in 9 splits.
I guess it depends on how they are auto-resized/displayed then. I guess you are using set equalalways then?

I am not using this feature myself in general, but would like for it to display changed locations in a new quickfix list window instead of creating new windows in general (by default).
This would basically be what show usages does, but with the additional renaming.

(It would also be nice if there was a separate/new command to undo the changes in one step - as an idea, not necessary to improve it already / fix this issue, of course)

btw: I've noticed that the doc/logic is a bit off here with regard to the g:jedi#use_splits_not_buffers option:
The help says the default is "", but when you set that you get a warning about an unknown option.

Code: https://github.com/davidhalter/jedi-vim/blob/76633a57837021c2d813dc1d23d889a88058844f/pythonx/jedi_vim.py#L1319-L1347

I guess let g:jedi#use_splits_not_buffers = 1 should default to split maybe (which would respect the splitbelow/splitright setting then)?

Great! Yes, I was using jedi#rename in the manner you described. Using the quickfix list seems like a good fix for this, so i'll work on that and add in a bugfix for the above. One question about your comment above, you mentioned that refactoring should _default_ to quickfix, so does that mean there should be a setting to maintain the current behaviour?

Undoing refactors would definitely be useful, maybe I'll look into that after working on this one :+1:

Since @ethan-leba closed the pull request, I'm closing this one as well.

Was this page helpful?
0 / 5 - 0 ratings