jupyter-lsp / jupyterlab-lsp

Coding assistance for JupyterLab (code navigation + hover suggestions + linters + autocompletion + rename) using Language Server Protocol
https://jupyterlab-lsp.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.8k stars 148 forks source link

Hide/show dunder methods and attributes during autocompletion #685

Open sntgluca opened 3 years ago

sntgluca commented 3 years ago

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

krassowski commented 3 years ago

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 commented 3 years ago

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

sntgluca commented 3 years ago

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...

bollwyvl commented 3 years ago

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.

krassowski commented 2 years ago

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).