rachartier / tiny-code-action.nvim

A Neovim plugin that provides a simple way to run and visualize code actions with Telescope.
MIT License
154 stars 2 forks source link

Error when trying to use any action from "gopls" #11

Closed balpert89 closed 2 months ago

balpert89 commented 2 months ago

Screenshot: Bildschirmfoto vom 2024-08-01 23-32-39

The error occurs regardless of the option I choose.

Error Stack:

E5108: Error executing lua: vim/shared.lua:0: s: expected string, got function
stack traceback:
    [C]: in function 'error'
    vim/shared.lua: in function 'validate'
    vim/shared.lua: in function 'gsplit'
    vim/shared.lua: in function 'split'
    ...e/nvim/lazy/telescope.nvim/lua/telescope/actions/set.lua:124: in function 'run_replace_or_original'
    ...re/nvim/lazy/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'run_replace_or_original'
    ...re/nvim/lazy/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'key_func'
    ...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:253: in function <...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:252>

Used software:

Configuration:

return {
    {
        "rachartier/tiny-code-action.nvim",
        dependencies = {
            { "nvim-lua/plenary.nvim" },
            { "nvim-telescope/telescope.nvim" },
        },
        event = "LspAttach",
        opts = {},
    },
}
rachartier commented 2 months ago

Thanks, I will look at it.

rachartier commented 2 months ago

I cannot reproduce it.

image

===>

image

Maybe it is related to your Telescope config ?

balpert89 commented 2 months ago

I tried with this line here https://github.com/ironcore-dev/ironcore-net/blob/main/apinetlet/controllers/loadbalancer_controller.go#L64

I will also set up a test project to see if this has something to do with the specific codebase.

In the meantime, this is my telescope config:

local actions = require("telescope.actions")

return {
    {
        "nvim-telescope/telescope.nvim",
        branch = "0.1.x",
        dependencies = {
            "nvim-lua/plenary.nvim",
            {
                "nvim-telescope/telescope-fzf-native.nvim",
                build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build",
                cond = vim.fn.executable("cmake") == 1,
            },
        },
        opts = {
            defaults = {
                mappings = {
                    i = {
                        ["<C-K>"] = "move_selection_previous",
                        ["<C-J>"] = "move_selection_next",
                        ["<C-Q>"] = actions.smart_send_to_qflist + actions.open_qflist,
                        ["<C-X>"] = "delete_buffer",
                        ["<Enter>"] = "file_tab",
                    },
                    n = {
                        ["<C-Q>"] = actions.smart_send_to_qflist + actions.open_qflist,
                        ["<Enter>"] = "file_vsplit",
                    },
                },
                file_ignore_patterns = {
                    "node_modules",
                    "yarn.lock",
                    ".git",
                    ".sl",
                    "_build",
                    ".next",
                },
                hidden = true,
                path_display = {
                    "filename_first",
                },
            },
            extensions = {
                advanced_git_search = {
                    browse_command = "GBrowse {commit_hash}",
                    diff_plugin = "fugitive",
                    git_flags = {},
                    git_diff_flags = {},
                    show_builtin_git_pickers = false,
                    entry_default_author_or_date = "author", -- one of "author" or "date"
                    keymaps = {
                        -- following keymaps can be overridden
                        toggle_date_author = "<C-w>",
                        open_commit_in_browser = "<C-o>",
                        copy_commit_hash = "<C-y>",
                        show_entire_commit = "<C-e>",
                    },
                },
            },
        },
        config = function(_, opts)
            require("telescope").setup(opts)

            -- Enable telescope fzf native, if installed
            pcall(require("telescope").load_extension, "fzf")
            -- Enable telescope advanced git search, if installed
            pcall(require("telescope").load_extension, "advanced_git_search")
        end,
    },
}
rachartier commented 2 months ago

Okay, with exactly the same Telescope config, I get the same error as you: image

rachartier commented 2 months ago

It is now fixed. I've set to select the code action directly inside the plugin, so now you should not have the issue anymore !