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

fixed auto insert for rope complete #984

Merged
merged 2 commits into from Mar 11, 2019

Conversation

@zcodes
Copy link
Contributor

@zcodes zcodes commented Jan 17, 2019

when define simple class like:

class Foo:
    def __init__(self, name):
        self.{cursor_here}

it will auto insert first complete item and __init__ will insert here. this is annoying for i just want code self.name.

the complete behaviour should respect the user's config of vim option &completeopt. In vim's docs, &completeopt has 'noselect' and 'noinsert' option, so it should worked here.

this pr related to #689 #782

@diraol
Copy link
Contributor

@diraol diraol commented Mar 7, 2019

@zcodes is it going to keep the current behavior?

Can you add some docs about it (or point me to the docs that state that this is the expected behavior), please? =)

@zcodes
Copy link
Contributor Author

@zcodes zcodes commented Mar 7, 2019

@diraol the docs in vim is :h 'completeopt', vim has many flags of option &completeopt, the flags like menu, menuone, noinsert, noselect and so on control the autocomplete behaviour.

e.g. if the set completeopt=menu, and there's only one possible completions, the vim will not popup a menu and just insert the completions, this like auto insert __init__ describe above, user there's no chance to confirm the completions they want or not.

but if set completeopt=menuone,noinsert, vim will popup menu also when there is only one match. for case above, vim will popup a menu with one completion item __init__ and let user choose insert it or escape, if add noselect with &completeopt, vim will even not selected the first completion item.

i think here should following the vim api and respecting the user's configuration.

@diraol
Copy link
Contributor

@diraol diraol commented Mar 7, 2019

Hi @zcodes, thanks for the explanation, I completely agree with you!

I have only one more concern.

This will change python-mode behavior, right?
Because of that, we will impact our users directly after they update the plugin.

So, It would be nice to:

  1. Add this comment/description you wrote above into the commit.
  2. Add a note about it in python-mode docs.

Oh, just one more thing (this is a stylish thing from my side). Can we avoid "anonying" word in the commit message? ;)

For details, see `:h completeopt` in vim.

vim has many flags of option &completeopt, the flags like menu, menuone,
noinsert, noselect and so on control the autocomplete behaviour.

e.g. if the set completeopt=menu, and there's only one possible
completions, the vim will not popup a menu and just insert the
completions, this like auto insert __init__ describe above, user there's
no chance to confirm the completions they want or not.

but if set completeopt=menuone,noinsert, vim will popup menu also when
there is only one match. for case above, vim will popup a menu with one
completion item __init__ and let user choose insert it or escape, if add
noselect with &completeopt, vim will even not selected the first
completion item.
@zcodes zcodes force-pushed the zcodes:fix-anonying-auto-insert branch from 01c0364 to bfd70f7 Mar 8, 2019
@zcodes
Copy link
Contributor Author

@zcodes zcodes commented Mar 8, 2019

@diraol I rewrite the commit message, but I have no idea how to change the python-mode doc, can you help ?

@zcodes zcodes changed the title fixed annoying auto insert for rope complete fixed auto insert for rope complete Mar 8, 2019
@diraol
Copy link
Contributor

@diraol diraol commented Mar 8, 2019

Probably here? or here?

@zcodes
Copy link
Contributor Author

@zcodes zcodes commented Mar 8, 2019

@diraol is 344502c ok ?

@diraol
Copy link
Contributor

@diraol diraol commented Mar 10, 2019

Just perfect @zcodes ! Thank you very much! =)

Do you want to add yourself to the AUTHORS list in this PR?

@zcodes
Copy link
Contributor Author

@zcodes zcodes commented Mar 11, 2019

@diraol Thanks, but it doesn't matter.

@diraol diraol merged commit 7a449a5 into python-mode:develop Mar 11, 2019
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@zcodes zcodes deleted the zcodes:fix-anonying-auto-insert branch Mar 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.