From 76906f1106a3b97ad5859bb02782dc983546568e Mon Sep 17 00:00:00 2001 From: Anish L Date: Mon, 23 May 2022 00:54:14 +1000 Subject: [PATCH] trying out null-ls maybe have working black and mypy now?? --- users/profiles/nvim/default.nix | 41 ++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/users/profiles/nvim/default.nix b/users/profiles/nvim/default.nix index d3ce128e..ac39a11a 100644 --- a/users/profiles/nvim/default.nix +++ b/users/profiles/nvim/default.nix @@ -59,8 +59,8 @@ let pynvim six python-lsp-server - # pylsp-mypy - pylint + python-lsp-black + pylsp-mypy black # other python packages you want ]; @@ -413,6 +413,26 @@ in } cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = ' ' } })) + -- null-ls + local null_ls = require "null-ls" + local pyright = { + cmd = { "pyright" }, + filetypes = { "python", }, + debounce = 250, + debug = false, + default_timeout = 5000, + args = { "-p", "$FILENAME", "--skipunannotated" } + } + local sources = { + pyright, + null_ls.builtins.code_actions.statix, + null_ls.builtins.diagnostics.shellcheck, + -- null_ls.builtins.diagnostics.clj_kondo, + -- null_ls.builtins.formatting.black, + null_ls.builtins.code_actions.proselint, + -- null_ls.builtins.diagnostics.mypy, + } + -- Setup lspconfig require("lsp-format").setup {} @@ -421,10 +441,10 @@ in require('lspconfig').rnix.setup {on_attach = require "lsp-format".on_attach} require('lspconfig').pylsp.setup {on_attach = require "lsp-format".on_attach, settings = { - formatCommand = {"black"}, pylsp = { - configurationSources = { "flake8", "mypy" }, + configurationSources = { "flake8", "mypy", "black" }, plugins = { + black = {enabled = true}, jedi_signature_help = {enabled = true}, jedi_completion = { include_params = true }, pylsp_mypy={ enabled = true }, @@ -475,9 +495,9 @@ in } -- nvim-lint - require('lint').linters_by_ft = { - markdown = {'vale'}, - } + -- require('lint').linters_by_ft = { + -- markdown = {'vale'}, + -- } -- f_term local map = vim.api.nvim_set_keymap @@ -504,6 +524,10 @@ in terraform-lsp clj-kondo gcc + nodePackages.pyright + shellcheck + proselint + statix # installs different langauge servers for neovim-lsp # have a look on the link below to figure out the ones for your languages # https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md @@ -545,7 +569,8 @@ in vim-zettel # lsp stuff - nvim-lint + # nvim-lint + null-ls-nvim nvim-lspconfig nvim-cmp cmp-nvim-lsp