Compare commits
1 Commits
86752af3e9
...
old
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5190c45daf |
@@ -1,137 +1,147 @@
|
|||||||
return {
|
return {
|
||||||
-- LSP Configuration
|
-- LSP Configuration
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"williamboman/mason.nvim",
|
"williamboman/mason.nvim",
|
||||||
"williamboman/mason-lspconfig.nvim",
|
"williamboman/mason-lspconfig.nvim",
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
require("mason").setup()
|
require("mason").setup()
|
||||||
require("mason-lspconfig").setup({
|
require("mason-lspconfig").setup({
|
||||||
ensure_installed = { "ts_ls", "lua_ls", "pyright", "rust_analyzer", "eslint" }, -- Add your desired LSPs
|
ensure_installed = { "ts_ls", "lua_ls", "pyright", "rust_analyzer", "eslint" }, -- Add your desired LSPs
|
||||||
automatic_installation = true,
|
automatic_installation = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require("lspconfig")
|
||||||
lspconfig.lua_ls.setup({})
|
lspconfig.lua_ls.setup({})
|
||||||
--Enable (broadcasting) snippet capability for completion
|
--Enable (broadcasting) snippet capability for completion
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
|
|
||||||
vim.lsp.config("cssls", {
|
vim.lsp.config("qmlls", {
|
||||||
capabilities = capabilities,
|
default_config = {
|
||||||
})
|
cmd = { "qmlls" },
|
||||||
lspconfig.pyright.setup({})
|
filetypes = { "qml" },
|
||||||
lspconfig.cssls.setup({})
|
root_dir = lspconfig.util.root_pattern(".git", "."),
|
||||||
lspconfig.ts_ls.setup({
|
}
|
||||||
capabilities = capabilities,
|
}
|
||||||
})
|
|
||||||
lspconfig.rust_analyzer.setup({})
|
|
||||||
lspconfig.emmet_ls.setup({
|
|
||||||
capabilities = require("cmp_nvim_lsp").default_capabilities(),
|
|
||||||
filetypes = { "html", "css", "javascriptreact", "typescriptreact" }, -- Add more if needed
|
|
||||||
init_options = {
|
|
||||||
html = {
|
|
||||||
options = {
|
|
||||||
["bem.enabled"] = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Autocompletion
|
)
|
||||||
{
|
vim.lsp.config("cssls", {
|
||||||
"hrsh7th/nvim-cmp",
|
capabilities = capabilities,
|
||||||
dependencies = {
|
})
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
lspconfig.pyright.setup({})
|
||||||
"hrsh7th/cmp-buffer",
|
lspconfig.cssls.setup({})
|
||||||
"hrsh7th/cmp-path",
|
lspconfig.qmlls.setup({})
|
||||||
"hrsh7th/cmp-cmdline",
|
lspconfig.ts_ls.setup({
|
||||||
"L3MON4D3/LuaSnip",
|
capabilities = capabilities,
|
||||||
"saadparwaiz1/cmp_luasnip", -- Completion for snippets
|
})
|
||||||
},
|
lspconfig.rust_analyzer.setup({})
|
||||||
config = function()
|
lspconfig.emmet_ls.setup({
|
||||||
local cmp = require("cmp")
|
capabilities = require("cmp_nvim_lsp").default_capabilities(),
|
||||||
local luasnip = require("luasnip")
|
filetypes = { "html", "css", "javascriptreact", "typescriptreact" }, -- Add more if needed
|
||||||
|
init_options = {
|
||||||
|
html = {
|
||||||
|
options = {
|
||||||
|
["bem.enabled"] = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
cmp.setup({
|
-- Autocompletion
|
||||||
snippet = {
|
{
|
||||||
expand = function(args)
|
"hrsh7th/nvim-cmp",
|
||||||
luasnip.lsp_expand(args.body)
|
dependencies = {
|
||||||
end,
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
},
|
"hrsh7th/cmp-buffer",
|
||||||
mapping = cmp.mapping.preset.insert({
|
"hrsh7th/cmp-path",
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
"hrsh7th/cmp-cmdline",
|
||||||
if cmp.visible() then
|
"L3MON4D3/LuaSnip",
|
||||||
cmp.select_next_item()
|
"saadparwaiz1/cmp_luasnip", -- Completion for snippets
|
||||||
elseif luasnip.expand_or_jumpable() then
|
},
|
||||||
luasnip.expand_or_jump()
|
config = function()
|
||||||
else
|
local cmp = require("cmp")
|
||||||
fallback()
|
local luasnip = require("luasnip")
|
||||||
end
|
|
||||||
end, { "i", "s" }),
|
|
||||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
elseif luasnip.jumpable(-1) then
|
|
||||||
luasnip.jump(-1)
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { "i", "s" }),
|
|
||||||
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Confirm selection with Enter
|
|
||||||
}),
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = "nvim_lsp" }, -- This should provide LSP completions like for ESLint
|
|
||||||
-- { name = "luasnip" },
|
|
||||||
{ name = "buffer" },
|
|
||||||
{ name = "path" },
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Linting
|
cmp.setup({
|
||||||
{
|
snippet = {
|
||||||
"mfussenegger/nvim-lint",
|
expand = function(args)
|
||||||
config = function()
|
luasnip.lsp_expand(args.body)
|
||||||
local lint = require("lint")
|
end,
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
elseif luasnip.expand_or_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
elseif luasnip.jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Confirm selection with Enter
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "nvim_lsp" }, -- This should provide LSP completions like for ESLint
|
||||||
|
-- { name = "luasnip" },
|
||||||
|
{ name = "buffer" },
|
||||||
|
{ name = "path" },
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
-- Explicitly define linters for each file type (without ast_grep)
|
-- Linting
|
||||||
lint.linters_by_ft = {
|
{
|
||||||
python = { "flake8" },
|
"mfussenegger/nvim-lint",
|
||||||
javascript = { "eslint" },
|
config = function()
|
||||||
typescript = { "eslint" },
|
local lint = require("lint")
|
||||||
}
|
|
||||||
|
|
||||||
-- Auto-run the linter only for the configured filetypes
|
-- Explicitly define linters for each file type (without ast_grep)
|
||||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
lint.linters_by_ft = {
|
||||||
pattern = "!*.lua",
|
python = { "flake8" },
|
||||||
callback = function()
|
javascript = { "eslint" },
|
||||||
local ft = vim.bo.filetype
|
typescript = { "eslint" },
|
||||||
if lint.linters_by_ft[ft] then
|
}
|
||||||
lint.try_lint()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- autoformatting
|
-- Auto-run the linter only for the configured filetypes
|
||||||
{
|
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||||
"stevearc/conform.nvim",
|
pattern = "!*.lua",
|
||||||
config = function()
|
callback = function()
|
||||||
require("conform").setup({
|
local ft = vim.bo.filetype
|
||||||
formatters_by_ft = {
|
if lint.linters_by_ft[ft] then
|
||||||
lua = { "stylua" },
|
lint.try_lint()
|
||||||
javascript = { "prettier" },
|
end
|
||||||
python = { "black" },
|
end,
|
||||||
},
|
})
|
||||||
format_on_save = true,
|
end,
|
||||||
})
|
},
|
||||||
end,
|
|
||||||
},
|
-- autoformatting
|
||||||
|
{
|
||||||
|
"stevearc/conform.nvim",
|
||||||
|
config = function()
|
||||||
|
require("conform").setup({
|
||||||
|
formatters_by_ft = {
|
||||||
|
lua = { "stylua" },
|
||||||
|
javascript = { "prettier" },
|
||||||
|
python = { "black" },
|
||||||
|
},
|
||||||
|
format_on_save = true,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
4
lua/plugins/telescope.lua
Normal file
4
lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
return {
|
||||||
|
'nvim-telescope/telescope.nvim',
|
||||||
|
dependencies = { 'nvim-lua/plenary.nvim' }
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user