Nvim: add json schema store
Allows automatically fetching schemas in json files without specifying schema
This commit is contained in:
parent
a7d3c0a6ee
commit
ce475402bc
2 changed files with 25 additions and 2 deletions
|
@ -19,12 +19,15 @@ return {
|
||||||
"mfussenegger/nvim-jdtls",
|
"mfussenegger/nvim-jdtls",
|
||||||
-- Add support for LSP file operations
|
-- Add support for LSP file operations
|
||||||
{ "antosha417/nvim-lsp-file-operations", opts = {} },
|
{ "antosha417/nvim-lsp-file-operations", opts = {} },
|
||||||
|
-- Automatically fetch schemas from JSON schema store
|
||||||
|
"b0o/schemastore.nvim",
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
require("mason").setup()
|
require("mason").setup()
|
||||||
|
|
||||||
local mlspc = require("mason-lspconfig")
|
local mlspc = require("mason-lspconfig")
|
||||||
local lsp_utils = require("lsp_utils")
|
local lsp_utils = require("lsp_utils")
|
||||||
|
local lspconfig = require("lspconfig")
|
||||||
|
|
||||||
local commonLspConfigArgs = {
|
local commonLspConfigArgs = {
|
||||||
on_attach = lsp_utils.map_keys,
|
on_attach = lsp_utils.map_keys,
|
||||||
|
@ -35,13 +38,13 @@ return {
|
||||||
mlspc.setup_handlers({
|
mlspc.setup_handlers({
|
||||||
-- Default handler
|
-- Default handler
|
||||||
function(server_name)
|
function(server_name)
|
||||||
require("lspconfig")[server_name].setup(commonLspConfigArgs)
|
lspconfig[server_name].setup(commonLspConfigArgs)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-- Disable tsserver diagnostics diagnostics
|
-- Disable tsserver diagnostics diagnostics
|
||||||
-- that come from ESLint
|
-- that come from ESLint
|
||||||
["ts_ls"] = function()
|
["ts_ls"] = function()
|
||||||
require("lspconfig").ts_ls.setup(vim.tbl_extend("force", commonLspConfigArgs, {
|
lspconfig.ts_ls.setup(vim.tbl_extend("force", commonLspConfigArgs, {
|
||||||
settings = {
|
settings = {
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
ignoredCodes = {
|
ignoredCodes = {
|
||||||
|
@ -55,6 +58,17 @@ return {
|
||||||
|
|
||||||
-- Don't set up jdtls, it is set up by nvim-jdtls
|
-- Don't set up jdtls, it is set up by nvim-jdtls
|
||||||
["jdtls"] = function() end,
|
["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,
|
end,
|
||||||
}
|
}
|
||||||
|
|
9
scripts/fhackeditor
Executable file
9
scripts/fhackeditor
Executable file
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue