emacs-lsp / lsp-ui

UI integrations for lsp-mode
https://emacs-lsp.github.io/lsp-ui
GNU General Public License v3.0
1.04k stars 139 forks source link

Python + imenu: too many items #254

Open emosesPatreon opened 5 years ago

emosesPatreon commented 5 years ago

I'm using MS's python-language-server implementation. This reports back a) all the imports as Modules, and b) within each function, a (Function) item that actually represents the function, and all the local variables within the function. That's way too much information to be useful in the imenu popup.

What I'd actually like is a list of all the classes and defs. So I'd like some way to collapse down the (Function) marker into the name of the function it represents, and also filter out all the noise, either by type or level.

screen shot 2019-03-04 at 3 31 11 pm
yyoncho commented 5 years ago

You may use something like https://www.emacswiki.org/emacs/HideLines to hide the stuff that you do not want.

As a side note, I am planning to implement treelike view for the symbols in https://github.com/emacs-lsp/lsp-treemacs

failable commented 3 years ago

Can I ignore variables inside functions?

sandinmyjoints commented 3 years ago

I have a similar issue. It would be nice if nodes in this tree view could collapse (similar to how treemacs nodes collapse and expand, bound to TAB by default I believe), and the initial level of depth that is shown were configurable.

gmoutso commented 2 years ago

Is this option given by lsp-imenu-index-symbol-kinds?

Qwarctick commented 2 years ago

Is this option given by lsp-imenu-index-symbol-kinds?

Yup, you can use it to customize items in the imenu. Personally, I use the following:

(setq lsp-imenu-index-symbol-kinds '(Class Method Function Enum))
chookity-pokk commented 7 months ago

@emosesPatreon Should this issue be close considering the last comment is an answer to the issue? Also, thank you @PhilippeNoel1 for the answer, that is exactly what I was looking for!