mirror of
https://github.com/LazyVim/starter.git
synced 2026-07-25 14:01:03 +00:00
105 lines
2.6 KiB
Lua
105 lines
2.6 KiB
Lua
return {
|
|
-- add pyright to lspconfig
|
|
{
|
|
"neovim/nvim-lspconfig",
|
|
---@class PluginLspOpts
|
|
opts = {
|
|
---@type lspconfig.options
|
|
servers = {
|
|
-- pyright will be automatically installed with mason and loaded with lspconfig
|
|
pyright = {},
|
|
tsserver = {},
|
|
|
|
},
|
|
},
|
|
},
|
|
|
|
-- add tsserver and setup with typescript.nvim instead of lspconfig
|
|
{
|
|
"neovim/nvim-lspconfig",
|
|
dependencies = {
|
|
"jose-elias-alvarez/typescript.nvim",
|
|
init = function()
|
|
require("lazyvim.util").lsp.on_attach(function(_, buffer)
|
|
-- stylua: ignore
|
|
vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
|
|
vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
|
|
end)
|
|
end,
|
|
},
|
|
---@class PluginLspOpts
|
|
opts = {
|
|
---@type lspconfig.options
|
|
servers = {
|
|
-- tsserver will be automatically installed with mason and loaded with lspconfig
|
|
tsserver = {},
|
|
},
|
|
-- you can do any additional lsp server setup here
|
|
-- return true if you don't want this server to be setup with lspconfig
|
|
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
|
|
setup = {
|
|
-- example to setup with typescript.nvim
|
|
tsserver = function(_, opts)
|
|
require("typescript").setup({ server = opts })
|
|
return true
|
|
end,
|
|
-- Specify * to use this function as a fallback for any server
|
|
-- ["*"] = function(server, opts) end,
|
|
},
|
|
},
|
|
},
|
|
|
|
|
|
|
|
-- add more treesitter parsers
|
|
{
|
|
"nvim-treesitter/nvim-treesitter",
|
|
opts = {
|
|
ensure_installed = {
|
|
"bash",
|
|
"html",
|
|
"javascript",
|
|
"json",
|
|
"lua",
|
|
"markdown",
|
|
"markdown_inline",
|
|
"python",
|
|
"query",
|
|
"regex",
|
|
"tsx",
|
|
"typescript",
|
|
"vim",
|
|
"yaml",
|
|
"dart",
|
|
"comment",
|
|
},
|
|
incremental_selection = {
|
|
enable = true,
|
|
keymaps = {
|
|
init_selection = "<c-space>",
|
|
node_incremental = "<c-space>",
|
|
scope_incremental = "<c-s>",
|
|
node_decremental = "<c-backspace>",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
-- add any tools you want to have installed below
|
|
{
|
|
"williamboman/mason.nvim",
|
|
opts = {
|
|
ensure_installed = {
|
|
"stylua",
|
|
"shellcheck",
|
|
"shfmt",
|
|
"flake8",
|
|
"eslint-lsp",
|
|
"prettierd",
|
|
"black",
|
|
"isort",
|
|
"dart-debug-adapter",
|
|
},
|
|
},
|
|
},
|
|
}
|