python-language-server icon indicating copy to clipboard operation
python-language-server copied to clipboard

"python.autoComplete.addBrackets": true adds brackets to imported functions

Open DonJayamanne opened this issue 6 years ago • 6 comments

@astier commented on Wed Jan 30 2019

Environment data

  • VS Code version: 1.30.2
  • Extension version (available under the Extensions sidebar): 2019.1.0
  • OS and version: Arch
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda

Expected behaviour

Brackets should not be added to imported functions.

Actual behaviour

Brackets are added to imported functions.

Steps to reproduce:

  1. Create a python file
  2. Type from time import tim
  3. Press tab or enter to autocomplete the function time
  4. See how brackets are added at the end of the time-function from time import time()

@d3r3kk commented on Thu Jan 31 2019

Verified, thanks for the report @astier!

DonJayamanne avatar Jan 31 '19 23:01 DonJayamanne

I can replicate this at my end using latest LS.

DonJayamanne avatar Jan 31 '19 23:01 DonJayamanne

Is this a language server issue? It happens for both Language Server as well as for Jedi...

d3r3kk avatar Jan 31 '19 23:01 d3r3kk

New LS doesn't do that.

image

image

MikhailArkhipov avatar Feb 15 '19 22:02 MikhailArkhipov

This is back after #1241, with the above test case no longer working.

jakebailey avatar Jun 27 '19 23:06 jakebailey

https://github.com/microsoft/python-language-server/blob/master/src/LanguageServer/Impl/Completion/CompletionItemSource.cs#L46-46 - should not be adding () if this is completion in import statement (i.e. coming from GetResultFromImportSearch)

MikhailArkhipov avatar Oct 03 '19 17:10 MikhailArkhipov

Having this issue right now.

timkofu avatar Sep 19 '20 11:09 timkofu