Comments (36)
@akinsho and done :)
from noice.nvim.
I have checked the latest version.
nvim-cmp
seems required...
I want to use ddc.vim with noice.nvim.
from noice.nvim.
Thank you! It works.
from noice.nvim.
from noice.nvim.
So the way the popupmenu works is probably not as you think :)
We implement ext_popupmenu
and get the list of items we should show in a popup together with information if an option is selected.
Right now, for this I use some of the internal views from cmp
, but cmp
isn't actually doing any completion for this.
cmp-cmdline
isn't involved at all with rendering the popupmenu in Noice.
I was just lazy and haven't yet implemetented a simple popup view.
You're right about the cmp popup position durting cmdlline mode, but I fix (hack) that in
noice.nvim/lua/noice/ui/popupmenu.lua
Line 16 in dee23c2
from noice.nvim.
This can probably also be closed now?
from noice.nvim.
I'm still seeing the cmp-cmdline window located just above the old cmdline position, e.g.
from noice.nvim.
ok, so that is cmp-cmdline
anyway. Just for testing, can you disable the cmp-cmdline
source and see if it works then?
from noice.nvim.
Yeah, I think the cmp-cmdline issue here is separate since a solution to that will probably be some sort of mixture of a change to cmp-cmdline to allow changing the position of the window through some sort of API and maybe that being incorporated here, so maybe best to move this issue there at least to raise the request for such an API.
Regarding the other issue of positioning, that still recurs without cmp cmdline enabled seems to be a different window with other sources (e.g. my spell and rg source) where the cursor would otherwise be
from noice.nvim.
Hi, ddc-cmdline
has the same problem.
It seems screenpos()
result is wrong.
I think it is from fake cursor.
https://github.com/folke/noice.nvim#-known-issues
from noice.nvim.
This should be fixed now in the latest version. Things I changed:
- I made a proper fix to the existing cmp api functions to get the position, screen position and line of the cmdline when Noice is active. Will see to make a PR to cmp that exposes an API to set the cmdline position from other plugins, but this works for now.
- I implemented a proper cmp source noice_popupmenu that is automatically added when no other cmdline sources have been configured.
With these changes, things should work as expected:
- cmp popupmenu should always be positioned correctly
- pmenu items (the ones I get from
ui_attach/ext_popupmenu
will be used for completion if no other cmp cmdline sources were configured - if you're using
cmp-cmdline
, then that will work as it did before
Let me know if you encounter any more issues!
from noice.nvim.
@Shougo yes, you're correct.
I made some changes so that cmp
can properly work with fake cursors.
Once we have a proper Neovim api to work with the cursor, it should work for other usages without these hacks
from noice.nvim.
As I mentioned in #1 this issue also seems to be resolved in the case of cmp-cmdline, feel free to close this out @folke unless you want to keep it open to track against other plugins like ddc etc. or to convert it to track against a cursor api in nvim 🤷🏿
from noice.nvim.
Thanks. I will try it later.
from noice.nvim.
Closing this issue since the fake cursor issue is tracked in the tracking issue.
from noice.nvim.
Ya, it looks like popupmenu.lua has a hard dependency on cmp now. This seems wrong @folke ?
from noice.nvim.
@Shougo @miversen33 I've removed the hard dependency on cmp. In your config you can set popupmenu.enabled = false
.
I'll also add a native implementation for regular cmdline completions.
from noice.nvim.
Thank you.
from noice.nvim.
Well, nvim-cmp
is loaded yet.
from noice.nvim.
My config
require'noice'.setup {
cmdline = {
enabled = true,
menu = 'popup',
icons = {
['/'] = { icon = '/', hl_group = 'DiagnosticWarn' },
['?'] = { icon = '?', hl_group = 'DiagnosticWarn' },
[':'] = { icon = ':', hl_group = 'DiagnosticInfo', firstc = false },
},
},
popupmenu = {
enabled = false,
},
}
from noice.nvim.
@Shougo my bad. I use a lazy-require and while I had a pcall to check if cmp exists, it never failed due to the lazy loading. Should be fixed now.
from noice.nvim.
In order to fix the position of the menu for ddc.vim
, you'll have to somehow tell it the correct position of the cmdline cursor.
You can retrieve it with
---@type {win: window, buf: buffer, win_cursor:number[], screen_cursor:number[]}?
require("noice.util.cursor").get_cmdline_cursor()
Positions are (1,0) indexed
from noice.nvim.
I want to check noice.nvim
is installed in vim script...
I get it.
from noice.nvim.
I have added noice.nvim
support in pum.vim
.
from noice.nvim.
@Shougo that's awesome!
from noice.nvim.
@folke what do you think about allowing the user to position the completion menu themselves, specifically what I'm thinking is that rather than have it overlapping with the bottom of the float it might be nicer to have it appear just below the window.
I'm going for something that looks a bit more like
(obvs that's a GUI I just meant the positioning)
But I think rather than you specifically hard coding any values that what you pass to the positioning function be configurable defaulting to how you currently have it but with the user having an option to move it.
Just an idea as always, no pressure if it will make things complex
from noice.nvim.
@akinsho great idea!
I'm almost finished with a nui based popupmenu, which will be native to Noice.
I'll make sure you'll be able to configure it like that
from noice.nvim.
I have added offset_row support.
from noice.nvim.
@Shougo great :)
I forgot to mention that I fixed some issues with the cmdline position. There were some off by ones (sometimes) that are now fixed.
from noice.nvim.
@folke that looks great, very noice 😆.
I'm noticing that using <Tab>
in the native popup menu doesn't cycle the options correctly, though. It seems to get stuck after moving to the second item and doesn't continue cycling through them.
Also, I'm wondering if customization regarding positioning would work for cmp as well since I prefer that it autocompletes the cmdline completions versus manually triggering the completion
from noice.nvim.
That;s really odd. Do you maybe have another completion plugin running at the same time?
I'll look into the cmp positioning!
from noice.nvim.
@folke I have mappings for cmp to use tab
but I've removed those and still see the issue, I cross-checked that I'd removed all mappings, and it still doesn't cycle the same way the native wildmenu pum does
from noice.nvim.
@Shougo hi! I just refactored a lot of the code and also the part for the cmdline cursors.
The existing function no longer exists, but you now have require("noice").api.get_cmdline_position()
instead.
---@class CmdlinePosition
---@field win number Window containing the cmdline
---@field buf number Buffer containing the cmdline
---@field bufpos {row:number, col:number} (1-0)-indexed position of the cmdline in the buffer
---@field screenpos {row:number, col:number} (1-0)-indexed screen position of the cmdline
This no longer returns the cursor position, but the position where the cmdline starts.
You can then use vim.fn.getcmdpos
to get the cursor if needed.
The reason I changed it is because working with the cursor position itself was difficult in situations where completion ran before the cursor was updated. Usingt the actual position of the cmdline makes things much easier.
from noice.nvim.
Oh, thanks. I will fix it later.
from noice.nvim.
Fixed.
from noice.nvim.
Is it possible to have this UI running as I'm typing like cmp-cmdline?
from noice.nvim.
Related Issues (20)
- bug: `E565: Not allowed to change text or change window` error when using with clever-f.vim HOT 3
- bug: Cursor disappears after loading a session HOT 2
- bug: mini.jump `t` doesn't work if the following key comes too late when using with noice.nvim HOT 3
- Configuration Issue: Not able to suppress 'No information available' notification HOT 1
- bug: Error `Invalid window id: ...` when I close the LSP hover window with the new `fclose!` command. HOT 2
- bug: no notification handler registered for "Dir" / "GUI" HOT 5
- bug: inserting an automatic <CR> after easymotion HOT 1
- bug: `cmdline.view` overwrites `cmdline.format.search_down.view` ~50% of the time. HOT 5
- bug: using classic mode for cmdline still have completion window floating middle of the screen HOT 2
- feature: priority of lsp progress HOT 1
- bug: Truncated prompts when using Telescope actions HOT 1
- bug: hide scroll messages HOT 1
- bug: vim.fn.input() now goes to cmdline_input, and breaks HOT 2
- bug: noice.nvim is causing pyright lsp hover docs to show up and I want to disable it
- bug: lag when quitting nvim HOT 9
- bug: Borderless cmdline popups HOT 4
- bug: When run within Zellij, when multiples message popups are displayed, cursor "glitches" into popup HOT 1
- bug: Getting E445: Other window contains changes while closing diffview HOT 2
- Documentation for modifying appearance of cmdline_popup dropdown
- bug: Invalid 'end_col': out of range HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from noice.nvim.