Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

836de8b breaks using LSP colors in the custom_highlights #669

Open
milch opened this issue Feb 29, 2024 · 1 comment
Open

836de8b breaks using LSP colors in the custom_highlights #669

milch opened this issue Feb 29, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@milch
Copy link

milch commented Feb 29, 2024

Description

I have some custom highlights set up in my config like this:

	custom_highlights = function()
		local lsp = require("catppuccin.groups.integrations.native_lsp").get()
		return {
			Group1 = { fg = lsp.DiagnosticVirtualTextError.fg, bg = lsp.DiagnosticVirtualTextError.bg },
                        -- ... etc. ...
		}
	end,

It seems that this broke with the following commit: 836de8b, and now I get the following error when catppuccin loads:

Failed to run `config` for catppuccin
...puccin/lua/catppuccin/groups/integrations/native_lsp.lua:4: attempt to index global 'O' (a nil value)
# stacktrace:
  - /catppuccin/lua/catppuccin/groups/integrations/native_lsp.lua:4 _in_ **get**
  - ~/.config/nvim/lua/ui/catppuccin.lua:27 _in_ **v**
  - /catppuccin/lua/catppuccin/lib/hashing.lua:21 _in_ **hash**
  - /catppuccin/lua/catppuccin/lib/hashing.lua:17 _in_ **hash**
  - /catppuccin/lua/catppuccin/init.lua:169 _in_ **setup**

Neovim version

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1703358377

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.9.5/share/nvim"

Run :checkhealth for more info

Terminal and multiplexer

wezterm 20240203-110809-5046fc22 with tmux next-3.4

Catppuccin version / branch / rev

See above

Steps to reproduce

  1. nvim -u repro.lua
  2. It fails on load

Expected behavior

I should be able to use LSP colors in the custom highlights group

Actual behavior

Error on load:

Failed to run `config` for catppuccin
...puccin/lua/catppuccin/groups/integrations/native_lsp.lua:4: attempt to index global 'O' (a nil value)
# stacktrace:
  - /catppuccin/lua/catppuccin/groups/integrations/native_lsp.lua:4 _in_ **get**
  - ~/.config/nvim/lua/ui/catppuccin.lua:27 _in_ **v**
  - /catppuccin/lua/catppuccin/lib/hashing.lua:21 _in_ **hash**
  - /catppuccin/lua/catppuccin/lib/hashing.lua:17 _in_ **hash**
  - /catppuccin/lua/catppuccin/init.lua:169 _in_ **setup**

Repro

-- DO NOT change the paths and don't remove the colorscheme
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.loop.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 = {
	{
		"catppuccin/nvim",
		name = "catppuccin",
		commit = "836de8bc1898250b69332e66cbe993058870f849",
		opts = {
			integrations = {
				custom_highlights = function()
					local lsp = require("catppuccin.groups.integrations.native_lsp").get()
					return {
						MyHighlightGroup = {
							fg = lsp.DiagnosticVirtualTextError.fg,
							bg = lsp.DiagnosticVirtualTextError.bg,
						},
					}
				end,
			},
		},
	},
}
require("lazy").setup(plugins, {
	root = root .. "/plugins",
})

vim.cmd.colorscheme("catppuccin")
@milch milch added the bug Something isn't working label Feb 29, 2024
@mrtnvgr
Copy link
Collaborator

mrtnvgr commented Feb 29, 2024

Take a look at #667 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants