-
-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting error with telescope git_worktrees() #112
Comments
You can make your own fork of the repo and apply a quick fix that @aaronhallaert found. -- if key == 'path' then
-- local new_path = utils.transform_path(opts, entry[key])
-- local path_len = strings.strdisplaywidth(new_path or "")
-- widths[key] = math.max(val, path_len)
-- else
widths[key] = math.max(val, strings.strdisplaywidth(entry[key] or ""))
-- end And then use your own fork in vim until this repo gets a PR. |
I ran into the same issue, the fork from @nooproblem fixed it for me. 🙏 Are there any attempts to add this fix to this repo as well? |
Late reply from me but thank you very much for your help. I found a quick fix by removing |
I am now maintaining the repo, I think it is fixed on my fork. I am working on a v2 to improve this plugin. |
Just tested it with your fork @polarmutex E5108: Error executing lua: ...l/share/nvim/lazy/telescope.nvim/lua/telescope/utils.lua:206: attempt to index field 'layout' (a nil value)
stack traceback:
...l/share/nvim/lazy/telescope.nvim/lua/telescope/utils.lua:206: in function 'calc_result_length'
...l/share/nvim/lazy/telescope.nvim/lua/telescope/utils.lua:265: in function 'transform_path'
...worktree.nvim/lua/telescope/_extensions/git_worktree.lua:166: in function 'parse_line'
...worktree.nvim/lua/telescope/_extensions/git_worktree.lua:179: in function 'git_worktrees'
/home/msc/.config/nvim/lua/custom/mappings.lua:54: in function </home/msc/.config/nvim/lua/custom/mappings.lua:53> Also checked my |
I will look into it today |
with that option, I do see errors (I can look into this later). removing that option I see the telescope window pop up |
I would really like to keep |
Can confirm, removing |
You can customize I have the following mapping which overrides my default {
"<leader>gws",
function()
require("telescope").extensions.git_worktree.git_worktrees({
path_display = {},
})
end,
desc = "Manage Worktrees",
},
|
Hi all, Telescope message:
|
Hi there !
When using the command
lua require('telescope').extensions.git_worktree.git_worktrees()
I get the following error :E5108: Error executing lua ...l/share/nvim/lazy/telescope.nvim/lua/telescope/utils.lua:206: attempt to index field 'layout' (a nil value) stack traceback: ...l/share/nvim/lazy/telescope.nvim/lua/telescope/utils.lua:206: in function 'calc_result_length' ...l/share/nvim/lazy/telescope.nvim/lua/telescope/utils.lua:265: in function 'transform_path' ...worktree.nvim/lua/telescope/_extensions/git_worktree.lua:166: in function 'parse_line' ...worktree.nvim/lua/telescope/_extensions/git_worktree.lua:179: in function 'git_worktrees' [string ":lua"]:1: in main chunk
The command
lua require('telescope').extensions.git_worktree.create_git_worktree()
works just fine.Tried on windows wsl (ubuntu 22.04), neovim v0.9.2 Release.
Here is my config (kept it barebones).
Lazy plugins config:
{ "ThePrimeagen/git-worktree.nvim", config = function() require("telescope").load_extension("git_worktree") end, },
init.lua for mappings (give the same result as executing lua function in command mode) :
`vim.keymap.set("n", "gw", function ()
require('telescope').extensions.git_worktree.git_worktrees()
end,
{ desc = "Telescope switch & delete worktrees"})
vim.keymap.set("n", "gc", function ()
require('telescope').extensions.git_worktree.create_git_worktree()
end,
{ desc = "Telescope create worktree"})
`
Thank you very much for the help
EDIT:
I made the test under my home Linux laptop (Fedora 38) and the same thing happens.
Aslo tested under plain windows and there the Telescope window does open correctly. However, there is an error every time I try to switch to a worktree saying the directory doesn't exist.
When trying to create a worktree under windows via the telescope extension, the path looks like
c:\users\globule\Documents\myawesomegitrepo\c:\users\globule\Documents\myawesomegitrepo\mybranch
which leads to an error but it still creates the folder.However, when trying to switch between workspaces created via the telescope extension, I get the error "The workspace doesn't exist, please create it first c:\users\globule\Documents\myawesomegitrepo"
The text was updated successfully, but these errors were encountered: