Skip to content

Telescope lsp_workspace_symbols formatting issue with special characters #3477

Open
@lentilus

Description

@lentilus

Description

I am using a language server that returns workspace symbols sometimes containing special character such as [ and ].

Below is the (correct) output from :lua vim.lsp.buf.workspace_symbol()

001K.typst|1 col 1| [File]  [We cannot prove absolute consistency results about ZFC in PA] 
000H.typst|1 col 1| [File] [Definition] [Relativized Quantification] 
000I.typst|1 col 1| [File]  [ZFC: Zermelo-Fraenkel Set Theory with Choice] 
001I.typst|1 col 1| [File]  [PA can reason about ZFC] 
0017.typst|1 col 1| [File]  [ZFC+] 

Telescope however fails to format the output correctly:

╭─────────────────────────── Results ───────────────────────────────────╮
│  000H.typst          file] [definition] [relativized quantifica       │
│  000Z.typst          file] [theorem] [$q(x,y,z)=x^2+x y + y^2 +t      │
│  0017.typst          file]  [zfc+                                     │
│  000I.typst          file]  [zfc: zermelo-fraenkel set theory w       │
│  001K.typst          file]  [we cannot prove absolute consisten       │
│> 001I.typst          file]  [pa can reason about zfc                  │
╰───────────────────────────────────────────────────────────────────────╯
╭──────────────────── LSP Workspace Symbols ────────────────────────────╮
│> zfc                                                            6 / 65│
╰───────────────────────────────────────────────────────────────────────╯

Notice the broken capitalization as well as the mangled brackets before file] and after [zfc+. Pressing <C-q> (in the prompt) to show everything in quick-fix list shows the correct output:

001I.typst|1 col 1| [File]  [PA can reason about ZFC] 
001K.typst|1 col 1| [File]  [We cannot prove absolute consistency results about ZFC in PA] 
000I.typst|1 col 1| [File]  [ZFC: Zermelo-Fraenkel Set Theory with Choice] 
0017.typst|1 col 1| [File]  [ZFC+] 
000Z.typst|1 col 1| [File] [Theorem] [$Q(x,y,z)=x^2+x y + y^2 + y z$ ist rational aequivalent zu $Q'(a,b,c) = 3a^2 + 4b^2 - 4c^2$.] 
000H.typst|1 col 1| [File] [Definition] [Relativized Quantification] 

This is why I think it is a formatting issue.
Any help would be very much appreciated.

Neovim version

NVIM v0.11.1
Build type: Release
LuaJIT 2.1.1741730670

Operating system and version

nixos

Telescope version / branch / rev

telescope 0.11

checkhealth telescope

telescope:                                 require("telescope.health").check()

Checking for required plugins ~
- ✅ OK plenary installed.
- ✅ OK nvim-treesitter installed.

Checking external dependencies ~
- ✅ OK rg: found ripgrep 14.1.1
- ⚠️ WARNING fd: not found. Install [sharkdp/fd](https://github.com/sharkdp/fd) for extended capabilities

Steps to reproduce

Expected behavior

Actual behavior

Minimal config

local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs { "config", "data", "state", "cache" } do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.uv.fs_stat(lazypath) then
  vim.fn.system {
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  }
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  {
    "nvim-telescope/telescope.nvim",
    dependencies = {
      "nvim-lua/plenary.nvim",
    },
    config = function()
      -- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
      require("telescope").setup {}
    end,
  },
}

require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions