this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

move lsp config into lsp.lua

pulling in schema store plugin and openapi-language-server init

+58 -38
+2 -3
nvim/init.lua
··· 1 + LangServers = {} 2 + 1 3 require("config.base") 2 - 3 - -- Defines globals used in lazy plugins 4 - require("config.lspconfig") 5 4 6 5 -- Loads plugins 7 6 require("config.lazy")
-34
nvim/lua/config/lspconfig.lua
··· 1 - -- TODO: Can I add types to this?! 2 - 3 - LangServers = { 4 - lua_ls = { 5 - settings = { 6 - Lua = { diagnostics = { globals = { LangServers } } }, 7 - }, 8 - }, 9 - eslint = { 10 - settings = { 11 - run = "onSave", 12 - }, 13 - }, 14 - denols = { 15 - root_dir = function(_, bufn) 16 - return vim.fs.root(bufn, { "deno.json" }) 17 - end, 18 - }, 19 - vtsls = { 20 - root_dir = function(_, bufn) 21 - if not vim.fs.root(bufn, { "deno.json" }) then 22 - return vim.fs.root(bufn, { "package.json", "tsconfig.json", ".git" }) 23 - end 24 - end, 25 - }, 26 - } 27 - 28 - -- local is_deno = vim.env.NVIM_DENO 29 - -- if is_deno then 30 - -- LangServers.denols = { enable = true } 31 - -- LangServers.vtsls = false 32 - -- else 33 - -- LangServers.denols = false 34 - -- end
+56 -1
nvim/lua/plugins/lsp.lua
··· 1 1 return { 2 + { "b0o/schemastore.nvim" }, 2 3 { 3 4 "neovim/nvim-lspconfig", 4 5 dependencies = { ··· 65 66 "williamboman/mason-lspconfig.nvim", 66 67 config = function() 67 68 require("mason-lspconfig").setup({ 69 + automatic_installation = true, 68 70 ensure_installed = { 69 71 "lua_ls", 70 72 "jsonls", 71 73 "vtsls", 72 - "denols", 73 74 "eslint", 74 75 "bashls", 75 76 "rust_analyzer", ··· 77 78 "yamlls", 78 79 }, 79 80 }) 81 + LangServers.lua_ls = { 82 + settings = { 83 + Lua = { diagnostics = { globals = { "LangServers" } } }, 84 + }, 85 + } 86 + LangServers.yamlls = { 87 + settings = { 88 + yaml = { 89 + -- Disable built in schema store stuff in favor of `schemastore` plugin 90 + schemaStore = { enable = false, url = "" }, 91 + schemas = require("schemastore").yaml.schemas(), 80 92 93 + validate = true, 94 + completion = true, 95 + hover = true, 96 + }, 97 + }, 98 + } 99 + LangServers.jsonls = { 100 + settings = { 101 + json = { 102 + schemas = require("schemastore").json.schemas(), 103 + validate = { enable = true }, 104 + }, 105 + }, 106 + } 107 + LangServers.eslint = { 108 + settings = { 109 + run = "onSave", 110 + }, 111 + } 112 + LangServers.denols = { 113 + root_dir = function(_, bufn) 114 + return vim.fs.root(bufn, { "deno.json" }) 115 + end, 116 + } 117 + LangServers.vtsls = { 118 + root_dir = function(_, bufn) 119 + if not vim.fs.root(bufn, { "deno.json" }) then 120 + return vim.fs.root(bufn, { "package.json", "tsconfig.json", ".git" }) 121 + end 122 + end, 123 + } 81 124 function SetupLspHandlers() 82 125 require("mason-lspconfig").setup_handlers({ 83 126 function(server_name) ··· 94 137 vim.api.nvim_create_autocmd("User", { 95 138 pattern = "ConfigLocalFinished", 96 139 callback = SetupLspHandlers, 140 + }) 141 + 142 + -- Manually initialize openapi-language-server since it isn't part of mason or lspconfig 143 + vim.api.nvim_create_autocmd("FileType", { 144 + pattern = "yaml", 145 + callback = function() 146 + vim.lsp.start({ 147 + cmd = { "openapi-language-server" }, 148 + filetypes = { "yaml" }, 149 + root_dir = vim.fn.getcwd(), 150 + }) 151 + end, 97 152 }) 98 153 end, 99 154 },