Add typescript + jinja LSP.

This commit is contained in:
Loïc Gremaud 2024-10-23 11:52:30 +02:00
parent f3bf598361
commit 3d9677192a
Signed by: Legrems
GPG Key ID: D4620E6DF3E0121D
9 changed files with 131 additions and 4 deletions

View File

@ -0,0 +1,2 @@
setlocal tabstop=2
setlocal shiftwidth=2

2
after/ftplugin/vue.vim Normal file
View File

@ -0,0 +1,2 @@
setlocal tabstop=2
setlocal shiftwidth=2

View File

@ -10,6 +10,7 @@
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"conform.nvim": { "branch": "master", "commit": "667102f26106709cddd2dff1f699610df5b94d7f" }, "conform.nvim": { "branch": "master", "commit": "667102f26106709cddd2dff1f699610df5b94d7f" },
"csvview.nvim": { "branch": "main", "commit": "f4dcf942fe94c713f012918dbae569ef3109b20c" },
"diaglist.nvim": { "branch": "master", "commit": "afc124a0976d56db43cc840e62757193ccab7856" }, "diaglist.nvim": { "branch": "master", "commit": "afc124a0976d56db43cc840e62757193ccab7856" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" }, "friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" },
@ -23,6 +24,7 @@
"macrothis.nvim": { "branch": "main", "commit": "3fe6af86ce9eb509737f7955007c58dec96eb02b" }, "macrothis.nvim": { "branch": "main", "commit": "3fe6af86ce9eb509737f7955007c58dec96eb02b" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"marks.nvim": { "branch": "master", "commit": "74e8d01b2a2131b6e46354cffc553aa7f81bcf5b" }, "marks.nvim": { "branch": "master", "commit": "74e8d01b2a2131b6e46354cffc553aa7f81bcf5b" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"noice.nvim": { "branch": "main", "commit": "448bb9c524a7601035449210838e374a30153172" }, "noice.nvim": { "branch": "main", "commit": "448bb9c524a7601035449210838e374a30153172" },
"nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" }, "nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" },
@ -32,6 +34,7 @@
"nvim-dap": { "branch": "master", "commit": "2b428ff2632e73295e9decbcf1c40d8e26213305" }, "nvim-dap": { "branch": "master", "commit": "2b428ff2632e73295e9decbcf1c40d8e26213305" },
"nvim-dap-python": { "branch": "master", "commit": "d777c2b32ed39f61209c09bede28d7491621a631" }, "nvim-dap-python": { "branch": "master", "commit": "d777c2b32ed39f61209c09bede28d7491621a631" },
"nvim-dap-ui": { "branch": "master", "commit": "a5606bc5958db86f8d92803bea7400ee26a8d7e4" }, "nvim-dap-ui": { "branch": "master", "commit": "a5606bc5958db86f8d92803bea7400ee26a8d7e4" },
"nvim-dbee": { "branch": "master", "commit": "21d2cc0844a16262bb6ea93ab3d0a0f20bd87853" },
"nvim-lint": { "branch": "master", "commit": "ad0fe35e80f5cd31a0f19176d7b30e5c3011119d" }, "nvim-lint": { "branch": "master", "commit": "ad0fe35e80f5cd31a0f19176d7b30e5c3011119d" },
"nvim-lspconfig": { "branch": "master", "commit": "037ea0901ce9a28cfcaa36302618f06d2e164fbf" }, "nvim-lspconfig": { "branch": "master", "commit": "037ea0901ce9a28cfcaa36302618f06d2e164fbf" },
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
@ -43,6 +46,7 @@
"persistent-breakpoints.nvim": { "branch": "main", "commit": "4b199b1dcfd136cac8b0fa9c8dbbdeb81463f7a9" }, "persistent-breakpoints.nvim": { "branch": "main", "commit": "4b199b1dcfd136cac8b0fa9c8dbbdeb81463f7a9" },
"plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
"quicker.nvim": { "branch": "master", "commit": "6b79167543f1b18e76319217a29bb4e177a5e1ae" }, "quicker.nvim": { "branch": "master", "commit": "6b79167543f1b18e76319217a29bb4e177a5e1ae" },
"rainbow_csv.nvim": { "branch": "main", "commit": "7f3fddfe813641035fac2cdf94c2ff69bb0bf0b9" },
"rgflow.nvim": { "branch": "master", "commit": "8a2d80b8594591163d06b430be18c7376d5ae1b8" }, "rgflow.nvim": { "branch": "master", "commit": "8a2d80b8594591163d06b430be18c7376d5ae1b8" },
"tagbar": { "branch": "master", "commit": "d55d454bd3d5b027ebf0e8c75b8f88e4eddad8d8" }, "tagbar": { "branch": "master", "commit": "d55d454bd3d5b027ebf0e8c75b8f88e4eddad8d8" },
"telescope-dap.nvim": { "branch": "master", "commit": "8c88d9716c91eaef1cdea13cb9390d8ef447dbfe" }, "telescope-dap.nvim": { "branch": "master", "commit": "8c88d9716c91eaef1cdea13cb9390d8ef447dbfe" },
@ -51,6 +55,7 @@
"telescope.nvim": { "branch": "master", "commit": "5972437de807c3bc101565175da66a1aa4f8707a" }, "telescope.nvim": { "branch": "master", "commit": "5972437de807c3bc101565175da66a1aa4f8707a" },
"todo-comments.nvim": { "branch": "main", "commit": "8f45f353dc3649cb9b44cecda96827ea88128584" }, "todo-comments.nvim": { "branch": "main", "commit": "8f45f353dc3649cb9b44cecda96827ea88128584" },
"trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" }, "trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" },
"typescript-tools.nvim": { "branch": "master", "commit": "f8c2e0b36b651c85f52ad5c5373ff8b07adc15a7" },
"ui": { "branch": "v2.5", "commit": "6783a3ab3d9bf22859234dd2196888da1d0f0426" }, "ui": { "branch": "v2.5", "commit": "6783a3ab3d9bf22859234dd2196888da1d0f0426" },
"vim-autoswap": { "branch": "master", "commit": "e587e4b14a605d8921942ba65a37583813289272" }, "vim-autoswap": { "branch": "master", "commit": "e587e4b14a605d8921942ba65a37583813289272" },
"vim-flog": { "branch": "master", "commit": "8520904c8b37fe74824f1c46ba73f75158d7ae3b" }, "vim-flog": { "branch": "master", "commit": "8520904c8b37fe74824f1c46ba73f75158d7ae3b" },

