-
Notifications
You must be signed in to change notification settings - Fork 768
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
[WIP] Add RefactorRename subcommand to Python completer #425
Conversation
Thanks! This seems to me, though @puremourning should probably take a look as well since he wrote #417. Reviewed 9 of 9 files at r1. Comments from the review on Reviewable.io |
YAY \o/ This is very cool. Though I think there is some overlap with #417 (around the test matchers). So they might conflict. Other than that 👍 Review status: all files reviewed at latest revision, all discussions resolved. Comments from the review on Reviewable.io |
☔ The latest upstream changes (presumably #417) made this pull request unmergeable. Please resolve the merge conflicts. |
I did give this a go, and FWIW it is probably worth noting the limitations of this (something I also need to do for the javascript and typescript completers): Jedi can only see modules that are imported. With javascript and typescript completers there are "project" files which, when configured, tell the semantic engine about files it would't normally be able see. I worry that this limits the effectiveness of python renames, in the sense that it is potentially incomplete. Here's a trivial example: Reviewed 9 of 9 files at r1. Comments from the review on Reviewable.io |
6494f25
to
b837536
Compare
I'm not sure I would ship a "half" feature to the user, but is true that |
It's concerning, I agree. Thoughts, everyone? Which of you would/wouldn't like to ship this, and why? I'm on the fence. |
Fixed the conflicts.
This can be done by adding files to
This is already affecting the Reviewed 2 of 4 files at r2. Comments from the review on Reviewable.io |
Basically what we would do is a "
What I'm worried about with this is that there are some library which are really expensive to load and to work with and using only what is loaded (like jedi do right now) is better IMHO, but I could be wrong in this, not sure.
This is absolutely true. Should we put it in the docs even if it is jedi behaviour? |
Yes, I have a prototype in this branch. Users create a Here's a import os
import fnmatch
DIR_OF_CURRENT_SCRIPT = os.path.dirname( os.path.abspath( __file__ ) )
def GetAdditionalSources():
additional_sources = []
for root, dirnames, filenames in os.walk( DIR_OF_CURRENT_SCRIPT ):
for filename in fnmatch.filter( filenames, '*.py' ):
if not filename.endswith( '.ycm_extra_conf.py' ):
additional_sources.append( os.path.join( root, filename ) )
return additional_sources
def PythonSettings( **kwargs ):
return {
'additional_sources': GetAdditionalSources()
} What do you think of this approach? We can easily extend it to preloaded imports.
This seems to work fine for a project like
I think so. We could add a note like "This only works for the current file and all files directly or indirectly imported by this file" for the Review status: all files reviewed at latest revision, all discussions resolved. Comments from the review on Reviewable.io |
@micbou I'm fine with a Review status: all files reviewed at latest revision, all discussions resolved. Comments from the review on Reviewable.io |
I agree. Just a note for later. Review status: all files reviewed at latest revision, all discussions resolved. Comments from the review on Reviewable.io |
We had a chat about this. In summary, here are my thoughts:
def PythonSettings( **kwargs ):
return {
'jedi_settings': { ... jedi settings object ... },
'ycmd_rocks': True,
} This makes the code simple and avoids lots of pernickety translations which are potentially somewhat brittle. You ask about being a separate PR, but I feel like we need this ability for renames (which are destructive) to be reasonably shippable. Can be 2 PRs, but I think we need to merge both before we announce the feature ;) Renaming |
On reflection |
I agree that we should namespace jedi options under a jedi-specific key. That leaves us room for the future. |
☔ The latest upstream changes (presumably #513) made this pull request unmergeable. Please resolve the merge conflicts. |
Since it's been 2 years since this PR has been updated, I think it's safe to close it. 😉 |
Heavily inspired by PR #417.
Jedi does not return the end location of a definition so we find it by computing its name length.
Update JediHTTP submodule to include PR vheon/JediHTTP#13.
Refactor the subcommands Python tests to reduce code duplication.
This change is