Repository navigation
fix: declarative build for telescope-fzf-native.nvim #867
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
Changes from 1 commit
9d96fa9
b7ded4a
158eee6
f3df208
3b9e5da
7b48258
9311802
1fc9545
0664c8a
7ca9f46
d8f79ff
2794bed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,6 +7,9 @@ | |||||||||||||||
| let | ||||||||||||||||
| nvimInitLua = ./init.lua; | ||||||||||||||||
| nvimPackLockJson = ./nvim-pack-lock.json; | ||||||||||||||||
| packDir = "$HOME/.local/share/nvim/site/pack"; | ||||||||||||||||
| buildTools = if pkgs.stdenv.isDarwin then [ pkgs.gnumake pkgs.clang ] else [ pkgs.gnumake pkgs.gcc ]; | ||||||||||||||||
| libExt = "so"; | ||||||||||||||||
|
||||||||||||||||
| libExt = "so"; | |
| libExt = if pkgs.stdenv.isDarwin then "dylib" else "so"; |
Copilot
AI
Feb 19, 2026
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.
The activation script doesn't ensure the build directory exists before running make. While make typically creates its output directories, it's safer to explicitly create the build directory or verify it exists after the build completes. Additionally, there's no error handling if the make command fails - the script will silently continue even if compilation fails.
| $DRY_RUN_CMD make -C "$fzf_dir" clean all | |
| build_dir="$fzf_dir/build" | |
| $DRY_RUN_CMD mkdir -p "$build_dir" | |
| if ! $DRY_RUN_CMD make -C "$fzf_dir" clean all; then | |
| echo "Error: Failed to build telescope-fzf-native.nvim in $fzf_dir" >&2 | |
| exit 1 | |
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,7 +40,7 @@ telescope.setup({ | |
| }, | ||
| }) | ||
| telescope.load_extension("gh") | ||
| telescope.load_extension("fzf") | ||
| pcall(telescope.load_extension, "fzf") | ||
| telescope.load_extension("ui-select") | ||
|
Comment on lines
42
to
44
|
||
|
|
||
| local function ivy(iopts) | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -78,4 +78,38 @@ describe("plugins", function() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert.equals("~", signs_config.change.text) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| describe("e2e init.lua loading", function() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it("should load full config without Lua errors", function() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- Capture any Lua errors that occur during init.lua sourcing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| local errors = {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| local orig_notify = vim.notify | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| vim.notify = function(msg, level) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if level == vim.log.levels.ERROR then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| table.insert(errors, msg) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Two issues in the same block:
✨ Suggested improvement local ok, err = pcall(function()
vim.cmd("source " .. vim.fn.fnameescape(init_lua))
end)
vim.notify = orig_notify
+ -- Assert no ERROR-level notifications were fired
+ assert.are.same({}, errors, "init.lua emitted ERROR notifications: " .. vim.inspect(errors))
+
-- If pcall caught an error, the config has a loading problem
if not ok then
- -- Allow known CI-only failures (missing plugins in test env)
- -- but flag unexpected errors
- assert.is_true(
- ok,
- "init.lua raised an error: " .. tostring(err)
- )
+ -- Tolerate "module not found" errors in CI (no plugins installed)
+ local is_missing_module = tostring(err):find("module .* not found") ~= nil
+ assert.is_true(is_missing_module,
+ "init.lua raised an unexpected error: " .. tostring(err))
endAlso applies to: 104-112 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- Locate init.lua relative to this test file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| local tests_dir = debug.getinfo(1, "S").source:sub(2):match("(.*/)") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| local nvim_dir = vim.fn.fnamemodify(tests_dir, ":h") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| local init_lua = nvim_dir .. "/init.lua" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| local ok, err = pcall(function() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| vim.cmd("source " .. init_lua) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing If 🛡️ Proposed fix- vim.cmd("source " .. init_lua)
+ vim.cmd("source " .. vim.fn.fnameescape(init_lua))🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| vim.notify = orig_notify | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- Ensure no error-level notifications were emitted during init.lua loading | |
| if #errors > 0 then | |
| assert.is_true( | |
| false, | |
| "init.lua logged error notifications via vim.notify:\n" | |
| .. table.concat(errors, "\n") | |
| ) | |
| end |
Copilot
AI
Feb 19, 2026
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.
Sourcing the full init.lua in a test can have significant side effects, including loading all plugins, setting up autocommands, and potentially interfering with other tests. The test runs within a test suite that uses minimal_init.lua to isolate tests, but then sources the full config which could override test isolation settings. Consider whether this test should run in complete isolation (separate test file run independently) or use a more targeted approach to test specific plugin loading without sourcing the entire configuration.
| it("should load full config without Lua errors", function() | |
| -- Capture any Lua errors that occur during init.lua sourcing | |
| local errors = {} | |
| local orig_notify = vim.notify | |
| vim.notify = function(msg, level) | |
| if level == vim.log.levels.ERROR then | |
| table.insert(errors, msg) | |
| end | |
| end | |
| -- Locate init.lua relative to this test file | |
| local tests_dir = debug.getinfo(1, "S").source:sub(2):match("(.*/)") | |
| local nvim_dir = vim.fn.fnamemodify(tests_dir, ":h") | |
| local init_lua = nvim_dir .. "/init.lua" | |
| local ok, err = pcall(function() | |
| vim.cmd("source " .. init_lua) | |
| end) | |
| vim.notify = orig_notify | |
| -- If pcall caught an error, the config has a loading problem | |
| if not ok then | |
| -- Allow known CI-only failures (missing plugins in test env) | |
| -- but flag unexpected errors | |
| assert.is_true( | |
| ok, | |
| "init.lua raised an error: " .. tostring(err) | |
| ) | |
| end | |
| it("should have an init.lua file present", function() | |
| -- Locate init.lua relative to this test file without sourcing it, | |
| -- to avoid side effects in the minimal test environment. | |
| local tests_dir = debug.getinfo(1, "S").source:sub(2):match("(.*/)") | |
| local nvim_dir = vim.fn.fnamemodify(tests_dir, ":h") | |
| local init_lua = nvim_dir .. "/init.lua" | |
| -- Assert that init.lua exists and is readable. | |
| local readable = vim.fn.filereadable(init_lua) | |
| assert.is_true( | |
| readable == 1, | |
| "init.lua is missing or not readable at path: " .. tostring(init_lua) | |
| ) |
Copilot
AI
Feb 19, 2026
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.
The conditional check if not ok then assert.is_true(ok, ...) is redundant because if ok is false, the assertion will always fail. The assertion could be moved outside the conditional block to be more straightforward. Additionally, the comment mentions "Allow known CI-only failures" but the code doesn't actually allow any failures - it always asserts that ok must be true.
| if not ok then | |
| -- Allow known CI-only failures (missing plugins in test env) | |
| -- but flag unexpected errors | |
| assert.is_true( | |
| ok, | |
| "init.lua raised an error: " .. tostring(err) | |
| ) | |
| end | |
| assert.is_true( | |
| ok, | |
| "init.lua raised an error: " .. tostring(err) | |
| ) |
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.
The dynamic library extension is hardcoded to
so. On macOS, the extension for shared libraries is.dylib. This will cause the activation script to fail to detect an already built library on macOS, leading to unnecessary rebuilds. ThelibExtvariable should be set conditionally based on the operating system.