Open blueyed opened 9 years ago
It shouldn't be a problem for Jedi. It's probably a question how we implement it in jedi-vim. You can pass unsaved buffers to Jedi by not mentioning a path, just the source code.
I'm not actually sure why jedi-vim would need another setting there. IMHO it should just work by default.
Agreed. The setting would be only a workaround.
So basically jedi-vim would have to consider and submit any unchanged (Python) buffers.
I think this does not only affect renaming, but is a general feature, e.g. changes in an unsaved file could also show up during completion?
I see two cases here: new buffers without a filename, and changed buffers. For the latter, the existing filename could / should(?) be used (with the buffer's content as source). For new files, some mapping/encoding would be required for jedi-vim to know which buffer this refers to, right?
changes in an unsaved file could also show up during completion?
Isn't this already the case?
I intentionally designed Jedi that way. Unsaved buffers are not taken in consideration if you're not working on them. But the one you're working on is always parsed with the changes.
the one you're working on is always parsed with the changes
Yes, I knew - and that is nice of course! But other unsaved ones are not handled that way. This is not big issue for me - I save a lot - but it causes funny things where you rename things multiple times with jedi-vim (I think).
Hmm you're right! I never thought about it that way. I think in that case we should just abort renaming or not rename that file. IMHO this is very much an edge case and should be treated with abort or something similar.
But if jedi-vim would be submitting/providing contents of changed buffers (instead of letting Jedi read them from disk), this wouldn't have to abort, but would just work. That's what this issue is mainly about.. :)
Now I get it :)
We could just do it by default. Technically we would need to be aware of the fact that just calling update is not enough. We would need to run jedi.Script.usages
again.
While working on the rename feature, I've wondered if it was (easily) possible to make it work on unsaved buffers? It's probably limited by Jedi only being able to handle saved files by default? It might be possible to pass in any unsaved buffers as
Script
objects directly?I've experimented with a new setting
rename_save_buffers
/save_on_rename
, which would call:update
on buffers where something was renamed.What do you think?