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

Allow to position the float window above the current line #495

Open
pwntester opened this issue Nov 8, 2021 · 9 comments · May be fixed by #1701 or #1955
Open

Allow to position the float window above the current line #495

pwntester opened this issue Nov 8, 2021 · 9 comments · May be fixed by #1701 or #1955

Comments

@pwntester
Copy link

It would be nice to have an option that tells cmp where you prefer the float window to be positioned (eg: N, NE, NO, E, O, SE and SO). The main reason for it is that plugins such as copilot.nvim place the suggestions as virtual text so you get them behind the cmp float window.

cmp is already positioning the float window above the current line when the typing at the bottom of a window or when completing on the command line. It would be great to add an option to tell cmp where you prefer the window to be positioned.

Thanks!

@hrsh7th
Copy link
Owner

hrsh7th commented Nov 9, 2021

I think it's useful but hard to define the configuration design.

proposal

cmp.setup {
  appearance = {
    menu = {
      direction = 'above' -- auto or above or below
    }
  }
}

@lukamanitta
Copy link

I came here looking for just this, started using Github Copilot and found this annoying. This'd be a great feature to see!

@Thanatermesis
Copy link

Thanatermesis commented May 3, 2023

I want to define the direction to be "above" by default too, I like the proposal entry idea by @hrsh7th :

  appearance = {
    menu = {
      direction = 'above' -- auto or above or below
    }
  }

I would also suggest instead of these 3 options, to be able to define which is the default direction (this means, "auto" would have a preference to go below but we may have the preference to go above, this is in fact the ideal by using with Copilot)

So just like @lukamanitta I have the menu to be very annoying when using with Copilot because it overlaps all the time what you see in Copilot, and I don't want to disable CMP in order to use it 🤔

I don't know much the code but looks like the "decision" to go in one direction or the other is around this line: https://github.com/hrsh7th/nvim-cmp/blob/main/lua/cmp/view/custom_entries_view.lua#L178

@DanielPower
Copy link

I'm also interested in this feature because of Copilot. I'm using cmp for lsp completions, but virtual text do display copilot suggestions. As-is, cmp can cover copilot suggestions.

Is this something you'd consider accepting a pull request for?

@MannyFay
Copy link

This is not done yet, am I right?

llllvvuu added a commit to llllvvuu/nvim-cmp that referenced this issue Sep 12, 2023
llllvvuu added a commit to llllvvuu/nvim-cmp that referenced this issue Sep 12, 2023
llllvvuu added a commit to llllvvuu/nvim-cmp that referenced this issue Sep 12, 2023
Works best with vim.opt.scrolloff = 999

Fixes: hrsh7th#495
Suggested-by: Thanatermesis <[email protected]>
llllvvuu added a commit to llllvvuu/nvim-cmp that referenced this issue Sep 13, 2023
'above' works best with vim.opt.scrolloff = 999.

Fixes: hrsh7th#495
Helped-by: Thanatermesis <[email protected]>
@llllvvuu
Copy link

llllvvuu commented Sep 13, 2023

I made a PR if y'all are interested @pwntester @hrsh7th @lukamanitta @Thanatermesis @DanielPower @MannyFay

#1701

njhoffman pushed a commit to njhoffman/nvim-cmp that referenced this issue Nov 4, 2023
'above' works best with vim.opt.scrolloff = 999.

Fixes: hrsh7th#495
Helped-by: Thanatermesis <[email protected]>
@Thanatermesis
Copy link

Thank you, it works! :)

@hrsh7th include it in nvim-cmp?

@Shougo
Copy link

Shougo commented Jan 22, 2024

The author seems to be cautious about adding the feature.
Because he maintains the code.

fjchen7 pushed a commit to fjchen7/nvim-cmp that referenced this issue Feb 12, 2024
'above' works best with vim.opt.scrolloff = 999.

Fixes: hrsh7th#495
Helped-by: Thanatermesis <[email protected]>
fjchen7 pushed a commit to fjchen7/nvim-cmp that referenced this issue Feb 12, 2024
'above' works best with vim.opt.scrolloff = 999.

Fixes: hrsh7th#495
Helped-by: Thanatermesis <[email protected]>
weskoerber pushed a commit to weskoerber/nvim-cmp that referenced this issue Feb 13, 2024
'above' works best with vim.opt.scrolloff = 999.

Fixes: hrsh7th#495
Helped-by: Thanatermesis <[email protected]>
ckyrouac pushed a commit to ckyrouac/nvim-cmp that referenced this issue Feb 14, 2024
'above' works best with vim.opt.scrolloff = 999.

Fixes: hrsh7th#495
Helped-by: Thanatermesis <[email protected]>
@plundration
Copy link

It's really a shame that this hasn't been added in 3 YEARS. The default behaviour just makes using copilot a pain. I am considering just building the plugin from the pull request to be able to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
9 participants