nvim-lua / neovim-ui Goto Github PK
View Code? Open in Web Editor NEWVaporware -- nothing to see here
License: Other
Vaporware -- nothing to see here
License: Other
In both nvim-dap and nvim-jdtls I've build some picker methods:
function M.pick_one_async(items, prompt, label_fn, cb)
function M.pick_one(items, prompt, label_fn)
function M.pick_many(items, prompt, label_f)
The items
here is an arbitrary list of arbitrary items and label_fn
is used to render out an item. So it receives an item and must return a string.
In theory items
could also be a function that follows the iterator protocol, to support lazy data generation use-cases as well.
The implementation must then take care to call the callback or return the selected item. (The whole object from the options, not an index or so)
They've a inputlist
based default implementation and there are some recipes how to replace them with fancier implementations. For example to use telescope instead.
I think it would be cool if vim.ui
would contain these so that this pattern becomes more established and we have a more consistent UI experience across plugins.
I'm pretty happy with the API so far as it is both flexible enough and also simple to use. I've seen other picker APIs (e.g. in vscode), where are always extra mapping steps necessary - you need to map your structures to a {label:, value:}
and then based on that figure out which of your items the user really selected.
I had written a bunch of the stuff for popup.nvim and plenary and used vim.fn
when I could/should be using vim.api
. Just as a heads up
@jbyuki did this awhile ago in popup.nvim but I forgot to merge -- since we're not really doing anything in popup.nvim at the moment, you may just want to implement that here.
It came up on IRC that we should have a common interface for widgets. This is mostly a placeholder for discussion.
-[ ] widget.close() -> Should we also enable a delayed invocation of this as a widget method like I did in notification.lua?
-[ ] widget.id() -> @smolck do we need this for vim.ui.layout?
I don't know if this is currently possible (atleast i don't see a way in plenary.border, etc) but it would be cool if we can change border title on the fly.
What i mean is this:
I made add something for the time being in plenary or popup that makes this possible, it would be just cool if this will end up in the ui module as well so we can just easily update :)
Thanks for all your work :D
The source for neovim-ui/popup and popup.nvim/plenary.nvim appears to be mostly the same aside from use of vim.fn.* in popup.nvim and vim.api.* in neovim-ui.
If this is correct, is it safe to use neovim-ui for popups in a plugin?
Maybe this is not the right place for this, but in the neovide discord there has been some talk about wanting a way to specify line sizes per line and to embed images.
Currently support for such things is done on a gui by gui basis rather than having a cohesive standard. Seems to me that such a thing should be specified by neovim (or some defacto standard format) and then implemented by each neovim gui.
Is this something that neovim-ui might support and or drive?
This is an issue to post pictures of WIP elements from nvim-ui. Please don't comment here, but open individual issues for feedback.
Right now, we have separate methods for floating win and border win, it would be nice to have instead a global vim.ui.use_borders type option (which maybe could be overridden?) that would wrap a given UI in a border (not sure what the implementation might be like for other options).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.