Open dir01 opened 7 months ago
:set rtp?
runtimepath=~/.config/nvim,~/.local/share/nvim/lazy/lazy.nvim,~/.local/share/nvim/lazy/LuaSnip,~/.local/share/nvim/lazy/nvim-cmp,~/.local/share/nvim/lazy/telescope-live-grep-args.nvim,~/.
local/share/nvim/lazy/nvim-web-devicons,~/.local/share/nvim/lazy/telescope.nvim,~/.local/share/nvim/lazy/nvim-treesitter-pyfold,~/.local/share/nvim/lazy/lsp-zero.nvim,~/.local/share/nvim/la
zy/mason-lspconfig.nvim,~/.local/share/nvim/lazy/cmp-nvim-lsp,~/.local/share/nvim/lazy/nvim-lspconfig,~/.local/share/nvim/lazy/vim-tmux-navigator,~/.local/share/nvim/lazy/git-blame.nvim,~/.
local/share/nvim/lazy/vim-repeat,~/.local/share/nvim/lazy/vim-surround,~/.local/share/nvim/lazy/which-key.nvim,~/.local/share/nvim/lazy/auto-save.nvim,~/.local/share/nvim/lazy/plenary.nvim,
~/.local/share/nvim/lazy/harpoon,~/.local/share/nvim/lazy/vim-gitgutter,~/.local/share/nvim/lazy/copilot.vim,~/.local/share/nvim/lazy/mason.nvim,~/.local/share/nvim/lazy/nvim-treesitter,~/.
local/share/nvim/lazy/dressing.nvim,~/.local/share/nvim/lazy/auto-dark-mode.nvim,~/.local/share/nvim/lazy/catppuccin,/usr/local/Cellar/neovim/0.9.5/share/nvim/runtime,/usr/local/Cellar/neov
im/0.9.5/share/nvim/runtime/pack/dist/opt/matchit,/usr/local/Cellar/neovim/0.9.5/lib/nvim,~/.local/state/nvim/lazy/readme,~/.local/share/nvim/lazy/cmp-nvim-lsp/after,~/.local/share/nvim/laz
y/catppuccin/after
:lua =vim.api.nvim_get_runtime_file('**/nvim-treesitter-pyfold/queries/python/folds.scm', false)
{}
:lua =vim.api.nvim_get_runtime_file('queries/python/folds.scm', false)
{ "/Users/foo/.local/share/nvim/lazy/nvim-treesitter-pyfold/queries/python/folds.scm" }
So looks like the issue is with rtp_search_str, however, I'm not sure what the proper fix would be
For now I worked around the issue by configuring the plugin as
{
"eddiebergman/nvim-treesitter-pyfold",
ft = "python",
config = function()
vim.opt.runtimepath:append('~/.local/share/nvim')
end
},
but now first opened python file takes 4-5 seconds to load (old intel mac)
not sure if it's a side effect of a glob search over ~/.local/share/nvim
, or just how long it takes the plugin to do its thing, will investigate further
Yeah, no, manually changing my local copy of folding.lua
to spell local rtp_search_str = 'queries/python/folds.scm'
fixes the issue, and the file now opens instantly.
The only fix that comes to mind is to add local lazy_rtp_search_str = 'queries/python/folds.scm'
and add a fallback case, but I know very little of nvim plugins and whether there is another, more robust way to solve this, so not going to prepare a pull request.
My final workaround is to set it up like this:
{
"eddiebergman/nvim-treesitter-pyfold",
ft = "python",
config = function()
require('nvim-treesitter-pyfold/folding').cache['fold_path'] = vim.api.nvim_get_runtime_file('queries/python/folds.scm', false)[1]
end
},
Ah, no, scratch that, it didn't work: for some reason, table that I mutate and table that is being used when python file is opened are different tables with different memory addresses 🤷
I guess forking is now the only option I have left
Checked existing forks and found https://github.com/MPCodeWriter21/nvim-treesitter-pyfold
The plugin is installed with https://github.com/folke/lazy.nvim as following:
When opening a python file, the following error happens