Code Monkey home page Code Monkey logo

Comments (3)

anthony-S93 avatar anthony-S93 commented on July 30, 2024 1

It turns out that gopls pre-selects an item each time an auto-completion list is generated. And gopls's pre-selection does not respect the ordering of the list generated by the completion source. As a workaround, you can prevent this behavior by setting preselect to cmp.PreselectMode.None. E.g:

local cmp = require("cmp")
cmp.setup({
    preselect = cmp.PreselectMode.None
})

from nvim-cmp.

morhaham avatar morhaham commented on July 30, 2024

It turns out that gopls pre-selects an item each time an auto-completion list is generated. And gopls's pre-selection does not respect the ordering of the list generated by the completion source. This behavior can be prevented by setting preselect to cmp.PreselectMode.None. E.g:

local cmp = require("cmp")
cmp.setup({
    preselect = cmp.PreselectMode.None
})

With this setting there is no preselect at all. What if I want the first one to be selected always?

from nvim-cmp.

anthony-S93 avatar anthony-S93 commented on July 30, 2024

The problem is that nvim-cmp reorders the items of the completion list dynamically. What this means is that the order of items in the completion list depends on the current state of the source file. For example, if the name of a function has already appeared in the file at least once, then that item will be placed higher up the list. I've already described the issue in detail here: golang/go#61533 (comment)

Unfortunatly, nvim-cmp's dynamic reordering does not take LSP preselection into account. By right, nvim-cmp should place the item that is preselected by the LSP at the top of the list. That is why I resorted to turn off the preselect feature altogether.

I can reopen this issue if you want. But at the moment, I'm not interested in any further investigation into this issue.

from nvim-cmp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.