nvim-navic icon indicating copy to clipboard operation
nvim-navic copied to clipboard

[Idea] Add scope information to `Telescope` pickers

Open pidgeon777 opened this issue 2 years ago • 3 comments

It would be great to add a Scope column to any Telescope picker as follows, to show the scope of each listed item:

┌───────────────────────────────────────────────────────┐
│                        Previewer                      │
├───────────────────────────────────────────────────────┤
│                                                       │
│   *************************************************   │
│   *************************************************   │
│   *************************************************   │
│   *************************************************   │
│   *************************************************   │
│   *************************************************   │
│   *************************************************   │
│   *************************************************   │
│                                                       │
├─────────────────┬────────────────┬────────────────────┤
│ Filepath        │ Scope          │ Text               │
├─────────────────┼────────────────┼────────────────────┤
│ C:\path\file_1  │ A > B > C >    │ X                  │
│ C:\path\file_2  │ A >            │ Y                  │
│ C:\path\file_2  │ D >            │ Z                  │
│ C:\path\file_2  │ E >            │ W                  │
└─────────────────┴────────────────┴────────────────────┘

Filepath:

  • Optional display.
  • Relative/Absolute etc.

Scope:

  • The scope information may come from LSP (if available on the buffer) or tags (if scope information is available).
  • May be C++ classes, functions, Markdown sections.
  • Display only parent scope or full hierarchy.
  • Plugin based? (e.g. nvim-navic).

Text:

  • Any kind of searched text (LSP Symbol, visual string, diagnostic, etc.).

pidgeon777 avatar Oct 13 '23 10:10 pidgeon777

Maybe a Telescope extension / action could be developed?

An example of possible action:

telescope.actions.send_to_navic

So that all of the telescope results are formatted as suggested above.

https://github.com/nvim-telescope/telescope.nvim/issues/2740

pidgeon777 avatar Oct 13 '23 10:10 pidgeon777

Not sure I understand the idea here? Are you suggesting something like Navbuddy?

SmiteshP avatar Nov 30 '23 11:11 SmiteshP

As far as i understand, it's not the same as Navbuddy.

Navbuddy's telescope() command searches symbols in a single scope. This solution would search symbols in all scopes same as default telescope lsp_document_symbols(), but in addition to symbol name and type would also show the enclosing scope.

I would also like to see the enclosing scope when searching through all symbols.

Dooez avatar Feb 09 '24 09:02 Dooez