More language servers (#42)

This commit is contained in:
Patrick Stevens
2024-03-26 21:33:10 +00:00
committed by GitHub
parent 07b3034bc0
commit e91fb514fe
2 changed files with 39 additions and 1 deletions

View File

@@ -181,7 +181,6 @@
config = builtins.readFile ./nvim/treesitter.lua;
type = "lua";
}
{
plugin = nixpkgs.vimPlugins.nvim-lspconfig;
config = builtins.readFile ./nvim/lspconfig.lua;
@@ -285,6 +284,8 @@
};
home.packages = [
nixpkgs.nodePackages_latest.vscode-json-languageserver
nixpkgs.yaml-language-server
nixpkgs.csharp-ls
nixpkgs.netcoredbg
nixpkgs.nil

View File

@@ -3,6 +3,43 @@ local coq = require("coq")
-- Using rustaceanvim means we shouldn't set up the LSP for Rust manually.
-- Similarly csharp_ls is unnecessary given roslyn.nvim
-- require("lspconfig")["csharp_ls"].setup({})
local schemas = {
["https://raw.githubusercontent.com/docker/compose/master/compose/config/compose_spec.json"] = "docker-compose*.{yml,yaml}",
["https://json.schemastore.org/github-workflow.json"] = ".github/**/*.{yml,yaml}",
["https://json.schemastore.org/package.json"] = "package.json",
["https://json.schemastore.org/global.json"] = "global.json",
["https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json"] = "version.json",
["https://json-schema.org/draft/2020-12/schema"] = "*.schema.json",
["https://json.schemastore.org/dotnet-tools.json"] = "dotnet-tools.json",
}
require("lspconfig")["yamlls"].setup({
settings = {
yaml = {
validate = true,
-- disable the schema store
schemaStore = {
enable = false,
url = "",
},
-- manually select schemas
schemas = schemas,
},
},
filetypes = { "yaml", "json", "jsonc" },
})
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
require("lspconfig")["jsonls"].setup({
capabilities = capabilities,
cmd = { "vscode-json-languageserver", "--stdio" },
settings = {
json = {
validate = { enable = true },
},
},
})
require("lspconfig")["lua_ls"].setup({
on_init = function(client)