Skip to content

bug: Semantic token highlighting not working in rust format macros #380

@itsfrank

Description

@itsfrank

Neovim version (nvim -v)

v0.11.1

Terminal / multiplexer

Wezterm

Describe the bug

See the screenshots below:

Rose-pine:

Image

Oxocarbon:

Image

Notice how the variable interpolation in the format string gets syntax highlighting in oxocarbon, but not rose pine

Inspect output when hovering over hello on line 3:

Image

Note that I do have tresitter, but disabling it does not seem to help

Rose pine with TS disabled:

Image

Oxocarbon with TS disabled:

Image

Repro

Ensure that rust-analyzer is installed somehow (I used rustup with rustup component add rust-analyzer)

vim.o.packpath = "/tmp/nvim/site"

local plugins = {
  rose_pine = "https://github.com/rose-pine/neovim",
  -- ADD OTHER PLUGINS _NECESSARY_ TO REPRODUCE THE ISSUE
}

for name, url in pairs(plugins) do
  local install_path = "/tmp/nvim/site/pack/test/start/" .. name
  if vim.fn.isdirectory(install_path) == 0 then
    vim.fn.system({ "git", "clone", "--depth=1", url, install_path })
  end
end

require("rose-pine").setup({
  -- ADD ROSÉ PINE CONFIG THAT IS _NECESSARY_ TO REPRODUCE THE ISSUE
})

vim.lsp.config("rust-analyzer", {
  cmd = { "rust-analyzer" },
  root_markers = { "Cargo.toml", ".git" },
  settings = {
    ["rust-analyzer"] = {
      cargo = { allFeatures = true },
      check = { command = "clippy" },
    },
  },
})

vim.api.nvim_create_autocmd("FileType", {
  pattern = "rust",
  callback = function(args)
    vim.lsp.start({
      name = "rust-analyzer",
      cmd = { "rust-analyzer" },
      root_dir = vim.fs.root(args.buf, { "Cargo.toml", ".git" }),
      settings = { ["rust-analyzer"] = { cargo = { allFeatures = true } } },
    })
  end,
})

vim.lsp.enable("rust-analyzer")

vim.cmd("colorscheme rose-pine")

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions