fix null_ls and ts_ls issues

master
Rostyslav Hnatyshyn 3 months ago
parent 87f624ac3c
commit a94cd9350d
  1. 31
      nvim/init.lua

@ -124,7 +124,9 @@ local on_attach = function(client, bufnr)
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ bufnr = bufnr })
vim.lsp.buf.format({
bufnr = bufnr,
})
end
})
end
@ -140,8 +142,9 @@ lsp.svelte.setup { on_attach = on_attach }
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.offsetEncoding = { "utf-16" }
lsp.clangd.setup { on_attach = on_attach, capabilities = capabilities }
-- https://github.com/denoland/deno - maybe switch?
lsp.tsserver.setup { on_attach = on_attach }
lsp.ts_ls.setup { on_attach = function(client, bufnr)
on_attach(client, bufnr)
end, }
lsp.marksman.setup { on_attach = on_attach }
lsp.rust_analyzer.setup { on_attach = on_attach }
lsp.lua_ls.setup { on_attach = on_attach,
@ -298,10 +301,8 @@ return require('packer').startup(function(use)
})
end
}
--use { 'jose-elias-alvarez/typescript.nvim',
-- config = function() require("typescript")
use {
'jose-elias-alvarez/null-ls.nvim',
'nvimtools/none-ls.nvim',
config = function()
local null_ls = require("null-ls")
local lsp_conf = require("lspconfig")
@ -309,6 +310,7 @@ return require('packer').startup(function(use)
-- util.root_pattern returns a function
local find_pyproject = lsp_conf.util.root_pattern('pyproject.toml')
local find_flake8 = lsp_conf.util.root_pattern('.flake8')
-- local find_eslint = lsp_conf.util.root_pattern('eslint.config.js')
local isort = null_ls.builtins.formatting.isort.with({
cwd = function(params)
@ -322,21 +324,21 @@ return require('packer').startup(function(use)
end
})
local flake8 = null_ls.builtins.diagnostics.flake8.with({
local flake8 = require("none-ls.diagnostics.flake8").with({
cwd = function(params)
return find_flake8(params.root) or params.root
end
})
local eslint_format = null_ls.builtins.formatting.eslint_d.with({
local eslint_format = require("none-ls.formatting.eslint_d").with({
extra_filetypes = { "svelte" },
})
local eslint_diag = null_ls.builtins.diagnostics.eslint_d.with({
local eslint_diag = require("none-ls.diagnostics.eslint_d").with({
extra_filetypes = { "svelte" },
})
local eslint_code_actions = null_ls.builtins.code_actions.eslint_d.with({
local eslint_code_actions = require("none-ls.code_actions.eslint_d").with({
extra_filetypes = { "svelte" },
})
@ -348,19 +350,22 @@ return require('packer').startup(function(use)
eslint_diag,
eslint_code_actions,
null_ls.builtins.code_actions.gitsigns,
flake8,
isort,
black,
flake8
}
}
end,
requires = { "nvim-lua/plenary.nvim" },
requires = { "nvim-lua/plenary.nvim",
"nvimtools/none-ls-extras.nvim"
},
}
use {
'folke/trouble.nvim',
config = function()
require("trouble").setup {
nmap("<leader>xx", "<cmd>TroubleToggle<cr>"),
nmap("<leader>xx", "<cmd>Trouble<cr>"),
}
end
}
@ -428,7 +433,7 @@ return require('packer').startup(function(use)
require('gitsigns').setup {
on_attach = function()
nmap('<leader>hd', '<cmd>Gitsigns diffthis<cr>')
nmap('<leader>hp', '<cmd>Gitsigns preview_hunk<cr>')
nmap('<leader>hr', '<cmd>Gitsigns reset_hunk<cr>')
nmap('<leader>td', '<cmd>Gitsigns toggle_deleted<cr>')
end
}

Loading…
Cancel
Save