diff --git a/home/.config/nvim/lua/plugins/mason.lua b/home/.config/nvim/lua/plugins/mason.lua index c1231f88..7c727ce0 100644 --- a/home/.config/nvim/lua/plugins/mason.lua +++ b/home/.config/nvim/lua/plugins/mason.lua @@ -19,12 +19,15 @@ return { "mfussenegger/nvim-jdtls", -- Add support for LSP file operations { "antosha417/nvim-lsp-file-operations", opts = {} }, + -- Automatically fetch schemas from JSON schema store + "b0o/schemastore.nvim", }, config = function() require("mason").setup() local mlspc = require("mason-lspconfig") local lsp_utils = require("lsp_utils") + local lspconfig = require("lspconfig") local commonLspConfigArgs = { on_attach = lsp_utils.map_keys, @@ -35,13 +38,13 @@ return { mlspc.setup_handlers({ -- Default handler function(server_name) - require("lspconfig")[server_name].setup(commonLspConfigArgs) + lspconfig[server_name].setup(commonLspConfigArgs) end, -- Disable tsserver diagnostics diagnostics -- that come from ESLint ["ts_ls"] = function() - require("lspconfig").ts_ls.setup(vim.tbl_extend("force", commonLspConfigArgs, { + lspconfig.ts_ls.setup(vim.tbl_extend("force", commonLspConfigArgs, { settings = { diagnostics = { ignoredCodes = { @@ -55,6 +58,17 @@ return { -- Don't set up jdtls, it is set up by nvim-jdtls ["jdtls"] = function() end, + + ["jsonls"] = function() + lspconfig.jsonls.setup(vim.tbl_extend("force", commonLspConfigArgs, { + settings = { + json = { + schemas = require("schemastore").json.schemas(), + validate = { enable = true }, + }, + }, + })) + end, }) end, } diff --git a/scripts/fhackeditor b/scripts/fhackeditor new file mode 100755 index 00000000..7a1d4934 --- /dev/null +++ b/scripts/fhackeditor @@ -0,0 +1,9 @@ +#!/bin/sh +# Script to launch a graphical editor if in graphical mode, +# terminal editor otherwise + +if [ -n "$DISPLAY" ] || [ -n "$WAYLAND_DISPLAY" ]; then + echo "Running in graphical mode" +else + echo "Running in TTY mode" +fi