this keybinding applies the code action, but does not write to file. I want to write changes to file as soon as I've applied the code action.
How can I use the documentation at https://neovim.io/doc/ to find the correct function? I've tried looking for a write() function but I could not find anything I can call from lua.
You can call commands and vim functions from lua. To write the current buffer you can: vim.cmd.write(). Vim functions can be called with vim.fn.
It is completely fine to use vim functiona and not just pure lua, afaik some vim functions are not ever gonna get a lua alternative cause there is no need.
Thanks for the function signature, but how do I find the documentation for it? Searching for vim.cmd.write() on the website does not return anything. Maybe it takes in optional arguments or returns some sort of error.
vim.cmd.<command> calls a command. So vim.cmd.write is effectively the same as :write, the arguments passed to the function are the same that the command would take. Check :h vim.cmd() and for a specific command, e.g. write, you can check :h :write.