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

Disable auto-adding brackets/parentheses on completion #14307

Open
TBSenseo opened this issue Nov 25, 2020 · 4 comments
Open

Disable auto-adding brackets/parentheses on completion #14307

TBSenseo opened this issue Nov 25, 2020 · 4 comments
Assignees

Comments

@TBSenseo
Copy link

I am using Spyder 4.2.0 in Python 3.7.8 on Windows installed via pip without Kite and such the default completion configuration (upgraded to most recent versions) with the python language server (0.36.1) and Rope (0.18.0) enabled (options "Enable code completion", "Show completion details", "Show completions on the fly", "Enable code snippets" enabled in the Completion and linting section in the Preferences.

When I choose any suggestion from the auto-completion list, the editor always adds brackets and the required parameters after the completed term independent on in if it is a variable, a function or a class. This is annoying since I kind of always delete the brackets and parameters afterwards due to various reasons (brackets after variables are not allowed, for function calls and class constructor calls I like to type the opening bracket myself and then add the various arguments myself following the displayed calltips from the Introspection feature and for type hints (": ") brackets are not allowed, too).

Can you please either disable auto-adding the brackets and required parameters for term completion or add an option to disable/enable it like it was before in Spyder 3.

This ticket seems to be related to what we had in issue #2602, but this was for the old version and it seems the code has changed a lot since then.

@dalthviz
Copy link
Member

Hi @TBSenseo I think to prevent that you will need to uncheck the Enable code snippets option. Just in case pinging @andfoy and @ccordoba12 (maybe they have more info about the current config possibilities).

@TBSenseo
Copy link
Author

TBSenseo commented Nov 26, 2020

Thanks @dalthviz. This seems to have solved my problem. I understand "snippets" as being prepared code blocks that can be inserted quickly and then filled with in-situ variable names, etc, like the insertion of "if <condition> <code> else <else code>" snippets in Visual Studio. Maybe rename the configuration item to "Append function prototype parameters to completed terms".

What is your thought of my suggestion?

@la-foglia
Copy link

Hi guys! Happy to join the discussion!
I stepped into the same issue here (spyder 4.1.5) and disabling code snippets is a good workaround for parenthesis added after classes and variables.
However, it spoils the autocompletion of methods and functions.
Is there a way to achieve one (not having parenthesis added after classes) without loosing the other?

Thanks!

@ccordoba12
Copy link
Member

ccordoba12 commented Apr 3, 2021

Hey @la-foglia, yes, there is a way to do that (and we consider the current behavior a bug). We'll try to fix it in a future release.

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

No branches or pull requests

4 participants