telescope.nvim icon indicating copy to clipboard operation
telescope.nvim copied to clipboard

feat(diagnosticts): add option to show the source of the entry

Open Koliras opened this issue 11 months ago • 2 comments

Description

Adds option to show LSP source to diagnostics picker. It's useful when you work on a multilanguage project.

Fixes https://github.com/nvim-telescope/telescope.nvim/issues/2544 Fixes https://github.com/nvim-telescope/telescope.nvim/issues/2110

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

  • [x] :lua require('telescope.builtin').diagnostics({ show_source = true })

In the end of every result there should be the source that created the entry

Configuration:

  • Neovim version (nvim --version): v0.10.2
  • Operating system and version: Ubuntu 24.04.1 LTS

Checklist:

  • [x] My code follows the style guidelines of this project (stylua)
  • [x] I have performed a self-review of my own code
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation (lua annotations)

Koliras avatar Dec 05 '24 22:12 Koliras

Any updates on this? It is a very desirable feature to know the source of the diagnostic. Thanks.

deibit avatar Mar 27 '25 11:03 deibit

Looks like it's a quite demanded feature, is there something wrong with this PR? It's super simple and provides the feature, it can always be improved later, having it is better than not...

fdev31 avatar Apr 04 '25 22:04 fdev31

I could really use this - any idea of when/if it is going to be enabled? Otherwise any workarounds I could implement today?

a-alak avatar Jul 12 '25 20:07 a-alak

Workaround that I have found: In lua/telescope/builtin/__diagnostics.lua, you could change this: text = vim.trim(diagnostic.message:gsub("[\n]", ""))
to this
text = string.format("[%s] %s", diagnostic.source, vim.trim(diagnostic.message:gsub("[\n]", "")))

which adds the diagnostic source to the start of the diagnostic message. There might be some issues with line_width but this is just a temporary fix that anyone could implement

flaszlo2000 avatar Aug 18 '25 14:08 flaszlo2000