Open galou opened 4 days ago
Can you please share a sample project where I can reproduce this behavior?
I had the same issue with my Neovim. I don't know if it will be helpful, but I've attached a minimal configuration file.
NVIM v0.10.2 Build type: RelWithDebInfo LuaJIT 2.1.1731601260
vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
vim.g.mapleader = " " -- leaderkey is <space>
require("lazy.minit").repro({
spec = {
{
"Chaitanyabsprip/fastaction.nvim",
opts = {},
},
{
"neovim/nvim-lspconfig",
config = function()
-- Some Language Server Settings
-- As an example, luals
require("lspconfig").lua_ls.setup({
cmd = { "<the path of lua-language-server>" }
})
local opts = { noremap = true, silent = true }
local fastaction = require("fastaction")
vim.keymap.set("n", "<leader>fa", fastaction.code_action, opts)
vim.keymap.set("v", "<leader>fa", fastaction.range_code_action, opts)
end,
},
},
})
I was expecting a minimal project where you had this discrepancy between fastaction and vim.lsp.buf.code_actions. I tried reproducing this case in my other repositories, haven't found anything yet.
As a point of clarification, are you getting >20 code actions?
Sorry, this example is only minimal if you already have clangd
installed but I didn't manage to have it work with lua_ls
.
init.lua
:
vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
require("lazy.minit").repro({
spec = {
{
"Chaitanyabsprip/fastaction.nvim",
opts = {},
},
{
"neovim/nvim-lspconfig",
config = function()
-- Some Language Server Settings
-- As an example, luals
require("lspconfig").clangd.setup({
--cmd = {vim.fn.expand("~/.local/share/nvim/mason/bin/clangd") }
})
local opts = { noremap = true, silent = true }
local fastaction = require("fastaction")
vim.keymap.set("n", "<leader>fa", fastaction.code_action, opts)
vim.keymap.set("v", "<leader>fa", fastaction.range_code_action, opts)
end,
},
},
})
main.cpp
:
#include <iostream>
int main(int, char**)
{
}
Install clangd
.
vim -u init.lua main.cpp
, the code action on l.1 can be executed with :lua vim.lsp.buf.code_action()
but Fastaction doesn't propose anything.
Only one code action available.
fastaction doesn't list code actions that
vim.lsp.buf.code_action
proposes.Config, in lazy:
{'Chaitanyabsprip/fastaction.nvim'},
inlua/bindings.lua
:I get
no code actions available
.NVIM v0.11.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.1703358377