rearranging and add some lsp config
This commit is contained in:
parent
98ea26485b
commit
11da71e073
201
init.lua
201
init.lua
|
@ -201,110 +201,9 @@ require('lazy').setup({
|
|||
{ import = 'custom.plugins' },
|
||||
}, {})
|
||||
|
||||
-- [[ Setting options ]]
|
||||
-- See `:help vim.o`
|
||||
-- NOTE: You can change these options as you wish!
|
||||
|
||||
-- Set highlight on search
|
||||
vim.o.hlsearch = true
|
||||
|
||||
-- Make line numbers default
|
||||
vim.wo.number = true
|
||||
-- Enable relative line numbers
|
||||
vim.wo.relativenumber = true
|
||||
|
||||
-- Enable mouse mode
|
||||
vim.o.mouse = 'a'
|
||||
|
||||
-- Sync clipboard between OS and Neovim.
|
||||
-- Remove this option if you want your OS clipboard to remain independent.
|
||||
-- See `:help 'clipboard'`
|
||||
vim.o.clipboard = 'unnamedplus'
|
||||
|
||||
-- Enable break indent
|
||||
vim.o.breakindent = true
|
||||
|
||||
-- Save undo history
|
||||
vim.o.undofile = true
|
||||
|
||||
-- Case-insensitive searching UNLESS \C or capital in search
|
||||
vim.o.ignorecase = true
|
||||
vim.o.smartcase = true
|
||||
|
||||
-- Keep signcolumn on by default
|
||||
vim.wo.signcolumn = 'yes'
|
||||
|
||||
-- Decrease update time
|
||||
vim.o.updatetime = 250
|
||||
vim.o.timeoutlen = 300
|
||||
|
||||
-- Set completeopt to have a better completion experience
|
||||
vim.o.completeopt = 'menuone,noselect'
|
||||
|
||||
-- appearance
|
||||
-- NOTE: You should make sure your terminal supports this
|
||||
vim.o.termguicolors = true
|
||||
vim.o.background = "dark"
|
||||
vim.o.signcolumn = "yes"
|
||||
|
||||
-- tabs and indentation
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.autoindent = true
|
||||
|
||||
-- split windows
|
||||
vim.o.splitright = true
|
||||
vim.o.splitbelow = true
|
||||
|
||||
vim.opt.iskeyword:append("-")
|
||||
|
||||
-- set color scheme
|
||||
vim.cmd.colorscheme "catppuccin"
|
||||
|
||||
-- [[ Basic Keymaps ]]
|
||||
|
||||
-- Keymaps for better default experience
|
||||
-- See `:help vim.keymap.set()`
|
||||
local keymap = vim.keymap
|
||||
keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
||||
|
||||
-- Remap for dealing with word wrap
|
||||
keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||
keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||
|
||||
-- Remap ESC key in different modes
|
||||
keymap.set("i", "jk", "<ESC>")
|
||||
keymap.set("v", "jk", "<ESC>")
|
||||
keymap.set("c", "jk", "<ESC>")
|
||||
|
||||
-- clear highlights
|
||||
keymap.set("n", "<leader>nh", ":nohl<CR>")
|
||||
|
||||
-- delete character but don't copy into register
|
||||
keymap.set("n", "x", '"_x')
|
||||
|
||||
-- increment/decrement numbers
|
||||
keymap.set("n", "<leader>+", "<C-a>")
|
||||
keymap.set("n", "<leader>-", "C-x")
|
||||
|
||||
-- split window
|
||||
keymap.set("n", "<leader>sv", "<C-w>v")
|
||||
keymap.set("n", "<leader>sh", "<C-w>s")
|
||||
keymap.set("n", "<leader>se", "<C-w>=")
|
||||
keymap.set("n", "<leader>sx", ":close<CR>")
|
||||
|
||||
-- tabs
|
||||
keymap.set("n", "<leader>to", ":tabnew<CR>")
|
||||
keymap.set("n", "<leader>tx", ":tabclose<CR>")
|
||||
keymap.set("n", "<leader>tn", ":tabn<CR>")
|
||||
keymap.set("n", "<leader>tp", ":tabp<CR>")
|
||||
|
||||
--maximize window toggle
|
||||
keymap.set("n", "<leader>max", ":MaximizerToggle<CR>")
|
||||
|
||||
-- nvim-tree
|
||||
keymap.set("n", "<leader>tt", ":NvimTreeToggle<CR>")
|
||||
require('custom.keymaps')
|
||||
require('custom.config')
|
||||
require('custom.lsp')
|
||||
|
||||
-- [[ Highlight on yank ]]
|
||||
-- See `:help vim.highlight.on_yank()`
|
||||
|
@ -333,6 +232,7 @@ require('telescope').setup {
|
|||
-- Enable telescope fzf native, if installed
|
||||
pcall(require('telescope').load_extension, 'fzf')
|
||||
|
||||
local keymap = vim.keymap
|
||||
-- See `:help telescope.builtin`
|
||||
keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
|
||||
keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
|
||||
|
@ -423,100 +323,7 @@ keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic
|
|||
keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
|
||||
keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
|
||||
|
||||
-- [[ Configure LSP ]]
|
||||
-- This function gets run when an LSP connects to a particular buffer.
|
||||
local on_attach = function(_, bufnr)
|
||||
-- NOTE: Remember that lua is a real programming language, and as such it is possible
|
||||
-- to define small helper and utility functions so you don't have to repeat yourself
|
||||
-- many times.
|
||||
--
|
||||
-- In this case, we create a function that lets us more easily define mappings specific
|
||||
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
||||
local nmap = function(keys, func, desc)
|
||||
if desc then
|
||||
desc = 'LSP: ' .. desc
|
||||
end
|
||||
|
||||
keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
|
||||
end
|
||||
|
||||
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
||||
|
||||
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
||||
nmap('ref', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
|
||||
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
|
||||
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
|
||||
-- See `:help K` for why this keymap
|
||||
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
||||
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
||||
|
||||
-- Lesser used LSP functionality
|
||||
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
|
||||
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
|
||||
nmap('<leader>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, '[W]orkspace [L]ist Folders')
|
||||
|
||||
-- Create a command `:Format` local to the LSP buffer
|
||||
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
||||
vim.lsp.buf.format()
|
||||
end, { desc = 'Format current buffer with LSP' })
|
||||
end
|
||||
|
||||
-- Enable the following language servers
|
||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||
--
|
||||
-- Add any additional override configuration in the following tables. They will be passed to
|
||||
-- the `settings` field of the server config. You must look up that documentation yourself.
|
||||
--
|
||||
-- If you want to override the default filetypes that your language server will attach to you can
|
||||
-- define the property 'filetypes' to the map in question.
|
||||
local servers = {
|
||||
-- clangd = {},
|
||||
gopls = {},
|
||||
-- pyright = {},
|
||||
-- rust_analyzer = {},
|
||||
tsserver = {},
|
||||
-- html = { filetypes = { 'html', 'twig', 'hbs'} },
|
||||
|
||||
lua_ls = {
|
||||
Lua = {
|
||||
workspace = { checkThirdParty = false },
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Setup neovim lua configuration
|
||||
require('neodev').setup()
|
||||
|
||||
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
||||
|
||||
-- Ensure the servers above are installed
|
||||
local mason_lspconfig = require 'mason-lspconfig'
|
||||
|
||||
mason_lspconfig.setup {
|
||||
ensure_installed = vim.tbl_keys(servers),
|
||||
}
|
||||
|
||||
mason_lspconfig.setup_handlers {
|
||||
function(server_name)
|
||||
require('lspconfig')[server_name].setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = servers[server_name],
|
||||
-- commented below as currently not overriding file types
|
||||
-- filetypes = servers[server_name].filetypes,
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
-- [[ Configure nvim-cmp ]]
|
||||
-- See `:help cmp`
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
-- See `:help vim.o`
|
||||
|
||||
-- Set highlight on search
|
||||
vim.o.hlsearch = true
|
||||
|
||||
-- Make line numbers default
|
||||
vim.wo.number = true
|
||||
-- Enable relative line numbers
|
||||
vim.wo.relativenumber = true
|
||||
|
||||
-- Enable mouse mode
|
||||
vim.o.mouse = 'a'
|
||||
|
||||
-- Sync clipboard between OS and Neovim.
|
||||
-- Remove this option if you want your OS clipboard to remain independent.
|
||||
-- See `:help 'clipboard'`
|
||||
vim.o.clipboard = 'unnamedplus'
|
||||
|
||||
-- Enable break indent
|
||||
vim.o.breakindent = true
|
||||
|
||||
-- Save undo history
|
||||
vim.o.undofile = true
|
||||
|
||||
-- Case-insensitive searching UNLESS \C or capital in search
|
||||
vim.o.ignorecase = true
|
||||
vim.o.smartcase = true
|
||||
|
||||
-- Keep signcolumn on by default
|
||||
vim.wo.signcolumn = 'yes'
|
||||
|
||||
-- Decrease update time
|
||||
vim.o.updatetime = 250
|
||||
vim.o.timeoutlen = 300
|
||||
|
||||
-- Set completeopt to have a better completion experience
|
||||
vim.o.completeopt = 'menuone,noselect'
|
||||
|
||||
-- appearance
|
||||
-- NOTE: You should make sure your terminal supports this
|
||||
vim.o.termguicolors = true
|
||||
vim.o.background = "dark"
|
||||
vim.o.signcolumn = "yes"
|
||||
|
||||
-- tabs and indentation
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.autoindent = true
|
||||
|
||||
-- split windows
|
||||
vim.o.splitright = true
|
||||
vim.o.splitbelow = true
|
||||
|
||||
vim.opt.iskeyword:append("-")
|
||||
|
||||
-- set color scheme
|
||||
vim.cmd.colorscheme "catppuccin"
|
|
@ -0,0 +1,41 @@
|
|||
-- Keymaps for better default experience
|
||||
-- See `:help vim.keymap.set()`
|
||||
local keymap = vim.keymap
|
||||
keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
||||
|
||||
-- Remap for dealing with word wrap
|
||||
keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||
keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||
|
||||
-- Remap ESC key in different modes
|
||||
keymap.set("i", "jk", "<ESC>")
|
||||
keymap.set("v", "jk", "<ESC>")
|
||||
keymap.set("c", "jk", "<ESC>")
|
||||
|
||||
-- clear highlights
|
||||
keymap.set("n", "<leader>nh", ":nohl<CR>")
|
||||
|
||||
-- delete character but don't copy into register
|
||||
keymap.set("n", "x", '"_x')
|
||||
|
||||
-- increment/decrement numbers
|
||||
keymap.set("n", "<leader>+", "<C-a>")
|
||||
keymap.set("n", "<leader>-", "C-x")
|
||||
|
||||
-- split window
|
||||
keymap.set("n", "<leader>sv", "<C-w>v")
|
||||
keymap.set("n", "<leader>sh", "<C-w>s")
|
||||
keymap.set("n", "<leader>se", "<C-w>=")
|
||||
keymap.set("n", "<leader>sx", ":close<CR>")
|
||||
|
||||
-- tabs
|
||||
keymap.set("n", "<leader>to", ":tabnew<CR>")
|
||||
keymap.set("n", "<leader>tx", ":tabclose<CR>")
|
||||
keymap.set("n", "<leader>tn", ":tabn<CR>")
|
||||
keymap.set("n", "<leader>tp", ":tabp<CR>")
|
||||
|
||||
--maximize window toggle
|
||||
keymap.set("n", "<leader>max", ":MaximizerToggle<CR>")
|
||||
|
||||
-- nvim-tree
|
||||
keymap.set("n", "<leader>tt", ":NvimTreeToggle<CR>")
|
|
@ -0,0 +1,51 @@
|
|||
local M = {}
|
||||
|
||||
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
|
||||
M.capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
M.capabilities = require('cmp_nvim_lsp').default_capabilities(M.capabilities)
|
||||
|
||||
-- This function gets run when an LSP connects to a particular buffer.
|
||||
M.on_attach = function(_, bufnr)
|
||||
-- NOTE: Remember that lua is a real programming language, and as such it is possible
|
||||
-- to define small helper and utility functions so you don't have to repeat yourself
|
||||
-- many times.
|
||||
--
|
||||
-- In this case, we create a function that lets us more easily define mappings specific
|
||||
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
||||
local nmap = function(keys, func, desc)
|
||||
if desc then
|
||||
desc = 'LSP: ' .. desc
|
||||
end
|
||||
|
||||
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
|
||||
end
|
||||
|
||||
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
||||
|
||||
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
||||
nmap('ref', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
|
||||
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
|
||||
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
|
||||
-- See `:help K` for why this keymap
|
||||
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
||||
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
||||
|
||||
-- Lesser used LSP functionality
|
||||
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
|
||||
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
|
||||
nmap('<leader>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, '[W]orkspace [L]ist Folders')
|
||||
|
||||
-- Create a command `:Format` local to the LSP buffer
|
||||
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
||||
vim.lsp.buf.format()
|
||||
end, { desc = 'Format current buffer with LSP' })
|
||||
end
|
||||
|
||||
return M
|
|
@ -0,0 +1,7 @@
|
|||
local status_ok, _ = pcall(require, "lspconfig")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
require "custom.lsp.mason"
|
|
@ -0,0 +1,50 @@
|
|||
-- [[ Configure LSP ]]
|
||||
-- Enable the following language servers
|
||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||
--
|
||||
-- Add any additional override configuration in the following tables. They will be passed to
|
||||
-- the `settings` field of the server config. You must look up that documentation yourself.
|
||||
--
|
||||
-- If you want to override the default filetypes that your language server will attach to you can
|
||||
-- define the property 'filetypes' to the map in question.
|
||||
local servers = {
|
||||
-- clangd = {},
|
||||
gopls = {},
|
||||
-- pyright = {},
|
||||
-- rust_analyzer = {},
|
||||
tsserver = {},
|
||||
-- html = { filetypes = { 'html', 'twig', 'hbs'} },
|
||||
|
||||
lua_ls = {
|
||||
Lua = {
|
||||
workspace = { checkThirdParty = false },
|
||||
telemetry = { enable = false },
|
||||
diagnostics = {
|
||||
globals = { 'vim' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Setup neovim lua configuration
|
||||
require('neodev').setup()
|
||||
|
||||
|
||||
-- Ensure the servers above are installed
|
||||
local mason_lspconfig = require 'mason-lspconfig'
|
||||
|
||||
mason_lspconfig.setup {
|
||||
ensure_installed = vim.tbl_keys(servers),
|
||||
}
|
||||
|
||||
mason_lspconfig.setup_handlers {
|
||||
function(server_name)
|
||||
require('lspconfig')[server_name].setup {
|
||||
capabilities = require("custom.lsp.handlers").capabilities,
|
||||
on_attach = require("custom.lsp.handlers").on_attach,
|
||||
settings = servers[server_name],
|
||||
-- commented below as currently not overriding file types
|
||||
-- filetypes = servers[server_name].filetypes,
|
||||
}
|
||||
end
|
||||
}
|
|
@ -0,0 +1,136 @@
|
|||
-- Find more schemas here: https://www.schemastore.org/json/
|
||||
local default_schemas = nil
|
||||
local status_ok, jsonls_settings = pcall(require, "nlspsettings.jsonls")
|
||||
if status_ok then
|
||||
default_schemas = jsonls_settings.get_default_schemas()
|
||||
end
|
||||
|
||||
local schemas = {
|
||||
{
|
||||
description = "TypeScript compiler configuration file",
|
||||
fileMatch = {
|
||||
"tsconfig.json",
|
||||
"tsconfig.*.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/tsconfig.json",
|
||||
},
|
||||
{
|
||||
description = "Babel configuration",
|
||||
fileMatch = {
|
||||
".babelrc.json",
|
||||
".babelrc",
|
||||
"babel.config.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/babelrc.json",
|
||||
},
|
||||
{
|
||||
description = "ESLint config",
|
||||
fileMatch = {
|
||||
".eslintrc.json",
|
||||
".eslintrc",
|
||||
},
|
||||
url = "https://json.schemastore.org/eslintrc.json",
|
||||
},
|
||||
{
|
||||
description = "Prettier config",
|
||||
fileMatch = {
|
||||
".prettierrc",
|
||||
".prettierrc.json",
|
||||
"prettier.config.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/prettierrc",
|
||||
},
|
||||
{
|
||||
description = "Schema for CMake Presets",
|
||||
fileMatch = {
|
||||
"CMakePresets.json",
|
||||
"CMakeUserPresets.json",
|
||||
},
|
||||
url = "https://raw.githubusercontent.com/Kitware/CMake/master/Help/manual/presets/schema.json",
|
||||
},
|
||||
{
|
||||
description =
|
||||
"AWS CloudFormation provides a common language for you to describe and provision all the infrastructure resources in your cloud environment.",
|
||||
fileMatch = {
|
||||
"*.cf.json",
|
||||
"cloudformation.json",
|
||||
},
|
||||
url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/cloudformation.schema.json",
|
||||
},
|
||||
{
|
||||
description =
|
||||
"The AWS Serverless Application Model (AWS SAM, previously known as Project Flourish) extends AWS CloudFormation to provide a simplified way of defining the Amazon API Gateway APIs, AWS Lambda functions, and Amazon DynamoDB tables needed by your serverless application.",
|
||||
fileMatch = {
|
||||
"serverless.template",
|
||||
"*.sam.json",
|
||||
"sam.json",
|
||||
},
|
||||
url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/sam.schema.json",
|
||||
},
|
||||
{
|
||||
description = "Json schema for properties json file for a GitHub Workflow template",
|
||||
fileMatch = {
|
||||
".github/workflow-templates/**.properties.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/github-workflow-template-properties.json",
|
||||
},
|
||||
{
|
||||
description = "golangci-lint configuration file",
|
||||
fileMatch = {
|
||||
".golangci.toml",
|
||||
".golangci.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/golangci-lint.json",
|
||||
},
|
||||
{
|
||||
description = "JSON schema for the JSON Feed format",
|
||||
fileMatch = {
|
||||
"feed.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/feed.json",
|
||||
versions = {
|
||||
["1"] = "https://json.schemastore.org/feed-1.json",
|
||||
["1.1"] = "https://json.schemastore.org/feed.json",
|
||||
},
|
||||
},
|
||||
{
|
||||
description = "NPM configuration file",
|
||||
fileMatch = {
|
||||
"package.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/package.json",
|
||||
},
|
||||
{
|
||||
description = "Resume json",
|
||||
fileMatch = { "resume.json" },
|
||||
url = "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
|
||||
},
|
||||
}
|
||||
|
||||
local function extend(tab1, tab2)
|
||||
for _, value in ipairs(tab2 or {}) do
|
||||
table.insert(tab1, value)
|
||||
end
|
||||
return tab1
|
||||
end
|
||||
|
||||
local extended_schemas = extend(schemas, default_schemas)
|
||||
|
||||
local opts = {
|
||||
settings = {
|
||||
json = {
|
||||
schemas = extended_schemas,
|
||||
},
|
||||
},
|
||||
setup = {
|
||||
commands = {
|
||||
Format = {
|
||||
function()
|
||||
vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 })
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return opts
|
Loading…
Reference in New Issue