Skip to content
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

Autocompletion overwrites text (rust-analyzer) #2110

Open
2 tasks done
axelkar opened this issue Dec 10, 2024 · 0 comments
Open
2 tasks done

Autocompletion overwrites text (rust-analyzer) #2110

axelkar opened this issue Dec 10, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@axelkar
Copy link

axelkar commented Dec 10, 2024

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Announcement

Minimal reproducible full config

-- I have rustaceanvim in runtimepath; it doesn't need setup

local cmp = require("cmp")
cmp.setup({
    mapping = {
        ["<CR>"] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
        ["<S-Tab>"] = cmp.mapping(function(fallback)
            local luasnip = require("luasnip")
            if cmp.visible() then
                cmp.select_prev_item()
            elseif luasnip.jumpable(-1) then
                luasnip.jump(-1)
            else
                fallback()
            end
        end, { "i", "s" }),
        ["<Tab>"] = cmp.mapping(function(fallback)
            local luasnip = require("luasnip")
            if cmp.visible() then
                cmp.select_next_item()
            elseif luasnip.expandable() then
                luasnip.expand()
            elseif luasnip.expand_or_jumpable() then
                luasnip.expand_or_jump()
            -- elseif check_backspace() then
            --   fallback()
            else
                fallback()
            end
        end, { "i", "s" }),
    },
    snippet = {
        expand = function(args)
            require("luasnip").lsp_expand(args.body)
        end,
    },
    sources = { { name = "nvim_lsp" } },
})

require("luasnip").config.setup({})

Note: I did reproduce this with this config but didn't update the gif

Description

  • VSCodium doesn't reproduce this
  • Completions which don't require import (e.g. an identifier in the same scope) don't overwrite the line
  • When I import DoubleEndedSearcher, type Doub and tab (it's not the first option) to DoubleEndedIterator (in the prelude), it overwrites too

Steps to reproduce

  1. Install Rustaceanvim, luasnip, cmp-nvim-lsp and nvim-cmp into your runtimepath
  2. Start a blank Rust project and do as seen in the GIF below

Expected behavior

Should not overwrite the text

Actual behavior

output

Additional context

I'm using 99290b3ec1322070bcfb9e846450a46f6efa50f0 and ed31156

@axelkar axelkar added the bug Something isn't working label Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant