all repos — dotfiles @ 7b8510a5d50f2aed758545ed2fd6bd3afe119264

linux dotfiles

nvim: move null-ls to lsp/init.lua; enable nvim-navic
Prithu Goswami pg@prithu.dev
Tue, 04 Oct 2022 21:49:46 +0530
commit

7b8510a5d50f2aed758545ed2fd6bd3afe119264

parent

54bcc9cb7652226d82fb03051fb498a0ce0de879

3 files changed, 37 insertions(+), 28 deletions(-)

jump to
M config/nvim/init.luaconfig/nvim/init.lua

@@ -105,28 +105,6 @@ disable = {"hcl", "python"}

} } -local null_ls = require("null-ls") - -null_ls.setup({ - debug = false, - sources = { - -- (java|type)script - null_ls.builtins.formatting.prettier, - -- python - null_ls.builtins.formatting.black.with({extra_args={"--fast"}}), - null_ls.builtins.formatting.isort, - null_ls.builtins.diagnostics.flake8.with({ - condition = function(utils) - return utils.root_has_file({".flake8"}) - end, - }), - null_ls.builtins.diagnostics.mypy.with({ - condition = function(utils) - return utils.root_has_file({"pyproject.toml"}) - end, - }), - } -}) -- TODO move to seperate autocmd file vim.cmd ([[
M config/nvim/lua/lsp/init.luaconfig/nvim/lua/lsp/init.lua

@@ -34,7 +34,7 @@ },

} -- TODO set this up when upgrading to Neovim v0.8 --- local navic = require('nvim-navic') +local navic = require('nvim-navic') vim.diagnostic.config(config) vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {

@@ -76,7 +76,9 @@ vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)

vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) vim.keymap.set('n', '<leader>]', vim.lsp.buf.formatting, bufopts) -- TODO set this up when upgrading to Neovim v0.8 - -- navic.attach(client, bufnr) + if client.server_capabilities.documentSymbolProvider then + navic.attach(client, bufnr) + end end

@@ -96,3 +98,32 @@ lspconfig.gopls.setup{

capabilities = capabilities, on_attach = on_attach } + +lspconfig.tsserver.setup{ + capabilities = capabilities, + on_attach = on_attach, +} +-- +local null_ls = require("null-ls") + +null_ls.setup({ + debug = false, + on_attach = on_attach, + sources = { + -- (java|type)script + null_ls.builtins.formatting.prettierd, + -- python + null_ls.builtins.formatting.black.with({extra_args={"--fast"}}), + null_ls.builtins.formatting.isort.with({extra_args={"--profile", "black"}}), + -- null_ls.builtins.diagnostics.flake8.with({ + -- condition = function(utils) + -- return utils.root_has_file({".flake8"}) + -- end, + -- }), + -- null_ls.builtins.diagnostics.mypy.with({ + -- condition = function(utils) + -- return utils.root_has_file({"pyproject.toml"}) + -- end, + -- }), + }, +})
M config/nvim/lua/plugins.luaconfig/nvim/lua/plugins.lua

@@ -20,10 +20,10 @@ -- lsp

use 'neovim/nvim-lspconfig' use 'jose-elias-alvarez/null-ls.nvim' -- set this up when winbar is available - -- use { - -- "SmiteshP/nvim-navic", - -- requires = "neovim/nvim-lspconfig" - -- } + use { + "SmiteshP/nvim-navic", + requires = "neovim/nvim-lspconfig" + } -- completion use 'hrsh7th/nvim-cmp'