From f5816f36397de152478eede27fea3a8ea2e394d1 Mon Sep 17 00:00:00 2001 From: iGor milhit Date: Tue, 4 Jul 2023 10:25:51 +0200 Subject: [PATCH] json: add configuration for JSON - Adds the `json` parser to the treesitter languages for linting purpose. - Adds `jsonls` as language server provider for JSON. - Creates the `after/ftplugin` folders. - Sets specific settings for JSON for folding method. Co-Authored-by: iGor milhit --- after/ftplugin/json.lua | 8 ++++++++ init.lua | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 after/ftplugin/json.lua diff --git a/after/ftplugin/json.lua b/after/ftplugin/json.lua new file mode 100644 index 0000000..7f6f421 --- /dev/null +++ b/after/ftplugin/json.lua @@ -0,0 +1,8 @@ +-- Specific settings for JSON files +-- Use treesitter for folding +-- Disable the color column + +vim.opt.foldmethod="expr" +vim.opt.foldexpr="nvim_treesitter#foldexpr()" +vim.opt.foldlevel=3 +vim.opt.colorcolumn="" diff --git a/init.lua b/init.lua index b10acad..47c6f97 100644 --- a/init.lua +++ b/init.lua @@ -362,7 +362,7 @@ vim.keymap.set('n', 'ss', require'telescope'.extensions.luasnip.luasnip -- See `:help nvim-treesitter` require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim' }, + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim', 'json' }, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, @@ -516,6 +516,11 @@ local servers = { } } }, + + -- Require vscode-langservers-extracted + -- https://github.com/hrsh7th/vscode-langservers-extracted + jsonls = { + }, } -- Setup neovim lua configuration