Skip to content
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

Bug: Calling Telescope grapple tags causes Error 'Expected Lua number' #87

Closed
erik-schmidt opened this issue Feb 14, 2024 · 18 comments
Closed

Comments

@erik-schmidt
Copy link

Hi, thank you for this great plugin! I was excited when I saw that telescope is now supported, which I missed coming from harpoon. I followed the guide on the README by firstly calling "require("telescope").load_extension("grapple")" and then calling "Telescope grapple tags", which is showing in the autocompletion menu of telescope when hitting tab (so I am assuming the first command worked correctly). When I have no tags saved, telescope opens without any saved tags, which is expected. Once I save a tag and try to call the "Telescope grapple tags" command, I get the following error:

Error  09:47:08 msg_show.lua_error   Telescope grapple tags Error executing Lua callback: ...l/share/nvim/lazy/telescope.nvim/lua/telescope/utils.lua:226: Expected Lua number
stack traceback:
	[C]: in function 'nvim_win_get_width'
	...l/share/nvim/lazy/telescope.nvim/lua/telescope/utils.lua:226: in function 'calc_result_length'
	...l/share/nvim/lazy/telescope.nvim/lua/telescope/utils.lua:285: in function 'transform_path'
	...vim/lazy/grapple.nvim/lua/telescope/_extensions/tags.lua:23: in function 'entry_maker'
	...scope.nvim/lua/telescope/finders/async_static_finder.lua:17: in function 'generate_grapple_finder'
	...vim/lazy/grapple.nvim/lua/telescope/_extensions/tags.lua:52: in function <...vim/lazy/grapple.nvim/lua/telescope/_extensions/tags.lua:47>
	...share/nvim/lazy/telescope.nvim/lua/telescope/command.lua:183: in function 'run_command'
	...share/nvim/lazy/telescope.nvim/lua/telescope/command.lua:259: in function 'load_command'
	...ocal/share/nvim/lazy/telescope.nvim/plugin/telescope.lua:108: in function <...ocal/share/nvim/lazy/telescope.nvim/plugin/telescope.lua:107>

my configuration for grapple:

  "cbochs/grapple.nvim",
  opts = {
    scope = "git_branch",
    popup_options = {
      width = 100,
      border = "rounded",
    },
  },
  keys = {
    {
      "<C-x>",
      function()
        vim.ui.input({ prompt = "Grapple mark index: " }, function(input)
          local mark = tonumber(input) or input
          if mark then require("grapple").select { key = mark } end
        end)
      end,
      desc = "Goto index of mark",
    },
  },

I also tried to only install grapple with only the default configuration, but the error is still the same. Am I missing something?

@cbochs
Copy link
Owner

cbochs commented Feb 26, 2024

@erik-schmidt Thanks for raising this issue!

I'm focusing on finishing up the rewrite for Grapple so I won't have time to fix telescope integration quite yet. I'm happy to accept a PR for it, if you're willing. Otherwise, I will address this when the rewrite is released.

@cbochs
Copy link
Owner

cbochs commented Feb 29, 2024

@erik-schmidt While the rewrite has not been released yet, it is relatively stable now. In addition, I fixed the telescope extension on that branch 🙂 Feel free to check out the rewrite branch and give it a go. Please note, there are breaking changes in the file format so your previous tags won't be loaded (not deleted, however).

@erik-schmidt
Copy link
Author

@cbochs This was really quick, thank you! I will give it a go and test it.

Regarding the PR for the telescope fix on the main branch, I will try to fix it on my free time. I am no expert in lua, but this could be a great learning opportunity. I try my best

@erik-schmidt
Copy link
Author

@cbochs I have checked out the rewrite branch, but I can't seem to get grapple to work. If I call Grapple open_tags (or any other command) I get the following error:

   Error  21:54:57 msg_show.lua_error   Grapple open_tags Error executing Lua callback: ....local/share/nvim/lazy/grapple.nvim/lua/grapple/path.lua:23: attempt to index field 'uv' (a nil value)
stack traceback:
	....local/share/nvim/lazy/grapple.nvim/lua/grapple/path.lua:23: in function 'get_os'
	....local/share/nvim/lazy/grapple.nvim/lua/grapple/path.lua:32: in main chunk
	[C]: in function 'require'
	...share/nvim/lazy/grapple.nvim/lua/grapple/tag_content.lua:1: in main chunk
	[C]: in function 'require'
	...midt/.local/share/nvim/lazy/grapple.nvim/lua/grapple.lua:341: in function <...midt/.local/share/nvim/lazy/grapple.nvim/lua/grapple.lua:339>
	...midt/.local/share/nvim/lazy/grapple.nvim/lua/grapple.lua:422: in function <...midt/.local/share/nvim/lazy/grapple.nvim/lua/grapple.lua:396>

I have this in my config (using lazy.nvim):

return {
  "cbochs/grapple.nvim",
  branch = "rewrite",
  event = "VeryLazy"
}

@cbochs
Copy link
Owner

cbochs commented Feb 29, 2024

You know, I've been using v0.10 for so long I forgot that the rename of vim.loop to vim.uv was a nightly feature 🤦 Fixed in the most recent commit!

Edit: turns out there are a number of things which are new (vim.system, vim.fs.joinpath, ...). Going to have to check out v0.9.5 for a bit to see what else needs fixing

@cbochs
Copy link
Owner

cbochs commented Mar 1, 2024

@erik-schmidt Everything looks to be functional in 0.9 now. With that all fixed up, I'll likely merge and release in the next few hours. But, if you do try the rewrite branch out and find any more issues, please let me know!

@cbochs cbochs closed this as completed Mar 1, 2024
@erik-schmidt
Copy link
Author

erik-schmidt commented Mar 3, 2024

@cbochs I have tested the new 0.10 release and I still have the exect same issue when calling Telescope grapple tags (after calling require("telescope").load_extension("grapple")) with saved tags. The error message is the same. Without tags I can open the telescope window.

Here is the full error message:

 Error  12:27:22 msg_show.lua_error   Telescope grapple tags Error executing Lua callback: ...l/share/nvim/lazy/telescope.nvim/lua/telescope/utils.lua:226: Expected Lua number
stack traceback:
	[C]: in function 'nvim_win_get_width'
	...l/share/nvim/lazy/telescope.nvim/lua/telescope/utils.lua:226: in function 'calc_result_length'
	...l/share/nvim/lazy/telescope.nvim/lua/telescope/utils.lua:285: in function 'transform_path'
	...vim/lazy/grapple.nvim/lua/telescope/_extensions/tags.lua:39: in function 'entry_maker'
	...scope.nvim/lua/telescope/finders/async_static_finder.lua:17: in function 'create_finder'
	...vim/lazy/grapple.nvim/lua/telescope/_extensions/tags.lua:60: in function <...vim/lazy/grapple.nvim/lua/telescope/_extensions/tags.lua:57>
	...share/nvim/lazy/telescope.nvim/lua/telescope/command.lua:183: in function 'run_command'
	...share/nvim/lazy/telescope.nvim/lua/telescope/command.lua:259: in function 'load_command'
	...ocal/share/nvim/lazy/telescope.nvim/plugin/telescope.lua:108: in function <...ocal/share/nvim/lazy/telescope.nvim/plugin/telescope.lua:107>

Am I missing something? (btw I am using the AstroNvim Distro)
I can try to fix it in my free time.

Edit: I don't want to come as ungrateful, I really like the new changes. Thank you for the hard work you are putting into this plugin!

@cbochs
Copy link
Owner

cbochs commented Mar 3, 2024

Hmm 🤔

I'm following the traceback here...

Can you tell me what the result of the following two commands gives you?

require("telescope.config").values
require("telescope.config").values.path_display

@cbochs cbochs reopened this Mar 3, 2024
@erik-schmidt
Copy link
Author

I get an error if I try these commands:

 Error  18:16:34 msg_show.lua_error   require("telescope.config").values.path_display E5107: Error loading lua [string ":lua"]:1: '=' expected near '<eof>'
 Error  18:17:14 msg_show.lua_error   require("telescope.config").values E5107: Error loading lua [string ":lua"]:1: '=' expected near '<eof>'

If I print the results I get these results:

18:17:52 msg_show   print(require("telescope.config").values) table: 0x0101d42168
18:17:58 msg_show   print(require("telescope.config").values.path_display) table: 0x0101df36e8

