From 29a921523ee6c7545e3f77a94216042376695290 Mon Sep 17 00:00:00 2001 From: Rokas Puzonas Date: Tue, 23 Nov 2021 14:17:57 +0200 Subject: [PATCH] fix: setup jsonls to use schema for known files --- lua/config/lspconfig.lua | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lua/config/lspconfig.lua b/lua/config/lspconfig.lua index f67cb61..1f6bd60 100644 --- a/lua/config/lspconfig.lua +++ b/lua/config/lspconfig.lua @@ -5,7 +5,9 @@ M.flags = { debounce_text_changes = 150 } local general_settings = { } M.server_init_options = { - efm = {documentFormatting = true}, + efm = { + documentFormatting = true + } } M.server_settings = { @@ -15,6 +17,20 @@ M.server_settings = { lua = { { formatCommand = "lua-format -i", formatStdin = true } } + }, + }, + jsonls = { + json = { + schemas = { + { + fileMatch = {"package.json"}, + url = "https://json.schemastore.org/package.json" + }, + { + fileMatch = {"tsconfig*.json"}, + url = "https://json.schemastore.org/tsconfig.json" + }, + } } }, @@ -91,7 +107,7 @@ function M.on_attach(client, bufnr) -- buf_set_keymap('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()') -- buf_set_keymap('n', ']d', 'lua vim.lsp.diagnostic.goto_next()') -- buf_set_keymap('n', 'q', 'lua vim.lsp.diagnostic.set_loclist()') - buf_set_keymap('n', 'f', 'lua vim.lsp.buf.formatting()') + -- buf_set_keymap('n', 'f', 'lua vim.lsp.buf.formatting()') -- " auto-format -- autocmd BufWritePre *.js lua vim.lsp.buf.formatting_sync(nil, 100)