pappasam / jedi-language-server

A Python language server exclusively for Jedi. If Jedi supports it well, this language server should too.
MIT License
574 stars 44 forks source link

Parentheses autocompletion in VSCode+Python Extension #301

Open jhonabreul opened 5 months ago

jhonabreul commented 5 months ago

Is there a way to enable function parentheses autocompletion when selecting Jedi as Language Server in the VSCode Python extension?

With Pylance, this can be achieved by setting this "python.autocomplete.addBrackets": true, as you can see below: pylance

It would be good that we could configure this behavior for the Jedi Language Server. Even more, one could argue that when autocompleting class names the parentheses could be also added assuming class instantiation. For enums it does not make sense, though.

jaredbroad commented 5 months ago

@pappasam The point of @jhonabreul's question is that we see the JLS complete enums with parentheses as well as classes and it annoys people that they have to manually delete the added() on each enum used.

jhonabreul commented 5 months ago

Edited the issue. It would be really nice to be able to enable parentheses autocompletion for functions and maybe classes (not enums) in VSCode+Python extension+Jedi Language Server

davidhalter commented 5 months ago

FYI: Jedi's own parentheses completion does not complete classes whatsoever. So I feel like jedi-language-server has it's own logic there.

dimbleby commented 5 months ago

https://github.com/pappasam/jedi-language-server/blob/dff0f122f06e8ce3b5ade55f039dec951057edbd/jedi_language_server/jedi_utils.py#L430-L431

I expect a merge request to make this test smarter would be welcomed

pappasam commented 5 months ago

https://github.com/pappasam/jedi-language-server/blob/dff0f122f06e8ce3b5ade55f039dec951057edbd/jedi_language_server/jedi_utils.py#L430-L431

I expect a merge request to make this test smarter would be welcomed

I'm definitely open to an enhancement here, PR welcome!