Skip to content

Duplicated peek_definition when css_variables is attached #1534

Description

@rodhash

Describe the bug

When LSP css_variables is attached we get duplicated peek_definition.

Image

Steps to reproduce

Minimal:

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require "plugins.extra.lazyGlobals"

require("lazy.minit").repro({
  spec = {
    -- add any other plugins here

    -- noice
    {
      "folke/noice.nvim",
      opts = {},
      dependencies = {
        "MunifTanjim/nui.nvim",
        "rcarriga/nvim-notify",
      },
    },

    -- LSP
    {
      {
        "williamboman/mason.nvim",
        opts = {},
      },
      {
        "williamboman/mason-lspconfig.nvim",
        config = function ()
          require("mason-lspconfig").setup {
            ensure_installed = { "cssls", "css_variables" },
          }
        end
      },
      {
        "neovim/nvim-lspconfig",
        dependencies = {
          "williamboman/mason-lspconfig.nvim",
        },
        config = function ()

          local lspconfig = require("lspconfig")

          -- List of LSP servers
          local servers = { "cssls", "css_variables" }

          -- Mapping of LSP names to their actual executable commands
          local server_executables = {
            cssls = "vscode-css-language-server",
            css_variables = "css-variables-language-server",
          }

          -- Function to check if an LSP executable exists
          local function is_executable(server)
            local cmd = server_executables[server] or server
            return vim.fn.executable(cmd) == 1
          end

          -- Setup LSPs only if installed
          for _, server in ipairs(servers) do
            if is_executable(server) then
              lspconfig[server].setup({})
            else
              vim.notify(server .. " LSP is not installed", vim.log.levels.WARN)
            end
          end

        end
      },
    },

    -- lspsaga
    {
      "glepnir/lspsaga.nvim",
      dependencies = {
        { "nvim-treesitter/nvim-treesitter" },
      },
      opts = {}
    },

  },
})

Sample CSS:

:root {
  --white: #ffffff;
  --shadow-1: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

nav {
  background: var(--white);
  box-shadow: var(--shadow-1);
}
  1. nvim -u "minimal" foo.css
  2. Over any of the two variables run: Lspsaga peek_definition

Expected behavior

Exptected to see only 1 pop-up (as it happens when that LSP is not active).

Maybe the issue relies on the LSP itself but is there a way to avoid Lspsaga triggering this duplicated pop-up?

Neovim version (nvim -v)

v0.11.0-dev-1517+ga37784ad83

lspsaga commit

778d56f

Terminal name/version

iterm2 3.5.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions