Add typescript + jinja LSP.
This commit is contained in:
@@ -4,7 +4,7 @@ require("nvchad.configs.lspconfig").defaults()
|
||||
local lspconfig = require "lspconfig"
|
||||
|
||||
-- EXAMPLE
|
||||
local servers = { "html", "cssls" }
|
||||
local servers = { "html", "cssls", "volar", "typescript-tools", "tsserver" }
|
||||
local nvlsp = require "nvchad.configs.lspconfig"
|
||||
|
||||
-- lsps with default config
|
||||
@@ -39,15 +39,20 @@ require("lspconfig").pyright.setup {
|
||||
-- ignore = { "*" }, -- using ruff
|
||||
-- typecheckingmode = "off", -- using mypy
|
||||
diagnosticseverityoverrides = {
|
||||
reportmissingimports = false,
|
||||
-- reportattributeaccessissue = false,
|
||||
reportMissingImports = false,
|
||||
reportUnusedVariable = false,
|
||||
reportIncompatibleVariableOverride = false,
|
||||
-- reportAttributeAccessIssue = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- require("lspconfig").tsserver.setup {
|
||||
-- filetypes = { "html", "javascript", "htmldjango" },
|
||||
-- }
|
||||
|
||||
-- require("lspconfig").pylsp.setup {
|
||||
-- settings = {
|
||||
-- pylsp = {
|
||||
@@ -60,3 +65,36 @@ require("lspconfig").pyright.setup {
|
||||
-- },
|
||||
-- },
|
||||
-- }
|
||||
--
|
||||
|
||||
local configs = require "lspconfig.configs"
|
||||
|
||||
if not configs.jinja_lsp then
|
||||
configs.jinja_lsp = {
|
||||
default_config = {
|
||||
name = "jinja-lsp",
|
||||
cmd = { "/home/legrems/.cargo/bin/jinja-lsp" },
|
||||
filetypes = { "jinja", "rust", "htmldjango", "javascript" },
|
||||
root_dir = function()
|
||||
return "."
|
||||
end,
|
||||
init_options = {
|
||||
templates = "./templates",
|
||||
backend = { "./src" },
|
||||
lang = "rust",
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
|
||||
lspconfig.jinja_lsp.setup {
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
lspconfig.tailwindcss.setup {
|
||||
cmd = { "tailwindcss-language-server", "--stdio" },
|
||||
filetypes = { "html", "css", "javascript", "htmldjango" },
|
||||
root_dir = lspconfig.util.root_pattern("tailwind.config.js", "tailwind.config.cjs", "tailwind.config.ts"),
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
return {
|
||||
ensure_installed = { "lua_ls", "ts_ls" },
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
local options = {
|
||||
ensure_installed = { "lua-language-server" }, -- not an option from mason.nvim
|
||||
ensure_installed = { "lua-language-server", "jinja-lsp" }, -- not an option from mason.nvim
|
||||
|
||||
PATH = "prepand",
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
return {
|
||||
{ "Replace {{X}} with {{ X }} in jinja template", "%s/{{\\(.[^ ]*\\)}}/{{ \\1 }}/g" },
|
||||
{ "Replace a text newline with a carriage return", "%s/\\\\n/\\r/g" },
|
||||
}
|
||||
|
||||
@@ -293,6 +293,7 @@ local options = {
|
||||
["<C-v>"] = custom_actions.multi_selection_vsplit,
|
||||
["<C-X>"] = custom_actions.multi_selection_split,
|
||||
["<C-T>"] = custom_actions.multi_selection_tab,
|
||||
-- ["<C-e>"] = custom_actions.set_extension_files,
|
||||
},
|
||||
n = i,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user