jupyterlab-lsp icon indicating copy to clipboard operation
jupyterlab-lsp copied to clipboard

Hide/show dunder methods and attributes during autocompletion

Open sntgluca opened this issue 3 years ago • 5 comments

Elevator Pitch

As a remote JupyterLab user, often hindered by bandwith limitations, it would be useful, to be able to hide dunder methods and attributes during autocompletion for clarity and performance.

Motivation

Dunder special methods and attributes are supposed to be called implicitly, and most of the time are not interesting during any library or class usage. Arguably, it's similar for _ private methods and attributes.

Design Ideas

In my mind's eye, dunders and private attributes/methods should appear if autocomplete starts explicitly with ._, as in ipywidgets.IntSlider()._. Otherwise they should be hidden.

I don't have any opinion or suggestion about implementation.

Thanks Gianluca

sntgluca avatar Oct 06 '21 14:10 sntgluca

I saw the pylsp comment, I don't quite agree that it should be implemented by the IDE. It seems pretty language-specific to me.

krassowski avatar Oct 06 '21 14:10 krassowski

Also if it's due to bandwidth it has to go into the language server - we can only filter on frontend.

krassowski avatar Oct 06 '21 14:10 krassowski

Wow you're fast :) I am in no position to judge where it belongs, really.

If there's any room for a discussion, in either spaces, I would be happy to follow up...

sntgluca avatar Oct 06 '21 14:10 sntgluca

I don't recall... Did we add message transforming? If so, it seems like something one could write with a little python. I've also considered some declarative approaches like json-e.

bollwyvl avatar Oct 06 '21 15:10 bollwyvl

As mentioned in https://github.com/python-lsp/python-lsp-server/issues/95#issuecomment-991630861 in the ideal scenario, this feature is implemented on both server side (because not sending completion items for dunders will improve performance) and on the client side (because we still need to filter out kernel completions, or at least tell the kernel that we do not want dunders).

krassowski avatar Dec 12 '21 14:12 krassowski