NvChad / base46

NvChad's base46 theme plugin with caching ( Total re-write )
Other
194 stars 195 forks source link

Lsp informatin are not red, but are beige. #340

Closed FreeCodeFanatic closed 6 days ago

FreeCodeFanatic commented 6 days ago

Describe the bug The lsp information are not red, in any theme I use, the color is not red, if I select the theme again the lsp information become red, but if i exit and enter again the color will become "beige". I tried clangd, ruff lsp and pyright, all is the same. And for the theme all of them

To Reproduce Just use the default NvChad and a lsp, choose a theme, exit and renter.

Screenshots 2024-09-29_15-57

System

https://github.com/user-attachments/assets/d106f7af-f5fe-405f-8973-2af3bc4f9ec0

siduck commented 6 days ago

show your lspconfig

FreeCodeFanatic commented 6 days ago

i use NvChad 2.5, the lsp is a basic one, used the config from the docs,is just for c and python.

local base = require("nvchad.configs.lspconfig")
local on_attach = base.on_attach
local capabilities = base.capabilities

local lspconfig = require("lspconfig")

lspconfig.clangd.setup {
  cmd = { "clangd-19" },
  on_attach = on_attach,  -- Use the base on_attach function
  capabilities = capabilities,
}

-- Setup for Ruff-LSP
lspconfig.ruff_lsp.setup{
  on_attach = on_attach,
  capabilities = capabilities,
}

lspconfig.pyright.setup({
  on_attach = on_attach,
  capabilities = capabilities,
  settings = {
    python = {
      analysis = {
        typeCheckingMode = 'strict',  
        reportUnusedImport = "none",
      },
    },
  },
})
siduck commented 6 days ago

use our on_init too

siduck commented 6 days ago

https://github.com/NvChad/starter/blob/main/lua/configs/lspconfig.lua#L14

FreeCodeFanatic commented 6 days ago

Thanks a lot, I did not read the code from starter, I just migrate from 2.0 to 2.5. I will let here a example with the modification for other users to see, maybe it will help.

require("nvchad.configs.lspconfig").defaults()

local lspconfig = require "lspconfig"

local nvlsp = require "nvchad.configs.lspconfig"
local lspconfig = require("lspconfig")

--Setup Clangd 
lspconfig.clangd.setup {
  cmd = { "clangd-19" },
    on_attach = nvlsp.on_attach,
    on_init = nvlsp.on_init, --you need to add 
    capabilities = nvlsp.capabilities,
}

-- Setup  Ruff-LSP
lspconfig.ruff_lsp.setup{
    on_attach = nvlsp.on_attach,
    on_init = nvlsp.on_init, --you need to add 
    capabilities = nvlsp.capabilities,
}

--Setup Pyright lsp 
lspconfig.pyright.setup({
    on_attach = nvlsp.on_attach,
    on_init = nvlsp.on_init, --you need to add 
    capabilities = nvlsp.capabilities,
  settings = {
    python = {
      analysis = {
        typeCheckingMode = 'strict',  
        reportUnusedImport = "none",
      },
    },
  },
})