Add typescript + jinja LSP.

This commit is contained in:
2024-10-23 11:52:30 +02:00
parent f3bf598361
commit 3d9677192a
9 changed files with 131 additions and 4 deletions
+41 -3
View File
@@ -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"),
}
+3
View File
@@ -0,0 +1,3 @@
return {
ensure_installed = { "lua_ls", "ts_ls" },
}
+1 -1
View File
@@ -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
View File
@@ -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" },
}
+1
View File
@@ -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,
},
+75
View File
@@ -205,6 +205,12 @@ return {
end,
},
{
"pmizio/typescript-tools.nvim",
dependencies = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" },
opts = {},
},
-- lsp stuff
{
"williamboman/mason.nvim",
@@ -214,6 +220,14 @@ return {
end,
},
{
"williamboman/mason-lspconfig.nvim",
lazy = false,
opts = function()
return require "configs.mason-lspconfig"
end,
},
{
"neovim/nvim-lspconfig",
event = "User FilePost",
@@ -305,6 +319,7 @@ return {
{
"sindrets/winshift.nvim",
lazy = false,
},
{
@@ -398,4 +413,64 @@ return {
cmd = "Trouble",
opts = {},
},
{
"kndndrj/nvim-dbee",
dependencies = {
"MunifTanjim/nui.nvim",
},
build = function()
-- Install tries to automatically detect the install method.
-- if it fails, try calling it with one of these parameters:
-- "curl", "wget", "bitsadmin", "go"
require("dbee").install()
end,
config = function()
require("dbee").setup {
sources = {
require("dbee.sources").MemorySource:new {
{
name = "localhost",
type = "postgres",
url = "postgres://postgres:123@localhost:5432/gestion-isp?sslmode=disable",
},
-- ...
},
},
}
end,
},
{
"hat0uma/csvview.nvim",
config = function()
require("csvview").setup()
end,
init = function()
require("csvview").setup {
view = {
display_mode = "border",
},
}
end,
},
{
"cameron-wags/rainbow_csv.nvim",
config = true,
lazy = false,
ft = {
"csv",
"tsv",
"csv_semicolon",
"csv_whitespace",
"csv_pipe",
"rfc_csv",
"rfc_semicolon",
},
cmd = {
"RainbowDelim",
"RainbowDelimSimple",
"RainbowDelimQuoted",
"RainbowMultiDelim",
},
},
}