From c58fa424ac163d3e1c838f77014c7098e37cf836 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Mon, 5 Aug 2024 18:22:59 -0400 Subject: [PATCH] nvim: update coding config - treesitter upgrade - defer pyright hints to ruff --- src/.config/nvim/init.vim | 6 ------ src/.config/nvim/lua/coding.lua | 15 +++++++++++++-- .../share/nvim/site/pack/3pp/opt/nvim-treesitter | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/.config/nvim/init.vim b/src/.config/nvim/init.vim index 1888fb6..4238df4 100755 --- a/src/.config/nvim/init.vim +++ b/src/.config/nvim/init.vim @@ -82,12 +82,6 @@ nnoremap ZF :qa " see .config/nvim/lua/init.lua lua require('init') -" Code folding -set foldmethod=expr -set foldexpr=nvim_treesitter#foldexpr() -" unfold by default -set foldlevel=99 - " auto-pairs packadd auto-pairs let g:AutoPairsFlyMode = 0 diff --git a/src/.config/nvim/lua/coding.lua b/src/.config/nvim/lua/coding.lua index 197455f..8203133 100644 --- a/src/.config/nvim/lua/coding.lua +++ b/src/.config/nvim/lua/coding.lua @@ -58,6 +58,11 @@ require 'nvim-treesitter.configs'.setup { }, } +-- code folding +vim.wo.foldmethod = 'expr' +vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()' +vim.wo.foldlevel = 99 -- unfold by default + ------ -- treesitter (language intelligent) motions ------ @@ -148,6 +153,12 @@ end -- find ruff config file path local ruff_config = vim.fs.root(0, { ".git", "pyproject.toml" }) or "" +vim.cmd.packadd("cmp-nvim-lsp") +local cmp_nvim_lsp = require('cmp_nvim_lsp') +local pyright_cap = cmp_nvim_lsp.default_capabilities() +-- disable hint level diagnostics in pyright (defer to ruff) +pyright_cap.textDocument.publishDiagnostics = { tagSupport = { valueSet = { 2 } } } + -- table declares LSPs to be set up -- as well as settings per server (overrides defaults) local servers = { @@ -157,7 +168,8 @@ local servers = { -- defer to ruff disableOrganizeImports = true, }, - } + }, + capabilities = pyright_cap, }, ruff = { settings = { @@ -231,7 +243,6 @@ end -- completions ------ vim.cmd.packadd("nvim-cmp") -vim.cmd.packadd("cmp-nvim-lsp") local cmp = require('cmp') cmp.setup({ diff --git a/src/.local/share/nvim/site/pack/3pp/opt/nvim-treesitter b/src/.local/share/nvim/site/pack/3pp/opt/nvim-treesitter index aa02427..1aad04e 160000 --- a/src/.local/share/nvim/site/pack/3pp/opt/nvim-treesitter +++ b/src/.local/share/nvim/site/pack/3pp/opt/nvim-treesitter @@ -1 +1 @@ -Subproject commit aa02427dfeaead86fae038024ae7b29299f08b8c +Subproject commit 1aad04ecde5ebf8f2b3eea5c6f39d38b251757f5