-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
PR: Move completion plugin files to manager plugin and create a completions.manager.api file #13403
PR: Move completion plugin files to manager plugin and create a completions.manager.api file #13403
Conversation
cef8916
to
5c1e118
Compare
5c1e118
to
c580176
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really necessary? Why not leave all completion clients (LSP, fallback and Kite) along with its manager in the current completion
module?
That way, the only thing you'd need to move is the manager to its own submodule. So the structure would be
- completion
- manager
- languageserver
- kite
- fallback
We also talked about this with @andfoy and consider it makes more sense to leave everything related to completions inside completion
. Although they are different plugins, I think there's no limitation in the current API that would prevent us to do that, right?
Yes.
Cause they are used as plugins but they are not written as plugins.
Yes, there is. The idea is to avoid special casing things, completions are doing a lot of special casing and assumptions, for no gain just more complexity. Also it is not extendable and there are circular dependencies in the way is written that should not exist. If you want the folders to be close to one another the name can be
I also talked to you months ago and you agreed with this and you also agreed it was a hack needed at the time (how it is right now, due to time constraints), but it was actually not the way to go. |
I understand that. But just as you told me that a third-party plugin can contain several smaller Spyder plugins in the same Python package (something I think Tom is purporting to do with his own plugin), I don't understand why it's not possible to have all completion plugins inside a If that's really impossible due to the new API, then it's a really inflexible design and we need to change it.
I'm not opposed to disentangle the plugins and make things clearer. I just think it's easier for new contributors and us in the future to leave all plugins related to completions in a |
Please describe in detail what the real limitation is because I don't understand it, sorry. |
That does not mean they have to be bundled in a single folder, which is what you are proposing.
Yes and no. He is providing several project types but it is just a single plugin. And even if they were separate plugins the folder structure I would suggest would be something like: (which is going on the API docs)
It is possible, however it would be a very bad practice and I strongly disagree with it. |
This is what I'm proposing in this case, with
Ok, I understand your point and noted your disagreement. However, @andfoy and I (who are really in charge of maintaining this code), prefer to break good practices to have a code structure that makes sense to us. So please follow my suggestion above and in this PR only move |
d523624
to
6ca880f
Compare
8ba19cf
to
243cf6b
Compare
Sorry, this part of my comment is flawed because I was thinking on the way things were organized in Spyder 3. Still, since it's a matter of preference (not a technical issue) to have the completion plugins at the same level of the rest, I think we should leave things as they are now (with the exception of the |
243cf6b
to
130e691
Compare
130e691
to
b6206fd
Compare
Fixed, see the issue description for more information on the other files that were moved and the rationale. Also, this is blocked by #13408. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However it is not clear why a completion provider plugin (like fallback, kite, LSP) needs to import things from the languageserver plugin since the manager plugin already made that assumption for every other plugin that will sit on top of the LSP protocol. For this reason, spyder.plugins.completion.manager.api is where all the mixins and constants are now moved into.
I totally agree with the way you reorganized things (and this is the kind of disentanglement I was talking about). We were aware of this mess with @andfoy but didn't have time to fix it for Spyder 4. Thanks for taking the time to do it for Spyder 5.
I left a couple of minor comments, otherwise looks good to me now.
b6206fd
to
a3ac6a2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @goanpeca!
To make this migration simpler, this PR:
manager
folder.__init__
content tocompletions/api.py
. (So a provider depends on the manager and not on another provider)spyder.api.completions
tocompletions/api.py
(So a provider depends on the manager and not on another provider)The completion manager already makes the assumption that it will follow the LSP protocol (plus a couple of specific things like the on mouse move needed for kite). However it is not clear why a completion provider plugin (like fallback, kite, LSP) needs to import things from the
languageserver
plugin since themanager
plugin already made that assumption for every other plugin that will sit on top of the LSP protocol. For this reason,spyder.plugins.completion.manager.api
is where all the mixins and constants are now moved into.The reason for the decoupling: if I deleted the
kite
or thelanguageserver
or thefallback
folder, Spyder should be able to start and run with whatever providers were found using the plugins entry points.kite
or thelanguageserver
or thefallback
should only depend onspyder.plugins.completion.manager
This will make the PR that actually makes the migration to the API much simpler.
Affirmation
By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.
I certify the above statement is true and correct: @goanpeca