From 6274d696f340f871867202eb17eb4db571ad4e65 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Thu, 9 Mar 2023 12:53:58 -0500 Subject: [PATCH] feat(pack): add json language pack --- lua/astrocommunity/pack/json/README.md | 6 ++++++ lua/astrocommunity/pack/json/json.lua | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 lua/astrocommunity/pack/json/README.md create mode 100644 lua/astrocommunity/pack/json/json.lua diff --git a/lua/astrocommunity/pack/json/README.md b/lua/astrocommunity/pack/json/README.md new file mode 100644 index 000000000..993fadf2d --- /dev/null +++ b/lua/astrocommunity/pack/json/README.md @@ -0,0 +1,6 @@ +# JSON Language Pack + +This plugin pack does the following: + +- Adds `json` and `jsonc` Treesitter parsers +- Adds `jsonls` language server diff --git a/lua/astrocommunity/pack/json/json.lua b/lua/astrocommunity/pack/json/json.lua new file mode 100644 index 000000000..bda626638 --- /dev/null +++ b/lua/astrocommunity/pack/json/json.lua @@ -0,0 +1,22 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + -- Ensure that opts.ensure_installed exists and is a table or string "all". + if not opts.ensure_installed then + opts.ensure_installed = {} + elseif opts.ensure_installed == "all" then + return + end + vim.list_extend(opts.ensure_installed, { "json", "jsonc" }) + end, + }, + { + "williamboman/mason-lspconfig.nvim", + opts = function(_, opts) + -- Ensure that opts.ensure_installed exists and is a table + if not opts.ensure_installed then opts.ensure_installed = {} end + table.insert(opts.ensure_installed, "jsonls") + end, + }, +}