NvChad with auto-session wrong colors after LSP hook
patrykk21 opened this issue ยท comments
Describe the bug
I'm not sure this is an NvChad issue but I have to start somewhere.
I copied most of the files of NvChad into my nvim configuration so that I can tweak here and there the parts I need but is mostly untouched.
I'm having a weird issue when using auto-session
with lazy = false
where the colors suddenly change to something that is completely different from my color scheme.
I'm using lazy = false
because I couldn't figure out a way to load the plugin through lazy
.
Here's a video of what happens:
Screen.Recording.2024-05-10.at.02.09.29.mov
As you can see when I load the file with auto-session enabled the color scheme changes and highlights some keywords in light blue.
When I disable it it doesn't happen (correct behaviour)
To Reproduce
Steps to reproduce the behavior:
- Add
auto-session.lua
toplugins
- With content of
return {
"rmagatti/auto-session",
lazy = false,
enabled = true,
config = function()
require("auto-session").setup({
log_level = "error",
auto_session_suppress_dirs = { "~/", "~/Projects", "~/Downloads", "/" },
})
end,
}
Expected behavior
The color scheme is kept as is
Screenshots
Already added above
Desktop (please complete the following information):
-
OSX
-
Kitty
-
vim --version
NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1710088188system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.9.5/share/nvim"
Run :checkhealth for more info
Additional context
No idea if this is related to NvChad or not but I couldn't figure out how exactly this framework works and fix the issue
simplescreenrecorder-2024-05-10_08.27.28.mp4
unable to reproduce, i hope you are using latest nvchad
have you disabled semantic highlighting?
I'm using NvChad 2.5.
Not sure what semantic highlight is? Could you provide more info?
I'm adding the plugin setting to plugin/auto-session.lua
not init.lua
, does that matter?
I think I'm using NvChad completely wrong and that's why I'm having this issue.
I pushed my dotfiles here if you are willing to have a look: https://github.com/patrykk21/dotfiles/tree/master/nvim
Particularly I think I'm very wrong about the plugins/init.lua
๐
But I didn't know how to update the dependencies or configurations of some plugins without copy and pasting the config.
i'll test your config tonight and let u knowo
I'll buy a couple of coffees for the effort ๐๐ป Thank you so much
@patrykk21 go to your lspconfig and add on_init for lua_ls
Thank you for your help!
So by adding dofile(vim.g.nvchad_theme .. "syntax")
I don't have the issue with the session plugin anymore.
I added it to the config step of 'lspconfig` plugin.
But with or without the session plugin I noticed that my colors don't change whether I have LSP turned on or not, I thought LSP should be coloring text parts better?
I just want to make sure I'm not missing out on some LSP improvements
PS. sent you some ๐ต for โ
Oh... It's semanticTokens
and NvChad disables them by default. Figured that out :)
I like it more disabled tbf hahah feels faster
I'd have a question about dofile
- if I may.
What is it exactly and how do I use it properly?
Thanks for the ๐ธ
Oh... It's
semanticTokens
and NvChad disables them by default. Figured that out :) I like it more disabled tbf hahah feels fasterI'd have a question about
dofile
- if I may. What is it exactly and how do I use it properly?
dofile basically loads a lua file, like require
function can be used to import lua modules with names. But in dofile you have to enter full path of the lua file. thats why i used the vim.g.base46_cache
global !!
I thought LSP should be coloring text parts better
yes it should but i think in some languages only, if you get better semantic token highlights on non nvchad configs then raise an issue on base46 repo. Also you need to add our base46 semantic_tokens integration . Only a set of base46 integrations are loaded and compiled by default in nvchad.
To add a base46 integration, check https://nvchad.com/docs/config/theming/#integrations