auto-save.nvim
auto-save.nvim copied to clipboard
Error with colors.lua
Error detected while processing VimEnter Autocommands for "*":
Error executing lua callback: ...cker/start/auto-save.nvim/lua/auto-save/utils/colors.lua:6: bad argument #1 to 'lower' (string expected, got nil)
stack traceback:
[C]: in function 'lower'
...cker/start/auto-save.nvim/lua/auto-save/utils/colors.lua:6: in function 'hex_to_rgb'
...cker/start/auto-save.nvim/lua/auto-save/utils/colors.lua:51: in function 'darken'
.../pack/packer/start/auto-save.nvim/lua/auto-save/init.lua:112: in function <.../pack/packer/start/auto-save.nvim/lua/auto-save/init.lua:106>
Here is my config
local autosave = require("auto-save")
autosave.setup({
enabled = true,
execution_message = {
cleaning_interval = 1000,
},
trigger_events = { "InsertLeave", "TextChanged" },
write_all_buffers = true,
debounce_delay = 135,
})
Here is my nvim config For my color scheme I use a modified base16 scheme (original | my scheme)
Yup same issue with me....
Same issue!
Same issue here, I have pin-pointed the issue to this line.
I have found that parameter bg
can be nil
, but apprently, neither blend
or hex_to_rgb
in that file check the validity of parameters.
I suggest the author focus more on the quality than excessive refactoring without any kind of check.
@jdhao I did check, I always test things locally before pushing (i.e. adding the repo nvim's runtime path to test my changes).
Everything was working fine on mind.
@SymphonySimper I'll fix it :)
@Pocco81 Thank you for being responsive! We appreciate your time and energy in maintaining and continuous improvement on this project:) I'll eagerly wait for the fix
same error
Error executing lua callback: .../paqs/start/autosave.nvim/lua/auto-save/utils/colors.lua:6: bad argument #1 to 'lower' (string expected, got nil)
stack traceback:
[C]: in function 'lower'
.../paqs/start/autosave.nvim/lua/auto-save/utils/colors.lua:6: in function 'hex_to_rgb'
.../paqs/start/autosave.nvim/lua/auto-save/utils/colors.lua:51: in function 'darken'
...ite/pack/paqs/start/autosave.nvim/lua/auto-save/init.lua:112: in function <...ite/pack/paqs/start/autosave.nvim/lua/auto-save/init.lua:106>
Same here~
Hi, for those who want a workaround here is how I fixed it (I did not tried to understand the source code and only wanted to make the error disappear).
Edit the colors.lua
file, for example in nvim :e ~/.local/share/nvim/site/pack/packer/start/auto-save.nvim/lua/auto-save/utils/colors.lua
.
Then simply add the following after the local M = {}
declaration.
M.bg = "#ffffff"
M.fg = "#ffffff"
Please everyone interested in the fix test the latest commits pushed to the dev
branch.
Also, just to clarify what's been happening:
the problem is with the dim
functionality that I added to the plugin after the rewrite. This feature dims the color of the autosave text to make it less visually obtrusive (since you'll be seeing this a lot). For example, by setting execution_message = { dim = 0.50 }
you'll get:
This feature can be completely disabled by setting dim = 0
(this will also make the issue on matter disappear, but please! try the latest fix and let me know if it works. I think it's a really neat feature to have :)
Current solution
The patches I pushed to the dev branch are working for me (tested both with a precompiled colorscheme and a normal one by running autosave at startup and by just adding it to nvim's runtime).
Let me know if they work for you! If not then I have 3 other solutions I can test out.
I'm still getting the exact same error
Error executing vim.schedule lua callback: ...cker/start/auto-save.nvim/lua/auto-save/utils/colors.lua:6: bad argument #1 to 'lower' (string expected, got nil)
stack traceback:
[C]: in function 'lower'
...cker/start/auto-save.nvim/lua/auto-save/utils/colors.lua:6: in function 'hex_to_rgb'
...cker/start/auto-save.nvim/lua/auto-save/utils/colors.lua:51: in function 'darken'
.../pack/packer/start/auto-save.nvim/lua/auto-save/init.lua:114: in function <.../pack/packer/start/auto-save.nvim/lua/auto-save/init.lua:108>
Setting dim = 0 doesn't seem to work either
local autosave = require("auto-save")
autosave.setup({
enabled = true,
execution_message = {
cleaning_interval = 1000,
dim = 0,
},
trigger_events = { "InsertLeave", "TextChanged" },
write_all_buffers = true,
debounce_delay = 135,
})
Packer config
use({ "Pocco81/auto-save.nvim", branch = "dev" })
@SymphonySimper I'm gonna try with your conf.
我仍然收到完全相同的错误
Error executing vim.schedule lua callback: ...cker/start/auto-save.nvim/lua/auto-save/utils/colors.lua:6: bad argument #1 to 'lower' (string expected, got nil) stack traceback: [C]: in function 'lower' ...cker/start/auto-save.nvim/lua/auto-save/utils/colors.lua:6: in function 'hex_to_rgb' ...cker/start/auto-save.nvim/lua/auto-save/utils/colors.lua:51: in function 'darken' .../pack/packer/start/auto-save.nvim/lua/auto-save/init.lua:114: in function <.../pack/packer/start/auto-save.nvim/lua/auto-save/init.lua:108>
设置 dim = 0 似乎也不起作用
local autosave = require("auto-save") autosave.setup({ enabled = true, execution_message = { cleaning_interval = 1000, dim = 0, }, trigger_events = { "InsertLeave", "TextChanged" }, write_all_buffers = true, debounce_delay = 135, })
打包程序配置
use({ "Pocco81/auto-save.nvim", branch = "dev" })
I tried to set dim = 0
in source code. After that, auto-save didn't throw any errors.
From my perspective, auto-save
is run after users require it, but it was using the default configurations, dim = 0.18
. Because setup
works after the plugin runs.
Adding that I have this issue as well.
Adding that I have this issue as well.
You could try my PR, and then set dim = 0
. I think it will be useful
Adding that I have this issue as well.
You could try my PR, and then set
dim = 0
. I think it will be useful
Hmm, strangely your PR doesn't fix it for me, even with setting dim = 0.
EDIT: Nevermind, it did! I hadn't updated require("autosave") to require("auto-save") yet
I am just wondering how long until this is fixed? 🤔
Found the issue, will fire a PR once I understand how dim
is supposed to work :P
@coder3101 how about now? :)
@coder3101 how about now? :)
Still happens for me. :( I've opened PR against your dev branch with a fix that works for me, hope you can check it out
In case anyone was curious, setting dim = 0
removes any errors and allows auto-save to run as usual on my end (using the master branch, re-installed the plugin just now).
The error has gone away. But I got another error: (I use nvim 0.7)
Error executing vim.schedule lua callback: ...share/nvim/plugged/auto-save.nvim/lua/auto-save/init.lua:111: attempt to compare number with nil stack traceback: ...share/nvim/plugged/auto-save.nvim/lua/auto-save/init.lua:111: in function <...share/nvim/plugged/auto-save.nvim/lua/auto-save/init.lua:110>
I'm having the same issue as well.
@arturo-salinas and @kohane27 may I see your auto-save confs?
lua << EOF local autosave = require("auto-save")
autosave.setup( { enabled = true, execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"), events = {"InsertLeave", "TextChanged"}, conditions = { exists = true, filename_is_not = {}, filetype_is_not = {}, modifiable = true }, write_all_buffers = false, on_off_commands = true, clean_command_line_interval = 0, debounce_delay = 135 } ) EOF
autosave.setup({
enabled = false,
execution_message = "",
events = { "InsertLeave", "TextChanged" },
conditions = {
exists = true,
filename_is_not = { "packer_init.lua" },
filetype_is_not = {
"lua",
"javascript",
"typescript",
"javascriptreact",
"typescriptreact",
"tsx",
"jsx",
"svelte",
"vue",
},
modifiable = true,
},
write_all_buffers = false,
on_off_commands = false,
clean_command_line_interval = 0,
debounce_delay = 170,
})
My bad. I didn't realize that there's breaking changes in the config setup (#43). Once I just used autosave.setup({})
autosave works perfectly. Thank you again for creating and maintaining auto-save!
No problem @kohane27 :)
And for @arturo-salinas, please don't forget to check the default config. The execution_message
setting receives a table not a string.
yes! I do not have any problem now. Thank you!