this repo has no description
1return {
2 { "b0o/schemastore.nvim" },
3 {
4 "neovim/nvim-lspconfig",
5 dependencies = {
6 "mason-org/mason.nvim",
7 "klen/nvim-config-local",
8 },
9 config = function()
10 local lspc = require("lspconfig")
11 local lspconfig_defaults = lspc.util.default_config
12 lspconfig_defaults.capabilities =
13 vim.tbl_deep_extend("force", lspconfig_defaults.capabilities, require("cmp_nvim_lsp").default_capabilities())
14 end,
15 },
16 {
17 "mason-org/mason-lspconfig.nvim",
18 dependencies = {
19 "neovim/nvim-lspconfig",
20 "mason-org/mason.nvim",
21 "klen/nvim-config-local",
22 },
23 config = function()
24 local function not_deno(bufn, on_dir)
25 local util = require("lspconfig.util")
26 if util.root_pattern("deno.json", "deno.jsonc")(bufn) then
27 return nil
28 end
29 on_dir(util.root_pattern("package.json", "tsconfig.json", ".git")(bufn))
30 end
31
32 require("mason").setup({})
33 require("mason-lspconfig").setup({
34 automatic_enable = false,
35 automatic_installation = true,
36 ensure_installed = {
37 "efm", -- general purpose language server
38 "lua_ls",
39 "jsonls",
40 "vtsls",
41 "eslint",
42 "bashls",
43 "rust_analyzer",
44 "pylsp",
45 "yamlls",
46 "denols",
47 },
48 })
49
50 LangServers.lua_ls = {
51 settings = {
52 Lua = { diagnostics = { globals = { "LangServers" } } },
53 },
54 }
55 LangServers.vtsls = {
56 root_dir = not_deno,
57 single_file_support = false,
58 settings = {
59 javascript = { format = { enable = true } },
60 typescript = { format = { enable = true } },
61 }
62 }
63 LangServers.eslint = {
64 single_file_support = false,
65 }
66 LangServers.denols = {
67 root_dir = function(bufn, on_dir)
68 local util = require("lspconfig.util")
69 if util.root_pattern("deno.json", "deno.jsonc")(bufn) then
70 on_dir(util.root_pattern("deno.json", "deno.jsonc")(bufn))
71 end
72 end
73 }
74 LangServers.yamlls = {
75 settings = {
76 yaml = {
77 -- Disable built in schema store stuff in favor of `schemastore` plugin
78 schemaStore = { enable = false, url = "" },
79 schemas = require("schemastore").yaml.schemas(),
80
81 validate = true,
82 completion = true,
83 hover = true,
84 },
85 },
86 }
87 LangServers.jsonls = {
88 settings = {
89 json = {
90 schemas = require("schemastore").json.schemas(),
91 validate = { enable = true },
92 },
93 },
94 }
95 LangServers.bashls = {
96 filetypes = { "sh", "bash", "zsh" },
97 }
98 LangServers.efm = {
99 filetypes = { "sh", "bash", "zsh" },
100 settings = {
101 rootMarkers = { ".git/" },
102 languages = {
103 sh = { { formatCommand = "shfmt -ci", formatStdin = true } },
104 bash = { { formatCommand = "shfmt -ci", formatStdin = true } },
105 zsh = { { formatCommand = "shfmt -ci", formatStdin = true } },
106 },
107 },
108 }
109 LangServers.gopls = {
110 cmd = { "gopls" },
111 filetypes = { "go", "gomod", "gowork", "gotmpl" },
112 }
113
114 function SetupLspHandlers()
115 for server_name, server_config in pairs(LangServers) do
116 if server_config == false then
117 return
118 end
119 vim.lsp.config(server_name, server_config or {})
120 vim.lsp.enable(server_name)
121 end
122 end
123
124 -- Call this after loading local configs so the `LangServers` global
125 -- can be modified in those configs as needed first.
126 vim.api.nvim_create_autocmd("User", {
127 pattern = "ConfigLocalFinished",
128 callback = SetupLspHandlers,
129 })
130 vim.api.nvim_create_autocmd("BufWritePre", {
131 callback = function()
132 vim.lsp.buf.format()
133 end,
134 })
135 end,
136 },
137 {
138 "folke/lazydev.nvim",
139 ft = "lua", -- only load on lua files
140 opts = {},
141 },
142 {
143 "prisma/vim-prisma",
144 },
145 {
146 "antosha417/nvim-lsp-file-operations",
147 dependencies = {
148 "nvim-lua/plenary.nvim",
149 "nvim-neo-tree/neo-tree.nvim",
150 },
151 config = function()
152 require("lsp-file-operations").setup()
153 end,
154 },
155}