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

Handling unsaved buffers (especially with renaming) #405

Open
blueyed opened this issue May 3, 2015 · 7 comments
Open

Handling unsaved buffers (especially with renaming) #405

blueyed opened this issue May 3, 2015 · 7 comments
Labels

Comments

@blueyed
Copy link
Collaborator

blueyed commented May 3, 2015

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?

@blueyed blueyed added the feature label May 3, 2015
@davidhalter
Copy link
Owner

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.

@blueyed
Copy link
Collaborator Author

blueyed commented May 4, 2015

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?

@davidhalter
Copy link
Owner

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.

@blueyed
Copy link
Collaborator Author

blueyed commented May 4, 2015

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).

@davidhalter
Copy link
Owner

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.

@blueyed
Copy link
Collaborator Author

blueyed commented May 4, 2015

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.. :)

@davidhalter
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants