mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-04-15 00:58:37 +00:00
Compare commits
8 commits
fc6426a496
...
a2af4bed4d
Author | SHA1 | Date | |
---|---|---|---|
a2af4bed4d | |||
![]() |
ed31499ad6 | ||
![]() |
a6f8df6785 | ||
![]() |
b1212b77ce | ||
![]() |
51d76dd515 | ||
![]() |
eedb3dd8c4 | ||
![]() |
da57f955df | ||
f477fcb56f |
10 changed files with 165 additions and 11 deletions
|
@ -199,6 +199,7 @@
|
|||
Inspiration from `vim.languages.clang.dap` implementation.
|
||||
- Add [leetcode.nvim] plugin under `vim.utility.leetcode-nvim`.
|
||||
- Add [codecompanion.nvim] plugin under `vim.assistant.codecompanion-nvim`.
|
||||
- Fix [codecompanion-nvim] plugin: nvim-cmp error and setupOpts defaults.
|
||||
|
||||
[nezia1](https://github.com/nezia1):
|
||||
|
||||
|
@ -288,6 +289,7 @@
|
|||
[rice-cracker-dev](https://github.com/rice-cracker-dev):
|
||||
|
||||
- `eslint_d` now checks for configuration files to load.
|
||||
- Fixed an error where `eslint_d` fails to load.
|
||||
|
||||
[Sc3l3t0n](https://github.com/Sc3l3t0n):
|
||||
|
||||
|
|
|
@ -18,12 +18,13 @@
|
|||
systems = import inputs.systems;
|
||||
imports = [
|
||||
./flake/templates
|
||||
./flake/tests
|
||||
|
||||
./flake/apps.nix
|
||||
./flake/develop.nix
|
||||
./flake/legacyPackages.nix
|
||||
./flake/overlays.nix
|
||||
./flake/packages.nix
|
||||
./flake/develop.nix
|
||||
];
|
||||
|
||||
flake = {
|
||||
|
|
68
flake/tests/checks/nixos.nix
Normal file
68
flake/tests/checks/nixos.nix
Normal file
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
testers,
|
||||
nixosModules,
|
||||
profiles,
|
||||
...
|
||||
}:
|
||||
testers.runNixOSTest {
|
||||
name = "nvf-nixos-test";
|
||||
nodes.machine = {pkgs, ...}: {
|
||||
imports = [
|
||||
profiles.minimal
|
||||
nixosModules.nvf
|
||||
];
|
||||
|
||||
programs.nvf = {
|
||||
enable = true;
|
||||
|
||||
settings.vim = {
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
|
||||
globals = {
|
||||
editorconfig = true;
|
||||
};
|
||||
|
||||
extraPackages = [pkgs.lazygit];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript =
|
||||
# python
|
||||
''
|
||||
machine.start()
|
||||
machine.wait_for_unit("multi-user.target")
|
||||
|
||||
with subtest("Verify that Neovim can be run by the test user and displays its version"):
|
||||
machine.succeed("runuser -l test -c 'nvim --version'")
|
||||
|
||||
with subtest("Launch Neovim and immediately quit to verify it starts correctly"):
|
||||
machine.succeed("runuser -l test -c 'nvim -c q'")
|
||||
|
||||
with subtest("Create a test file and open it with Neovim"):
|
||||
machine.succeed("runuser -l test -c 'echo \"test content\" > /home/test/testfile.txt'")
|
||||
machine.succeed("runuser -l test -c 'nvim -c \"wq\" /home/test/testfile.txt'")
|
||||
|
||||
with subtest("Verify the file was edited and saved correctly"):
|
||||
machine.succeed("grep 'test content' /home/test/testfile.txt")
|
||||
|
||||
with subtest("Run specific Neovim commands and verify the output"):
|
||||
machine.succeed("runuser -l test -c 'nvim --headless +\\\":echo \\\"hello, world!\\\"\\\" +q > /home/test/output.txt'")
|
||||
machine.succeed("grep 'hello, world!' /home/test/output.txt")
|
||||
|
||||
with subtest("Test nvf-print-config-path commands"):
|
||||
machine.succeed("runuser -l test -c 'nvf-print-config | grep \"vim.g.editorconfig = true\"'")
|
||||
machine.succeed("runuser -l test -c 'nvf-print-config-path | grep /path/to/nix/store/config'")
|
||||
|
||||
with subtest("Check for errors in startup messages"):
|
||||
machine.succeed("runuser -l test -c 'nvim --headless --startuptime /home/test/startup.log +q'")
|
||||
machine.fail("grep -i 'error' /home/test/startup.log")
|
||||
|
||||
with subtest("Verify files in Neovim PATH to test extrapackages API"):
|
||||
machine.succeed("runuser -l test -c 'nvim --headless +\\\":echo $VIMRUNTIME\\\" +q | grep /nix/store/'")
|
||||
|
||||
with subtest("Verify extrapackages can be executed inside Neovim"):
|
||||
machine.succeed("runuser -l test -c 'nvim --headless +\\\":!lazygit --version\\\" +q'")
|
||||
'';
|
||||
}
|
39
flake/tests/default.nix
Normal file
39
flake/tests/default.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
inputs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
perSystem = {
|
||||
pkgs,
|
||||
self',
|
||||
...
|
||||
}: let
|
||||
inherit (lib.filesystem) packagesFromDirectoryRecursive;
|
||||
inherit (lib.customisation) callPackageWith;
|
||||
inherit (lib.attrsets) recursiveUpdate;
|
||||
|
||||
# Attribute set containing paths to specific profiles. This is meant to be
|
||||
# an easy path to where profiles are defined as the tests directory gets
|
||||
# more complicated, and allow easier renames.
|
||||
profiles = {
|
||||
minimal = ./profiles/minimal.nix;
|
||||
};
|
||||
|
||||
# Attributes to pass to all builder packages.
|
||||
defaultInherits = {
|
||||
inherit inputs profiles;
|
||||
inherit (config.flake) homeManagerModules nixosModules;
|
||||
};
|
||||
|
||||
callPackage = callPackageWith (recursiveUpdate pkgs defaultInherits);
|
||||
in {
|
||||
checks = packagesFromDirectoryRecursive {
|
||||
inherit callPackage;
|
||||
directory = ./checks;
|
||||
};
|
||||
|
||||
# Expose checks as packages to be built
|
||||
packages.test = self'.checks.home-manager-test.driverInteractive;
|
||||
};
|
||||
}
|
16
flake/tests/profiles/minimal.nix
Normal file
16
flake/tests/profiles/minimal.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
# The 'minimal' test profile for nvf. This exposes the bare minimum for defining the test
|
||||
# VMs. If an addition is test-specific (e.g., targeting at a specific functionality) then
|
||||
# it does not belong here. However machine configuration that must be propagated to *all*
|
||||
# tests should be defined here.
|
||||
{
|
||||
virtualisation = {
|
||||
cores = 2;
|
||||
memorySize = 2048;
|
||||
qemu.options = ["-vga none -enable-kvm -device virtio-gpu-pci,xres=720,yres=1440"];
|
||||
};
|
||||
|
||||
users.users.test = {
|
||||
isNormalUser = true;
|
||||
password = "";
|
||||
};
|
||||
}
|
|
@ -9,7 +9,14 @@ in {
|
|||
|
||||
setupOpts = mkPluginSetupOption "codecompanion-nvim" {
|
||||
opts = {
|
||||
send_code = mkEnableOption "code from being sent to the LLM.";
|
||||
send_code =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to enable code being sent to the LLM.
|
||||
'';
|
||||
};
|
||||
|
||||
log_level = mkOption {
|
||||
type = enum ["DEBUG" "INFO" "ERROR" "TRACE"];
|
||||
|
@ -30,7 +37,10 @@ in {
|
|||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = "a diff view to see the changes made by the LLM.";
|
||||
description = ''
|
||||
Whether to enable a diff view
|
||||
to see the changes made by the LLM.
|
||||
'';
|
||||
};
|
||||
|
||||
close_chat_at = mkOption {
|
||||
|
@ -64,7 +74,12 @@ in {
|
|||
};
|
||||
|
||||
chat = {
|
||||
auto_scroll = mkEnableOption "automatic page scrolling.";
|
||||
auto_scroll =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = "Whether to enable automatic page scrolling.";
|
||||
};
|
||||
|
||||
show_settings = mkEnableOption ''
|
||||
LLM settings to appear at the top of the chat buffer.
|
||||
|
@ -85,14 +100,18 @@ in {
|
|||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = "references in the chat buffer.";
|
||||
description = ''
|
||||
Whether to enable references in the chat buffer.
|
||||
'';
|
||||
};
|
||||
|
||||
show_token_count =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = "the token count for each response.";
|
||||
description = ''
|
||||
Whether to enable the token count for each response.
|
||||
'';
|
||||
};
|
||||
|
||||
intro_message = mkOption {
|
||||
|
@ -155,7 +174,10 @@ in {
|
|||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = "showing default actions in the action palette.";
|
||||
description = ''
|
||||
Whether to enable showing default
|
||||
actions in the action palette.
|
||||
'';
|
||||
};
|
||||
|
||||
show_default_prompt_library =
|
||||
|
@ -163,7 +185,8 @@ in {
|
|||
// {
|
||||
default = true;
|
||||
description = ''
|
||||
showing default prompt library in the action palette.
|
||||
Whether to enable showing default
|
||||
prompt library in the action palette.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
@ -22,6 +22,11 @@ in {
|
|||
};
|
||||
|
||||
treesitter.enable = true;
|
||||
|
||||
autocomplete.nvim-cmp = {
|
||||
sources = {codecompanion-nvim = "[codecompanion]";};
|
||||
sourcePlugins = ["codecompanion-nvim"];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
local markers = { "eslint.config.js", "eslint.config.mjs",
|
||||
".eslintrc", ".eslintrc.json", ".eslintrc.js", ".eslintrc.yml", }
|
||||
for _, filename in ipairs(markers) do
|
||||
local path = vim.fs.join(cwd, filename)
|
||||
local path = vim.fs.joinpath(cwd, filename)
|
||||
if vim.loop.fs_stat(path) then
|
||||
return require("lint.linters.eslint_d").parser(output, bufnr, cwd)
|
||||
end
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
local markers = { "eslint.config.js", "eslint.config.mjs",
|
||||
".eslintrc", ".eslintrc.json", ".eslintrc.js", ".eslintrc.yml", }
|
||||
for _, filename in ipairs(markers) do
|
||||
local path = vim.fs.join(cwd, filename)
|
||||
local path = vim.fs.joinpath(cwd, filename)
|
||||
if vim.loop.fs_stat(path) then
|
||||
return require("lint.linters.eslint_d").parser(output, bufnr, cwd)
|
||||
end
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
local markers = { "eslint.config.js", "eslint.config.mjs",
|
||||
".eslintrc", ".eslintrc.json", ".eslintrc.js", ".eslintrc.yml", }
|
||||
for _, filename in ipairs(markers) do
|
||||
local path = vim.fs.join(cwd, filename)
|
||||
local path = vim.fs.joinpath(cwd, filename)
|
||||
if vim.loop.fs_stat(path) then
|
||||
return require("lint.linters.eslint_d").parser(output, bufnr, cwd)
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue