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

Python + imenu: too many items

Open emosesPatreon opened this issue 5 years ago • 6 comments

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

emosesPatreon avatar Mar 04 '19 23:03 emosesPatreon

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

yyoncho avatar Mar 05 '19 16:03 yyoncho

Can I ignore variables inside functions?

failable avatar Oct 14 '20 07:10 failable

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.

sandinmyjoints avatar Jun 28 '21 21:06 sandinmyjoints

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

gmoutso avatar Apr 07 '22 18:04 gmoutso

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

Qwarctick avatar Jul 08 '22 14:07 Qwarctick

@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!

chookity-pokk avatar Jan 28 '24 15:01 chookity-pokk