Completions unexpectedly add parentheses
See original GitHub issueCopied from https://github.com/microsoft/vscode-python/issues/15858.
Environment data
- VS Code version: 1.55.0
- Extension version (available under the Extensions sidebar): 2021.3.680753044
- OS and version: Ubuntu 20.04 LTS
- Python version: 3.7, deadsnakes
- Type of virtual environment used: virtualenv
- Value of the
python.languageServer
setting: JediLSP
Expected behaviour
class Thing: pass
Th<tab> # should complete to:
Thing| # cursor after completed word
Actual behaviour
class Thing: pass
Th<tab> # should complete to:
Thing(|) # cursor between completed parens
As far as I can tell this is specific to the JediLSP integration – changing my language server to Jedi results in the expected completion.
It looks like this may also vary by Python version – in another codebase I’m working on (in a Python 3.5 virtualenv) I don’t get this behaviour.
I can maybe see why this is maybe useful if you’re planning to construct an instance or calling a function, though there are many other places where callable symbols are used in which you don’t want this to happen – passing them as callbacks and type annotations for example.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Add parenthesis after auto-completing methods #1184 - GitHub
If I've a class A with doSomething() method defined on it and I do this - A a; a.doSo it pops up doSomething...
Read more >Git can't add file - Stack Overflow
Assuming you've escape the parentheses, you're now passing two files to git add , one called "Default" and one called "(OSX).sublime-keymap" ...
Read more >Auto-complete adds parentheses at the wrong place.
Auto-complete adds parentheses at the wrong place. ... Place the cursor under the commented line and retype the commented above line exactly as...
Read more >Automatically close parenthesis when we open it - MathWorks
At the current time, the only automatic completion offered, i.e., closing of parens, is at the command line, in the simple fashion shown...
Read more >Cannot disable auto-insert pair brackets – Rider Support
Have you tried to disable completion in "File | Settings | Editor | General | Code Completion" -> "Automatically insert parentheses after ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think it’s https://github.com/pappasam/jedi-language-server/blob/1d30a5ae7fd441880a9f3343911f1bfef370bd40/jedi_language_server/jedi_utils.py#L284 (the
get_snippet_signature
function).If the line number is necessary, it will be better to reference a commit hash (or a tag) than a branch.
@PeterJCLaw since this is now being tracked elsewhere, I’m going to close this issue here. Please let me know if you disagree!