Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e79bad6
feat: vendor plenary
clason Mar 15, 2026
caf98b5
feat(plenary): adapt to deprecations
clason Mar 15, 2026
fb85b69
feat(plenary): remove tbl
clason Mar 15, 2026
4abcabc
feat(plenary): replace functional
clason Mar 15, 2026
4dbe7f6
feat(plenary): prefer builtin string functions
clason Mar 15, 2026
5510381
feat(plenary): remove unused async
clason Mar 15, 2026
bff9b8d
feat(plenary): remove nvim_meta
clason Mar 15, 2026
edc5a72
feat(plenary): remove unused path functions
clason Mar 15, 2026
3112a8b
feat(plenary): remove errors
clason Mar 15, 2026
d66e8e3
feat(plenary): remove functional
clason Mar 15, 2026
7c8b234
feat(plenary): refactor vararg
clason Mar 15, 2026
b0af55c
feat(plenary): remove unused class functions
clason Mar 15, 2026
fc1515b
feat(plenary): simplify log
clason Mar 15, 2026
0b03d72
feat(plenary): simplify test (headless only)
clason Mar 15, 2026
25390ca
feat(plenary): simplify popup
clason Mar 15, 2026
7a14f7d
feat(plenary): prefer local api
clason Mar 15, 2026
189afec
feat(plenary): simplify window
clason Mar 15, 2026
2a86566
feat(plenary): adapt workflows
clason Mar 15, 2026
5b9b6f6
feat(plenary): remove window
clason Mar 15, 2026
ed52c43
feat(plenary): remove test_harness/busted
clason Mar 17, 2026
dff1447
feat(test): remove path
clason Mar 26, 2026
f100a76
feat(plenary): move vararg inside async module
clason Apr 10, 2026
d464057
tests: move test suite to root
clason Apr 11, 2026
a475e25
feat(plenary)!: remove scandir and directory previewer
clason Apr 19, 2026
e4dd966
feat(plenary): remove unused async.tests
clason Apr 19, 2026
7892fe3
feat(plenary): rename Deque to Dequeue, simplify
clason Apr 19, 2026
89ad53d
feat(plenary): simplify path
clason Apr 19, 2026
3cd63d9
feat(utils): use vim.filetype.match
clason Apr 19, 2026
1d444fd
chore: sort imports, consistent naming
clason Apr 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ jobs:
${{ matrix.install-rg }}
rg --version
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ../plenary.nvim
git clone --depth 1 https://github.com/nvim-tree/nvim-web-devicons ../nvim-web-devicons
- name: Run tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ jobs:
export PATH="${PWD}/_neovim/bin:${PATH}"
export VIM="${PWD}/_neovim/share/nvim/runtime"
nvim --version
make docgen
make docs
git diff --exit-code
2 changes: 0 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ jobs:
A highly extendable fuzzy finder over lists.
Built on the latest awesome features from neovim core.
Telescope is centered around modularity, allowing for easy customization.
dependencies: |
plenary.nvim
copy_directories: |
doc
ftplugin
Expand Down
31 changes: 25 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
.PHONY: test lint docgen
DEPDIR ?= .deps
PLENTEST := $(DEPDIR)/plentest.nvim
DOCGEN := $(DEPDIR)/docgen.nvim
DOCGEN_TAG := v1.0.1

.PHONY: plentest
plentest: $(PLENTEST)

$(PLENTEST):
git clone --filter=blob:none https://github.com/nvim-treesitter/plentest.nvim $(PLENTEST)

test:
nvim --headless --noplugin -u scripts/minimal_init.vim -c "PlenaryBustedDirectory lua/tests/automated/ { minimal_init = './scripts/minimal_init.vim' }"
.PHONY: test lint docgen
test: $(PLENTEST)
PLENTEST=$(PLENTEST) nvim --headless --clean -u scripts/minimal_init.lua \
-c "lua require('plentest').test_directory('tests/automated', { minimal_init = './scripts/minimal_init.lua' })"

lint:
luacheck lua/telescope

.deps/docgen.nvim:
git clone --depth 1 --branch v1.0.1 https://github.com/jamestrew/docgen.nvim $@
.PHONY: docgen
docgen: $(DOCGEN)

$(DOCGEN):
git clone --filter=blob:none --branch $(DOCGEN_TAG) https://github.com/jamestrew/docgen.nvim $(DOCGEN)

docgen: .deps/docgen.nvim
.PHONY: docs
docs: $(DOCGEN)
nvim -l scripts/gendocs.lua

.PHONY: clean
clean:
rm -rf $(DEPDIR)
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ This section should guide you to run your first builtin pickers.
### Requirements

* [Neovim >=v0.11.7](https://github.com/neovim/neovim/releases/tag/v0.11.6) built **with LuaJIT** (check `:version`).
* [nvim-lua/plenary.nvim](https://github.com/nvim-lua/plenary.nvim).

>[!IMPORTANT]
> Only the **latest version** ([`stable`](https://github.com/neovim/neovim/releases/tag/stable)) and the **latest commit of `HEAD`** ([`nightly`](https://github.com/neovim/neovim/releases/tag/nightly)) are tested and supported; before opening an issue, download the latest available release and confirm that the problem persists.
Expand Down Expand Up @@ -74,9 +73,8 @@ e.g. using [lazy.nvim](https://github.com/folke/lazy.nvim)
```lua
{
'nvim-telescope/telescope.nvim', version = '*',
-- optional but recommended
dependencies = {
'nvim-lua/plenary.nvim',
-- optional but recommended
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' },
}
}
Expand Down
5 changes: 2 additions & 3 deletions doc/telescope.txt
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ telescope.setup({opts}) *telescope.setup()*
end,
-- 2) Truncate lines to preview window for too large files
filesize_hook = function(filepath, bufnr, opts)
local path = require("plenary.path"):new(filepath)
local path = require("neoplen.path"):new(filepath)
-- opts exposes winid
local height = vim.api.nvim_win_get_height(opts.winid)
local lines = vim.split(path:head(height), "[\r]?\n")
Expand Down Expand Up @@ -2454,8 +2454,7 @@ do the following: >lua
Another interesting thing to do is that these actions now have functions you
can call. These functions include `:replace(f)`, `:replace_if(f, c)`,
`replace_map(tbl)` and `enhance(tbl)`. More information on these functions can
be found in the `developers.md` and `lua/tests/automated/action_spec.lua`
file.
be found in the `developers.md` and `tests/automated/action_spec.lua` file.

*telescope.actions.move_selection_next()*
actions.move_selection_next({prompt_bufnr})
Expand Down
14 changes: 7 additions & 7 deletions doc/telescope_changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,26 +98,26 @@ telescope.path module soon.
Guide to switch over to plenary.path
- separator
before: require("telescope.path").separator
now: require("plenary.path").path.sep
now: require("neoplen.path").pathsep
- home
before: require("telescope.path").home
now: require("plenary.path").path.home
now: require("neoplen.path").path.home
- make_relative
before: require("telescope.path").make_relative(filepath, cwd)
now: require("plenary.path"):new(filepath):make_relative(cwd)
now: require("neoplen.path"):new(filepath):make_relative(cwd)
- shorten
before: require("telescope.path").shorten(filepath)
now: require("plenary.path"):new(filepath):shorten()
now: require("neoplen.path"):new(filepath):shorten()
with optional len, default is 1
- normalize
before: require("telescope.path").normalize(filepath, cwd)
now: require("plenary.path"):new(filepath):normalize(cwd)
now: require("neoplen.path"):new(filepath):normalize(cwd)
- read_file
before: require("telescope.path").read_file(filepath)
now: require("plenary.path"):new(filepath):read()
now: require("neoplen.path"):new(filepath):read()
- read_file_async
before: require("telescope.path").read_file_async(filepath, callback)
now: require("plenary.path"):new(filepath):read(callback)
now: require("neoplen.path"):new(filepath):read(callback)

*telescope.changelog-1406*

Expand Down
135 changes: 135 additions & 0 deletions lua/neoplen/async/async.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
local co = coroutine

local traceback_error = function(s, level)
local traceback = debug.traceback()
traceback = traceback .. "\n" .. s
error(traceback, (level or 1) + 1)
end

local function select_only(n)
return function(...)
local x = select(n, ...)
return x
end
end

local first = select_only(1)
local second = select_only(2)
local third = select_only(3)

local M = {}

local function is_callable(fn)
return type(fn) == "function" or (type(fn) == "table" and type(getmetatable(fn)["__call"]) == "function")
end

---because we can't store varargs
local function callback_or_next(step, thread, callback, ...)
local stat = first(...)

if not stat then
error(string.format("The coroutine failed with this message: %s", second(...)))
end

if co.status(thread) == "dead" then
if callback == nil then
return
end
callback(select(2, ...))
else
local returned_function = second(...)
local nargs = third(...)

assert(is_callable(returned_function), "type error :: expected func")
returned_function(require("neoplen.async.vararg").rotate(nargs, step, select(4, ...)))
end
end

---Executes a future with a callback when it is done
---@param async_function Future: the future to execute
---@param callback function: the callback to call when done
local execute = function(async_function, callback, ...)
assert(is_callable(async_function), "type error :: expected func")

local thread = co.create(async_function)

local step
step = function(...)
callback_or_next(step, thread, callback, co.resume(thread, ...))
end

step(...)
end

local add_leaf_function
do
---A table to store all leaf async functions
_PlenaryLeafTable = setmetatable({}, {
__mode = "k",
})

add_leaf_function = function(async_func, argc)
assert(_PlenaryLeafTable[async_func] == nil, "Async function should not already be in the table")
_PlenaryLeafTable[async_func] = argc
end

function M.is_leaf_function(async_func)
return _PlenaryLeafTable[async_func] ~= nil
end

function M.get_leaf_function_argc(async_func)
return _PlenaryLeafTable[async_func]
end
end

---Creates an async function with a callback style function.
---@param func function: A callback style function to be converted. The last argument must be the callback.
---@param argc number: The number of arguments of func. Must be included.
---@return function: Returns an async function
M.wrap = function(func, argc)
if not is_callable(func) then
traceback_error("type error :: expected func, got " .. type(func))
end

if type(argc) ~= "number" then
traceback_error("type error :: expected number, got " .. type(argc))
end

local function leaf(...)
local nargs = select("#", ...)

if nargs == argc then
return func(...)
else
return co.yield(func, argc, ...)
end
end

add_leaf_function(leaf, argc)

return leaf
end

---Use this to either run a future concurrently and then do something else
---or use it to run a future with a callback in a non async context
---@param async_function function
---@param callback function
M.run = function(async_function, callback)
if M.is_leaf_function(async_function) then
async_function(callback)
else
execute(async_function, callback)
end
end

---Use this to create a function which executes in an async context but
---called from a non-async context. Inherently this cannot return anything
---since it is non-blocking
---@param func function
M.void = function(func)
return function(...)
execute(func, nil, ...)
end
end

return M
Loading
Loading