]> git.rmz.io Git - dotfiles.git/blobdiff - nvim/lua/plugins/lang/json.lua
lazyvim: absorb all langs
[dotfiles.git] / nvim / lua / plugins / lang / json.lua
diff --git a/nvim/lua/plugins/lang/json.lua b/nvim/lua/plugins/lang/json.lua
new file mode 100644 (file)
index 0000000..88acd8c
--- /dev/null
@@ -0,0 +1,39 @@
+return {
+  -- add json to treesitter
+  {
+    "nvim-treesitter/nvim-treesitter",
+    opts = { ensure_installed = { "json5" } },
+  },
+
+  -- yaml schema support
+  {
+    "b0o/SchemaStore.nvim",
+    lazy = true,
+    version = false, -- last release is way too old
+  },
+
+  -- correctly setup lspconfig
+  {
+    "neovim/nvim-lspconfig",
+    opts = {
+      -- make sure mason installs the server
+      servers = {
+        jsonls = {
+          -- lazy-load schemastore when needed
+          on_new_config = function(new_config)
+            new_config.settings.json.schemas = new_config.settings.json.schemas or {}
+            vim.list_extend(new_config.settings.json.schemas, require("schemastore").json.schemas())
+          end,
+          settings = {
+            json = {
+              format = {
+                enable = true,
+              },
+              validate = { enable = true },
+            },
+          },
+        },
+      },
+    },
+  },
+}