-- return {
-- 	"github/copilot.vim",
-- 	config = function()
--         vim.g.copilot_no_tab_map = true
--
-- 		vim.api.nvim_set_keymap(
--             "i",
--             ",,",
--             'copilot#Accept("<CR>")',
--             { expr = true, silent = true }
--         )
--
-- 		vim.api.nvim_set_keymap(
--             "n",
--             "<leader>cs",
--             "<cmd>Copilot panel<CR>",
--             { noremap = true }
--         )
-- 	end,
-- }

return {
    'zbirenbaum/copilot.lua',
    cmd = "Copilot",
    event = "InsertEnter",
    config = function()
        require("copilot").setup({
            panel = {
                enabled = true,
                auto_refresh = false,
                keymap = {
                    jump_prev = "[[",
                    jump_next = "]]",
                    accept = "<CR>",
                    refresh = "gr",
                    open = "<M-CR>"
                },
                layout = {
                    position = "bottom", -- | top | left | right
                    ratio = 0.4
                },
            },
            suggestion = {
                enabled = true,
                auto_trigger = true,
                debounce = 75,
                keymap = {
                    accept = ",,",
                    accept_word = false,
                    accept_line = false,
                    next = "<C-n>",
                    prev = "<C-p>",
                    dismiss = "<C-]>",
                },
            },
            filetypes = {
            },
            copilot_node_command = 'node', -- Node.js version must be > 18.x
            server_opts_overrides = {},
        })
    end,
}