View File

@ -4,7 +4,7 @@ require("nvchad.configs.lspconfig").defaults()
local lspconfig = require "lspconfig" local lspconfig = require "lspconfig"
-- EXAMPLE -- EXAMPLE
local servers = { "html", "cssls" } local servers = { "html", "cssls", "volar", "typescript-tools", "tsserver" }
local nvlsp = require "nvchad.configs.lspconfig" local nvlsp = require "nvchad.configs.lspconfig"
-- lsps with default config -- lsps with default config
@ -39,15 +39,20 @@ require("lspconfig").pyright.setup {
-- ignore = { "*" }, -- using ruff -- ignore = { "*" }, -- using ruff
-- typecheckingmode = "off", -- using mypy -- typecheckingmode = "off", -- using mypy
diagnosticseverityoverrides = { diagnosticseverityoverrides = {
reportmissingimports = false, reportMissingImports = false,
-- reportattributeaccessissue = false,
reportUnusedVariable = false, reportUnusedVariable = false,
reportIncompatibleVariableOverride = false,
-- reportAttributeAccessIssue = false,
}, },
}, },
}, },
}, },
} }
-- require("lspconfig").tsserver.setup {
-- filetypes = { "html", "javascript", "htmldjango" },
-- }
-- require("lspconfig").pylsp.setup { -- require("lspconfig").pylsp.setup {
-- settings = { -- settings = {
-- pylsp = { -- 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"),
}

View File

@ -0,0 +1,3 @@
return {
ensure_installed = { "lua_ls", "ts_ls" },
}

View File

@ -1,5 +1,5 @@
local options = { 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", PATH = "prepand",

View File

@ -1,3 +1,4 @@
return { return {
{ "Replace {{X}} with {{ X }} in jinja template", "%s/{{\\(.[^ ]*\\)}}/{{ \\1 }}/g" }, { "Replace {{X}} with {{ X }} in jinja template", "%s/{{\\(.[^ ]*\\)}}/{{ \\1 }}/g" },
{ "Replace a text newline with a carriage return", "%s/\\\\n/\\r/g" },
} }

View File

@ -293,6 +293,7 @@ local options = {
["<C-v>"] = custom_actions.multi_selection_vsplit, ["<C-v>"] = custom_actions.multi_selection_vsplit,
["<C-X>"] = custom_actions.multi_selection_split, ["<C-X>"] = custom_actions.multi_selection_split,
["<C-T>"] = custom_actions.multi_selection_tab, ["<C-T>"] = custom_actions.multi_selection_tab,
-- ["<C-e>"] = custom_actions.set_extension_files,
}, },
n = i, n = i,
}, },

View File

@ -205,6 +205,12 @@ return {
end, end,
}, },
{
"pmizio/typescript-tools.nvim",
dependencies = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" },
opts = {},
},
-- lsp stuff -- lsp stuff
{ {
"williamboman/mason.nvim", "williamboman/mason.nvim",
@ -214,6 +220,14 @@ return {
end, end,
}, },
{
"williamboman/mason-lspconfig.nvim",
lazy = false,
opts = function()
return require "configs.mason-lspconfig"
end,
},
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
event = "User FilePost", event = "User FilePost",
@ -305,6 +319,7 @@ return {
{ {
"sindrets/winshift.nvim", "sindrets/winshift.nvim",
lazy = false,
}, },
{ {
@ -398,4 +413,64 @@ return {
cmd = "Trouble", cmd = "Trouble",
opts = {}, 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",
},
},
} }