-
Notifications
You must be signed in to change notification settings - Fork 411
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
feat: config.view.entries.vertical_positioning = 'above'|'below'|'auto'
#1701
base: main
Are you sure you want to change the base?
Conversation
bbed640
to
4f3aa60
Compare
config.view.entries.vertical_positioning = 'above'|'below'|'auto'
Best feature ever, I'm running directly off of your branch now... its perfect. |
Thanks! I just fixed it yesterday to fix the docs preview as well ping @hrsh7th for review |
Can we even expect any reviews on this? I mean, we still on v0.0.1 with no releases for a long time and no recent activity |
@hrsh7th What's the deal on this? I'd love to have this merged... I constantly run into overlapping prompts and if this fixes it, I'd be super happy. |
also waiting for this |
I also cloned your repo, hope it gets merged soon. |
@hrsh7th can we please get this reviewed? |
I think it is useful feature. I heard his thoughts before. But he don't want to add new features now. He wants to include bug fix only. |
This is also a bugfix for a very annoying bug that I constantly run into where the completion window covers up the text if your screen isn't large enough. |
agree |
'above' works best with vim.opt.scrolloff = 999. Fixes: # 495 Helped-by: Thanatermesis <thanatermesis@gmail.com>
@hrsh7th are you still maintaining this repo or not? |
It is still maintaining. The responses are slow though. You can see other issues and PRs. |
I merged this with main from nvim/cmp so it has the latest changes and can be merged, PR is here: llllvvuu#1. |
merged with nvim-cmp main
Forks who are using copilot now can use copilot-cmp with my pr which add multi-line ghost-text and dynamic window flip capability, I has been using it for 2 month, hope there are few bugs |
The issue of document window position is a different matter. |
@Shougo My bad! |
local prefers_above = c.view.entries.vertical_positioning == 'above' | ||
local prefers_auto = c.view.entries.vertical_positioning == 'auto' | ||
local cant_fit_at_bottom = vim.o.lines - row - border_offset_row <= math.min(DEFAULT_HEIGHT, height) | ||
local cant_fit_at_top = row - border_offset_row <= math.min(DEFAULT_HEIGHT, height) | ||
local is_in_top_half = math.floor(vim.o.lines * 0.5) > row + border_offset_row | ||
local should_position_above = | ||
cant_fit_at_bottom or | ||
(prefers_above and not cant_fit_at_top) or | ||
(prefers_auto and is_in_top_half) | ||
if should_position_above then | ||
self.bottom_up = true | ||
height = math.min(height, row - 1) | ||
row = row - height - border_offset_row - 1 | ||
if row < 0 then | ||
height = height + row | ||
end | ||
else | ||
self.bottom_up = false | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be cool if this code some how took into account the experimental ghost text feature. Not sure if it can be done, but i would like to see auto checking if the ghost text is more than a number of lines that could maybe be configured as well. Could also just be set to 1 line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you mean #1955
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ye that about covers it :)
---@field name 'custom' | ||
---@field selection_order 'top_down'|'near_cursor' | ||
---@field vertical_positioning 'auto'|'above'|'below' | ||
---@field follow_cursor boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm somewhat unsure of what the selection order does, but i imagine it choose if the most relevant entry is shown at the top of the list or nearest the cursor. could be a good place to add a bottom up option as its only become useful now with this new feature for vertical positioning
I am also noticing that the floating window is sometimes covering my cursor when switching between different entries in the list. |
Also applies to
docs_view
otherwise the docs will cover the text when it is significantly taller than the completion menu.For Copilot, 'above' works best with
vim.opt.scrolloff = 999
.Fixes: #495
Helped-by: Thanatermesis thanatermesis@gmail.com