Will this help you?

@cbochs
Copy link
Owner

cbochs commented Mar 3, 2024

Ah, sorry. Those were not technically commands, but lua tables I was interested in.

Try these commands:

lua=require("telescope.config").values.path_display
lua=require("telescope.config").values

Note: Prefer vim.print over print as it will print the contents of a lua table as well

@erik-schmidt
Copy link
Author

Ahh, I didn't know that! Now I have learned somthing new 😄

These are the results:

18:50:42 msg_show   vim.print(require("telescope.config").values.path_display) { "truncate" }
18:50:58 msg_show   vim.print(require("telescope.config").values) {
18:50:58 msg_show   vim.print(require("telescope.config").values)   border = true,
18:50:58 msg_show   vim.print(require("telescope.config").values)   borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
18:50:58 msg_show   vim.print(require("telescope.config").values)   buffer_previewer_maker = <function 1>,
18:50:58 msg_show   vim.print(require("telescope.config").values)   cache_picker = {
18:50:58 msg_show   vim.print(require("telescope.config").values)     limit_entries = 1000,
18:50:58 msg_show   vim.print(require("telescope.config").values)     num_pickers = 1
18:50:58 msg_show   vim.print(require("telescope.config").values)   },
18:50:58 msg_show   vim.print(require("telescope.config").values)   color_devicons = true,
18:50:58 msg_show   vim.print(require("telescope.config").values)   cycle_layout_list = { "horizontal", "vertical" },
18:50:58 msg_show   vim.print(require("telescope.config").values)   dynamic_preview_title = false,
18:50:58 msg_show   vim.print(require("telescope.config").values)   entry_prefix = "  ",
18:50:58 msg_show   vim.print(require("telescope.config").values)   file_previewer = <function 2>,
18:50:58 msg_show   vim.print(require("telescope.config").values)   file_sorter = <function 3>,
18:50:58 msg_show   vim.print(require("telescope.config").values)   generic_sorter = <function 4>,
18:50:58 msg_show   vim.print(require("telescope.config").values)   get_selection_window = <function 5>,
18:50:58 msg_show   vim.print(require("telescope.config").values)   get_status_text = <function 6>,
18:50:58 msg_show   vim.print(require("telescope.config").values)   grep_previewer = <function 7>,
18:50:58 msg_show   vim.print(require("telescope.config").values)   history = {
18:50:58 msg_show   vim.print(require("telescope.config").values)     handler = <function 8>,
18:50:58 msg_show   vim.print(require("telescope.config").values)     limit = 100,
18:50:58 msg_show   vim.print(require("telescope.config").values)     path = "/Users/erikschmidt/.local/share/nvim/telescope_history"
18:50:58 msg_show   vim.print(require("telescope.config").values)   },
18:50:58 msg_show   vim.print(require("telescope.config").values)   hl_result_eol = true,
18:50:58 msg_show   vim.print(require("telescope.config").values)   initial_mode = "insert",
18:50:58 msg_show   vim.print(require("telescope.config").values)   layout_config = {
18:50:58 msg_show   vim.print(require("telescope.config").values)     bottom_pane = {
18:50:58 msg_show   vim.print(require("telescope.config").values)       height = 0.8,
18:50:58 msg_show   vim.print(require("telescope.config").values)       preview_cutoff = 120,
18:50:58 msg_show   vim.print(require("telescope.config").values)       prompt_position = "top"
18:50:58 msg_show   vim.print(require("telescope.config").values)     },
18:50:58 msg_show   vim.print(require("telescope.config").values)     center = {
18:50:58 msg_show   vim.print(require("telescope.config").values)       height = 0.8,
18:50:58 msg_show   vim.print(require("telescope.config").values)       preview_cutoff = 120,
18:50:58 msg_show   vim.print(require("telescope.config").values)       prompt_position = "top",
18:50:58 msg_show   vim.print(require("telescope.config").values)       width = 0.87
18:50:58 msg_show   vim.print(require("telescope.config").values)     },
18:50:58 msg_show   vim.print(require("telescope.config").values)     cursor = {
18:50:58 msg_show   vim.print(require("telescope.config").values)       height = 0.8,
18:50:58 msg_show   vim.print(require("telescope.config").values)       preview_cutoff = 120,
18:50:58 msg_show   vim.print(require("telescope.config").values)       width = 0.87
18:50:58 msg_show   vim.print(require("telescope.config").values)     },
18:50:58 msg_show   vim.print(require("telescope.config").values)     height = 0.8,
18:50:58 msg_show   vim.print(require("telescope.config").values)     horizontal = {
18:50:58 msg_show   vim.print(require("telescope.config").values)       height = 0.8,
18:50:58 msg_show   vim.print(require("telescope.config").values)       preview_cutoff = 120,
18:50:58 msg_show   vim.print(require("telescope.config").values)       preview_width = 0.55,
18:50:58 msg_show   vim.print(require("telescope.config").values)       prompt_position = "top",
18:50:58 msg_show   vim.print(require("telescope.config").values)       width = 0.87
18:50:58 msg_show   vim.print(require("telescope.config").values)     },
18:50:58 msg_show   vim.print(require("telescope.config").values)     preview_cutoff = 120,
18:50:58 msg_show   vim.print(require("telescope.config").values)     vertical = {
18:50:58 msg_show   vim.print(require("telescope.config").values)       height = 0.8,
18:50:58 msg_show   vim.print(require("telescope.config").values)       mirror = false,
18:50:58 msg_show   vim.print(require("telescope.config").values)       preview_cutoff = 120,
18:50:58 msg_show   vim.print(require("telescope.config").values)       prompt_position = "bottom",
18:50:58 msg_show   vim.print(require("telescope.config").values)       width = 0.87
18:50:58 msg_show   vim.print(require("telescope.config").values)     },
18:50:58 msg_show   vim.print(require("telescope.config").values)     width = 0.87
18:50:58 msg_show   vim.print(require("telescope.config").values)   },
18:50:58 msg_show   vim.print(require("telescope.config").values)   layout_strategy = "horizontal",
18:50:58 msg_show   vim.print(require("telescope.config").values)   mappings = {
18:50:58 msg_show   vim.print(require("telescope.config").values)     i = {
18:50:58 msg_show   vim.print(require("telescope.config").values)       ["<C-j>"] = { "move_selection_next",
18:50:58 msg_show   vim.print(require("telescope.config").values)         <metatable> = <1>{
18:50:58 msg_show   vim.print(require("telescope.config").values)           __add = <function 9>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           __call = <function 10>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           __index = <table 1>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           _func = {
18:50:58 msg_show   vim.print(require("telescope.config").values)             move_selection_next = <function 11>
18:50:58 msg_show   vim.print(require("telescope.config").values)           },
18:50:58 msg_show   vim.print(require("telescope.config").values)           _post = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           _pre = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           _replacements = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           _static_post = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           _static_pre = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           clear = <function 12>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           enhance = <function 13>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           replace = <function 14>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           replace_if = <function 15>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           replace_map = <function 16>
18:50:58 msg_show   vim.print(require("telescope.config").values)         }
18:50:58 msg_show   vim.print(require("telescope.config").values)       },
18:50:58 msg_show   vim.print(require("telescope.config").values)       ["<C-k>"] = { "move_selection_previous",
18:50:58 msg_show   vim.print(require("telescope.config").values)         <metatable> = <2>{
18:50:58 msg_show   vim.print(require("telescope.config").values)           __add = <function 17>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           __call = <function 18>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           __index = <table 2>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           _func = {
18:50:58 msg_show   vim.print(require("telescope.config").values)             move_selection_previous = <function 19>
18:50:58 msg_show   vim.print(require("telescope.config").values)           },
18:50:58 msg_show   vim.print(require("telescope.config").values)           _post = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           _pre = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           _replacements = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           _static_post = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           _static_pre = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           clear = <function 20>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           enhance = <function 21>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           replace = <function 22>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           replace_if = <function 23>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           replace_map = <function 24>
18:50:58 msg_show   vim.print(require("telescope.config").values)         }
18:50:58 msg_show   vim.print(require("telescope.config").values)       },
18:50:58 msg_show   vim.print(require("telescope.config").values)       ["<C-n>"] = { "cycle_history_next",
18:50:58 msg_show   vim.print(require("telescope.config").values)         <metatable> = <3>{
18:50:58 msg_show   vim.print(require("telescope.config").values)           __add = <function 25>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           __call = <function 26>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           __index = <table 3>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           _func = {
18:50:58 msg_show   vim.print(require("telescope.config").values)             cycle_history_next = <function 27>
18:50:58 msg_show   vim.print(require("telescope.config").values)           },
18:50:58 msg_show   vim.print(require("telescope.config").values)           _post = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           _pre = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           _replacements = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           _static_post = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           _static_pre = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           clear = <function 28>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           enhance = <function 29>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           replace = <function 30>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           replace_if = <function 31>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           replace_map = <function 32>
18:50:58 msg_show   vim.print(require("telescope.config").values)         }
18:50:58 msg_show   vim.print(require("telescope.config").values)       },
18:50:58 msg_show   vim.print(require("telescope.config").values)       ["<C-p>"] = { "cycle_history_prev",
18:50:58 msg_show   vim.print(require("telescope.config").values)         <metatable> = <4>{
18:50:58 msg_show   vim.print(require("telescope.config").values)           __add = <function 33>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           __call = <function 34>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           __index = <table 4>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           _func = {
18:50:58 msg_show   vim.print(require("telescope.config").values)             cycle_history_prev = <function 35>
18:50:58 msg_show   vim.print(require("telescope.config").values)           },
18:50:58 msg_show   vim.print(require("telescope.config").values)           _post = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           _pre = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           _replacements = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           _static_post = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           _static_pre = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           clear = <function 36>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           enhance = <function 37>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           replace = <function 38>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           replace_if = <function 39>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           replace_map = <function 40>
18:50:58 msg_show   vim.print(require("telescope.config").values)         }
18:50:58 msg_show   vim.print(require("telescope.config").values)       }
18:50:58 msg_show   vim.print(require("telescope.config").values)     },
18:50:58 msg_show   vim.print(require("telescope.config").values)     n = {
18:50:58 msg_show   vim.print(require("telescope.config").values)       q = { "close",
18:50:58 msg_show   vim.print(require("telescope.config").values)         <metatable> = <5>{
18:50:58 msg_show   vim.print(require("telescope.config").values)           __add = <function 41>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           __call = <function 42>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           __index = <table 5>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           _func = {
18:50:58 msg_show   vim.print(require("telescope.config").values)             close = <function 43>
18:50:58 msg_show   vim.print(require("telescope.config").values)           },
18:50:58 msg_show   vim.print(require("telescope.config").values)           _post = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           _pre = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           _replacements = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           _static_post = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           _static_pre = {},
18:50:58 msg_show   vim.print(require("telescope.config").values)           clear = <function 44>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           enhance = <function 45>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           replace = <function 46>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           replace_if = <function 47>,
18:50:58 msg_show   vim.print(require("telescope.config").values)           replace_map = <function 48>
18:50:58 msg_show   vim.print(require("telescope.config").values)         }
18:50:58 msg_show   vim.print(require("telescope.config").values)       }
18:50:58 msg_show   vim.print(require("telescope.config").values)     }
18:50:58 msg_show   vim.print(require("telescope.config").values)   },
18:50:58 msg_show   vim.print(require("telescope.config").values)   multi_icon = "+",
18:50:58 msg_show   vim.print(require("telescope.config").values)   path_display = { "truncate" },
18:50:58 msg_show   vim.print(require("telescope.config").values)   prefilter_sorter = <function 49>,
18:50:58 msg_show   vim.print(require("telescope.config").values)   preview = {
18:50:58 msg_show   vim.print(require("telescope.config").values)     check_mime_type = true,
18:50:58 msg_show   vim.print(require("telescope.config").values)     filesize_limit = 25,
18:50:58 msg_show   vim.print(require("telescope.config").values)     hide_on_startup = false,
18:50:58 msg_show   vim.print(require("telescope.config").values)     msg_bg_fillchar = "╱",
18:50:58 msg_show   vim.print(require("telescope.config").values)     timeout = 250,
18:50:58 msg_show   vim.print(require("telescope.config").values)     treesitter = true
18:50:58 msg_show   vim.print(require("telescope.config").values)   },
18:50:58 msg_show   vim.print(require("telescope.config").values)   prompt_prefix = "❯ ",
18:50:58 msg_show   vim.print(require("telescope.config").values)   prompt_title = "Prompt",
18:50:58 msg_show   vim.print(require("telescope.config").values)   qflist_previewer = <function 50>,
18:50:58 msg_show   vim.print(require("telescope.config").values)   results_title = "Results",
18:50:58 msg_show   vim.print(require("telescope.config").values)   scroll_strategy = "cycle",
18:50:58 msg_show   vim.print(require("telescope.config").values)   selection_caret = "❯ ",
18:50:58 msg_show   vim.print(require("telescope.config").values)   selection_strategy = "reset",
18:50:58 msg_show   vim.print(require("telescope.config").values)   sorting_strategy = "ascending",
18:50:58 msg_show   vim.print(require("telescope.config").values)   tiebreak = <function 51>,
18:50:58 msg_show   vim.print(require("telescope.config").values)   use_less = true,
18:50:58 msg_show   vim.print(require("telescope.config").values)   vimgrep_arguments = { "rg", "--color=never", "--no-heading", "--with-filename", "--line-number", "--column", "--smart-case" },
18:50:58 msg_show   vim.print(require("telescope.config").values)   winblend = 0,
18:50:58 msg_show   vim.print(require("telescope.config").values)   wrap_results = false
18:50:58 msg_show   vim.print(require("telescope.config").values) }

