Skip to content

No completions inside brackets () in zig code #176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
NicoElbers opened this issue Oct 23, 2024 · 0 comments
Closed

No completions inside brackets () in zig code #176

NicoElbers opened this issue Oct 23, 2024 · 0 comments

Comments

@NicoElbers
Copy link
Contributor

NicoElbers commented Oct 23, 2024

I get no completions when inside brackets (). I checked with cmp and there I do get completions, with the same code and the same characters typed.

Interestingly, if I try to reproduce this behavior in lua, everything works fine. But in zig code I don't get completions.

tested languages
language completions inside ()
lua yes
zig no
typescript no
rust yes

Left is blink, right is cmp:
image

If I remove the () completions work as expected.

blink config
return {
    "saghen/blink.cmp",
    event = "InsertEnter",

    -- optional: provides snippets for the snippet source
    dependencies = { "rafamadriz/friendly-snippets" },

    version = "v0.*",

    opts = {
        keymap = {
            show = "<C-s>",
            hide = "<C-e>",

            show_documentation = "<C-s>",
            hide_documentation = "<C-s>",

            accept = "<C-space>",

            select_next = "<C-n>",
            select_prev = "<C-p>",

            snippet_forward = "<C-n>",
            snippet_backward = "<C-p>",
        },

        highlight = {
            -- sets the fallback highlight groups to nvim-cmp's highlight groups
            -- useful for when your theme doesn't support blink.cmp
            -- will be removed in a future release, assuming themes add support
            use_nvim_cmp_as_default = true,
        },

        -- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
        -- adjusts spacing to ensure icons are aligned
        nerd_font_variant = "mono",

        accept = {
            auto_brackets = {
                enabled = true,
            },
        },

        trigger = {
            signature_help = {
                enabled = true,
            },
            completion = {
                show_in_snippet = true,
            },
        },

        windows = {
            autocomplete = {
                border = utils.border,
                draw = "reversed",
            },
            documentation = {
                border = utils.border,
                auto_show = true,
                auto_show_delay_ms = 0,
            },
            signature_help = {
                border = utils.border,
            },
        },
    },
}
cmp config
return {
    {
        "hrsh7th/nvim-cmp",
        enabled = true,
        event = "InsertEnter",
        dependencies = {
            {
                "L3MON4D3/LuaSnip",
                dependencies = { "rafamadriz/friendly-snippets" },
                config = function()
                    require("luasnip.loaders.from_vscode").lazy_load()
                end,
            },
            "hrsh7th/cmp-nvim-lsp",
            "saadparwaiz1/cmp_luasnip",
            "L3MON4D3/LuaSnip",
            "hrsh7th/cmp-nvim-lua",
            "hrsh7th/cmp-nvim-lsp-signature-help",
            "hrsh7th/cmp-path",
            "hrsh7th/cmp-buffer",
        },
        config = function()
            local cmp = require("cmp")
            local luasnip = require("luasnip")

            cmp.setup({
                snippet = {
                    expand = function(args)
                        luasnip.lsp_expand(args.body)
                    end,
                },
                window = {
                    completion = cmp.config.window.bordered(),
                    documentation = cmp.config.window.bordered(),
                },
                mapping = cmp.mapping.preset.insert({
                    ["<C-d>"] = cmp.mapping.scroll_docs(-4),
                    ["<C-f>"] = cmp.mapping.scroll_docs(4),
                    ["<C-space>"] = cmp.mapping.confirm({
                        behavior = cmp.ConfirmBehavior.Replace,
                        select = true,
                    }),
                    ["<C-n>"] = cmp.mapping(function(fallback)
                        if cmp.visible() then
                            cmp.select_next_item()
                        elseif luasnip.expand_or_locally_jumpable() then
                            luasnip.expand_or_jump()
                        else
                            fallback()
                        end
                    end, { "i", "s" }),
                    ["<C-p>"] = cmp.mapping(function(fallback)
                        if cmp.visible() then
                            cmp.select_prev_item()
                        elseif luasnip.locally_jumpable(-1) then
                            luasnip.jump(-1)
                        else
                            fallback()
                        end
                    end, { "i", "s" }),
                }),
                sources = cmp.config.sources({
                    { name = "path" },
                    { name = "nvim_lsp" },
                    { name = "nvim_lsp_signature_help" },
                    { name = "luasnip" },
                    { name = "nvim_lua" },
                    { name = "buffer" },
                    { name = "calc" },
                }, {}),
            })
        end,
    },
}
@NicoElbers NicoElbers changed the title No completions inside brackets () No completions inside brackets () in zig code Oct 23, 2024
@Saghen Saghen closed this as completed in b2380a0 Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant