smart-open.nvim icon indicating copy to clipboard operation
smart-open.nvim copied to clipboard

virtual_name.lua:26: attempt to perform arithmetic on local 'last' (a nil value)

Open stevenctl opened this issue 1 year ago • 2 comments

Error executing Lua callback: ...azy/smart-open.nvim/lua/smart-open/util/virtual_name.lua:26: attempt to perform arithmetic on local 'last' (a nil value)
stack traceback:
...azy/smart-open.nvim/lua/smart-open/util/virtual_name.lua:26: in function 'get_pos'
...azy/smart-open.nvim/lua/smart-open/util/virtual_name.lua:30: in function 'get_virtual_name'
...m/lua/telescope/_extensions/smart_open/finder/finder.lua:36: in function 'Finder'
...pen.nvim/lua/telescope/_extensions/smart_open/picker.lua:33: in function 'start'
...smart-open.nvim/lua/telescope/_extensions/smart_open.lua:23: in function <...smart-open.nvim/lua/telescope/_extensions/smart_open.lua:10>                                               .../nvim-data/lazy/telescope.nvim/lua/telescope/command.lua:193: in function 'run_command'
.../nvim-data/lazy/telescope.nvim/lua/telescope/command.lua:259: in function 'load_command'
...Local/nvim-data/lazy/telescope.nvim/plugin/telescope.lua:108: in function <...Local/nvim-data/lazy/telescope.nvim/plugin/telescope.lua:107>
NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713484068
Run "nvim -V1 -v" for more info
PS C:\Users\Steven\gamedev\short-dungeon\godot> nvim -V1 --version
NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713484068

Running on Windows 11. It worked for a little while, I'm not really sure what exactly broke. I'm giving it no custom options. The same config works fine on my Linux setup.

stevenctl avatar Jun 06 '24 02:06 stevenctl

I have the same issue on my windows 11 machine

janpeterd avatar Jun 06 '24 11:06 janpeterd

I don't have a windows machine to support windows. I'd take a PR.

danielfalk avatar Jun 11 '24 13:06 danielfalk

This should be fixed on the 0.3.x branch, which should work its way to main eventually.

danielfalk avatar Oct 15 '24 14:10 danielfalk

Seeing the same error attempt to perform arithmetic on local 'last' (a nil value) on windows 10. with the latest smart-open

echaya avatar Oct 28 '24 12:10 echaya

E5108: Error executing lua: ...ged\smart-open.nvim/lua/smart-open/util/virtual_name.lua:27: attempt to perform arithmetic on local 'last' (a nil value)
stack traceback:
	...ged\smart-open.nvim/lua/smart-open/util/virtual_name.lua:27: in function 'get_pos'
	...ged\smart-open.nvim/lua/smart-open/util/virtual_name.lua:31: in function 'get_virtual_name'
	...m/lua/telescope/_extensions/smart_open/finder/finder.lua:36: in function 'Finder'
	...pen.nvim/lua/telescope/_extensions/smart_open/picker.lua:33: in function 'start'
	...smart-open.nvim/lua/telescope/_extensions/smart_open.lua:23: in function 'smart_open'
	D:/Dropbox/neovim/config/nvim_utils_config.lua:13: in function <D:/Dropbox/neovim/config/nvim_utils_config.lua:12>

echaya avatar Oct 28 '24 12:10 echaya

Same issue. It worked only the first time after installing sqlite3.dll, running nvim. Closed it, re-opened and this error appeared Seems this is a Windows path separator issue:

path = "C:/Users/blablal/nvim-data/lazy/smart-open.nvim/lua/smart-open/util/virtual_name.lua"
:lua vim.print(package.config:sub(1, 1) gives \
path:find('\\', 0, true) gives nil

However we cant hardcode path_separator to '/' since some path are given with '\' separator

It looks like smart_open/finder/finder.lua:22 variable history_result contains both forward and backward separator paths history seems to be a sqlite3db instance, so I don't think there is a chance to cleanup the data coming from there. Maybe if someone knows where the data is inserted in the first place, it could be normalized before insertion.

vim.fs.normalize() looks like the way to go, but I need to insert calls to it in the right places

tim-tim707 avatar Jan 10 '25 14:01 tim-tim707