@cbochs
Copy link
Owner

cbochs commented Mar 3, 2024

Ok, great! Can you see what printing this gives you?

lua=require("telescope.config").values.path_display.truncate

@erik-schmidt
Copy link
Author

Sure, here it is. It just gives a nil value:

19:05:44 msg_show   vim.print(require("telescope.config").values.path_display.truncate) nil

@cbochs
Copy link
Owner

cbochs commented Mar 3, 2024

This looks a bit like a telescope bug. Looking at the help docs for utils.transform_path:

Transform path is a util function that formats a path based on path_display
found in opts or the default value from config. It is meant to be used in
make_entry to have a uniform interface for builtins as well as extensions
utilizing the same user configuration

Looking at calc_result_length:

local calc_result_length = function(truncate_len)
  local status = get_status(vim.api.nvim_get_current_buf())
  local len = vim.api.nvim_win_get_width(status.results_win) - status.picker.selection_caret:len() - 2
  return type(truncate_len) == "number" and len - truncate_len or len
end

It's expecting get_status to return a status for the current picker. That is, telescope should have already created a preview window when this function is called. However, the results_win is not set by this point and is likely the reason your are seeing this error.

Also, it looks like right now you are using the 0.1.x branch of telescope. I might suggest trying out the master branch and seeing if that resolves your issue.

