Python-language-server: python.autoComplete.addBrackets does not work

Created on 3 Apr 2019  路  15Comments  路  Source: microsoft/python-language-server

Using Microsoft Python Language Server version 0.2.41.0, the setting python.autoComplete.addBrackets does not add parentheses for functions such as "print" and "input". Switching back to jedi fixes the issue.

See MicrosoftDocs/intellicode#80 for more details.

bug intellisense

All 15 comments

Can confirm. Using this with the 2019.1 release on neovim

Thanks for the fix and close. To get this to work, it is a simple matter of adding this option to the settings file?

To have brackets auto added, yes. It's not enabled by default.

I'm using the language server from coc.nvim and they have a fork of this commit:

https://github.com/microsoft/vscode-python/commit/16899f6b13477786212f29eb3cb7a459b5ebf0a4

I tried to find out where the settings.json files was located like so:

```
esn89shell: find . -type f -name "settings.json"
~/.config/nvim/plugged/coc.nvim/node_modules/vscode-uri/.vscode/settings.json
~/.config/nvim/plugged/coc.nvim/node_modules/vscode-languageserver/node_modules/vscode-uri/.vscode/settings.json

And inside both of these files, I added:

"python.autoComplete.addBrackets": true

and still had no luck getting it to work. Any ideas?

The commit looks like the extension, not the LS. Adding brackets works if you type pri and then TAB from the completion list. I get print() inserted. How it works is that LS returns print($0) snippet as insertion text for the print label. Does vim handle snippets in the language server protocol?

Thanks @MikhailArkhipov

You are right, maybe it is a commit not related to MPLS. I was just wondering because I remember in a commit to master, you have fixed:
https://github.com/microsoft/python-language-server/pull/1241

Unfortunately, in mine it does not work with tab/print.

I am actually using a version of it that's built manually via the instructions here: https://github.com/microsoft/python-language-server/blob/master/CONTRIBUTING.md#setup

The language server itself is working but I am unable to find a settings.json file in repository that I cloned. can I just touch settings.json somewhere? If so, where should the settings.json be located?

This should be reopened as it is still not working :(

Which specific example does not work?

Which specific example does not work?

For example this one:

the setting python.autoComplete.addBrackets does not add parentheses for functions such as "print" and "input". Switching back to jedi fixes the issue.

What Python version is selected?

What Python version is selected?

Python 3.8.5

I am having the same issue.
"python.pythonPath": "/usr/local/bin/python3",
"python.languageServer": "Microsoft",
"python.autoComplete.addBrackets": true

VS Code
Version: 1.48.0
Commit: db40434f562994116e5b21c24015a2e40b2504e6
Date: 2020-08-13T08:03:27.059Z (3 days ago)
Electron: 7.3.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 19.6.0

Something changed either in protocol or core extension. PR https://github.com/microsoft/python-language-server/pull/2113

@Brodersen, @CzJLee - what is your Python extension version?

Looks like there was a bug in pre-release version of LSP that we started using https://github.com/microsoft/vscode-python/pull/13511 should fix this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yk3823 picture yk3823  路  5Comments

mostafaeweda picture mostafaeweda  路  6Comments

ghost picture ghost  路  6Comments

jakebailey picture jakebailey  路  6Comments

dschiller picture dschiller  路  5Comments