In the mean time, I'll make a small tweak to the extension so that it doesn't try truncating the path.

@erik-schmidt
Copy link
Author

With the newest change this has been fixed and I can open the telescope window with tags without any issues. Thank you for the effort. I am going to close this issue.

@erik-schmidt
Copy link
Author

I have now tested the telescope window with tags and I get another error:

[telescope] [WARN  07:45:48] /Users/erikschmidt/.local/share/nvim/lazy/telescope.nvim/lua/telescope/pickers.lua:497: Finder failed with msg:  ...share/nvim/lazy/telescope.nvim/lua/telescope/sorters.lua:359: attempt to index local 'line' (a number value)

Can this be because of a telescope sorter I have? (I am using the fzy-sorter)
Regarding the telescope version: I am using 0.1.5 and I am on the master branch.

@erik-schmidt erik-schmidt reopened this Mar 4, 2024
@cbochs
Copy link
Owner

cbochs commented Mar 4, 2024

From telescope's help docs:

ordinal: string to be sorted derived from value

Nope. That one is on me this time. As you can tell, I don't write telescope extensions that often. Should be fixed 🤞 in the most recent commit

@erik-schmidt
Copy link
Author

I have tested it and it works! It sorts the matching tag at the top. If I find the time I can also dig into the code and try to fix it. But for now this is more than enough for me.

Since the bug has been fixed, I can close this issue. I appreciate your effort on this one, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants