mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-03-27 16:41:55 +00:00
blink-cmp: apply Nix patch; use new fetcher (#714)
Some checks failed
Set up binary cache / cachix (default) (push) Has been cancelled
Set up binary cache / cachix (maximal) (push) Has been cancelled
Set up binary cache / cachix (nix) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (push) Has been cancelled
Validate flake & check documentation / Validate hyperlinks in documentation sources (push) Has been cancelled
Validate flake & check formatting / Validate Flake (push) Has been cancelled
Validate flake & check formatting / Formatting via Alejandra (push) Has been cancelled
Build and deploy documentation / Check latest commit (push) Has been cancelled
Check for typos in the source tree / check-typos (push) Has been cancelled
Build and deploy documentation / publish (push) Has been cancelled
Some checks failed
Set up binary cache / cachix (default) (push) Has been cancelled
Set up binary cache / cachix (maximal) (push) Has been cancelled
Set up binary cache / cachix (nix) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (push) Has been cancelled
Validate flake & check documentation / Validate hyperlinks in documentation sources (push) Has been cancelled
Validate flake & check formatting / Validate Flake (push) Has been cancelled
Validate flake & check formatting / Formatting via Alejandra (push) Has been cancelled
Build and deploy documentation / Check latest commit (push) Has been cancelled
Check for typos in the source tree / check-typos (push) Has been cancelled
Build and deploy documentation / publish (push) Has been cancelled
* blink-cmp: apply Nix patch; use new fetcher * completion/blink: don't break when modifying built-in sources.providers (#683) * completion/blink-cmp: add missing options **Blink breaks again, 11985891th recorded incident** --------- Co-authored-by: Alfarel <alfarelcynthesis@proton.me>
This commit is contained in:
parent
71081d084b
commit
a5dee946a9
4 changed files with 80 additions and 14 deletions
|
@ -244,8 +244,9 @@
|
|||
syncing of nvim shell environment with direnv's.
|
||||
- Add [blink.cmp] source options and some default-disabled sources.
|
||||
- Add [blink.cmp] option to add
|
||||
[friendly-snippets](https://github.com/rafamadriz/friendly-snippets) so
|
||||
blink.cmp can source snippets from it.
|
||||
[friendly-snippets](https://github.com/rafamadriz/friendly-snippets)
|
||||
so blink.cmp can source snippets from it.
|
||||
- Fix [blink.cmp] breaking when built-in sources were modified.
|
||||
|
||||
[TheColorman](https://github.com/TheColorman):
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
git,
|
||||
src,
|
||||
version,
|
||||
fetchpatch,
|
||||
}: let
|
||||
blink-fuzzy-lib = rustPlatform.buildRustPackage {
|
||||
pname = "blink-fuzzy-lib";
|
||||
|
@ -13,11 +14,10 @@
|
|||
# TODO: remove this if plugin stops using nightly rust
|
||||
env.RUSTC_BOOTSTRAP = true;
|
||||
|
||||
useFetchCargoVendor = true;
|
||||
cargoHash = "sha256-F1wh/TjYoiIbDY3J/prVF367MKk3vwM7LqOpRobOs7I=";
|
||||
|
||||
nativeBuildInputs = [git];
|
||||
cargoLock = {
|
||||
lockFile = "${src}/Cargo.lock";
|
||||
allowBuiltinFetchGit = true;
|
||||
};
|
||||
};
|
||||
|
||||
libExt =
|
||||
|
@ -34,5 +34,19 @@ in
|
|||
preInstall = ''
|
||||
mkdir -p target/release
|
||||
ln -s ${blink-fuzzy-lib}/lib/libblink_cmp_fuzzy.${libExt} target/release/libblink_cmp_fuzzy.${libExt}
|
||||
echo -n "nix" > target/release/version
|
||||
'';
|
||||
|
||||
# Borrowed from nixpkgs
|
||||
# TODO: Remove this patch when updating to next version
|
||||
patches = [
|
||||
(fetchpatch {
|
||||
name = "blink-add-bypass-for-nix.patch";
|
||||
url = "https://github.com/Saghen/blink.cmp/commit/6c83ef1ae34abd7ef9a32bfcd9595ac77b61037c.diff?full_index=1";
|
||||
hash = "sha256-304F1gDDKVI1nXRvvQ0T1xBN+kHr3jdmwMMp8CNl+GU=";
|
||||
})
|
||||
];
|
||||
|
||||
# Module for reproducing issues
|
||||
nvimSkipModule = ["repro"];
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption literalMD;
|
||||
inherit (lib.types) listOf str either attrsOf submodule enum anything int nullOr;
|
||||
inherit (lib.types) bool listOf str either attrsOf submodule enum anything int nullOr;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline pluginType;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
|
@ -21,8 +21,9 @@
|
|||
freeformType = anything;
|
||||
options = {
|
||||
module = mkOption {
|
||||
type = str;
|
||||
description = "module of the provider";
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Provider module.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -40,7 +41,7 @@ in {
|
|||
providers = mkOption {
|
||||
type = attrsOf providerType;
|
||||
default = {};
|
||||
description = "Settings for completion providers";
|
||||
description = "Settings for completion providers.";
|
||||
};
|
||||
|
||||
transform_items = mkOption {
|
||||
|
@ -63,6 +64,12 @@ in {
|
|||
default = [];
|
||||
description = "List of sources to enable for cmdline. Null means use default source list.";
|
||||
};
|
||||
|
||||
keymap = mkOption {
|
||||
type = keymapType;
|
||||
default = {};
|
||||
description = "blink.cmp cmdline keymap";
|
||||
};
|
||||
};
|
||||
|
||||
completion = {
|
||||
|
@ -74,6 +81,16 @@ in {
|
|||
description = "Delay before auto show triggers";
|
||||
};
|
||||
};
|
||||
|
||||
menu.auto_show = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Manages the appearance of the completion menu. You may prevent the menu
|
||||
from automatically showing by this option to `false` and manually showing
|
||||
it with the show keymap command.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
keymap = mkOption {
|
||||
|
@ -103,7 +120,25 @@ in {
|
|||
fuzzy = {
|
||||
prebuilt_binaries = {
|
||||
download = mkBool false ''
|
||||
Auto-downloads prebuilt binaries. Do not enable, it doesn't work on nix
|
||||
Auto-downloads prebuilt binaries.
|
||||
|
||||
::: .{warning}
|
||||
Do not enable this option, as it does **not work** on Nix!
|
||||
:::
|
||||
'';
|
||||
};
|
||||
|
||||
implementation = mkOption {
|
||||
type = enum ["lua" "prefer_rust" "rust" "prefer_rust_with_warning"];
|
||||
default = "prefer_rust";
|
||||
description = ''
|
||||
fuzzy matcher implementation for Blink.
|
||||
|
||||
* `"lua"`: slower, Lua native fuzzy matcher implementation
|
||||
* `"rust": use the SIMD fuzzy matcher, 'frizbee'
|
||||
* `"prefer_rust"`: use the rust implementation, but fall back to lua
|
||||
* `"prefer_rust_with_warning"`: use the rust implementation, and fall back to lua
|
||||
if it is not available after emitting a warning.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
@ -122,12 +157,14 @@ in {
|
|||
sourcePlugins = let
|
||||
sourcePluginType = submodule {
|
||||
options = {
|
||||
enable = mkEnableOption "this source";
|
||||
package = mkOption {
|
||||
type = pluginType;
|
||||
description = ''
|
||||
`blink-cmp` source plugin package.
|
||||
'';
|
||||
};
|
||||
|
||||
module = mkOption {
|
||||
type = str;
|
||||
description = ''
|
||||
|
@ -136,7 +173,6 @@ in {
|
|||
Should be present in the source's documentation.
|
||||
'';
|
||||
};
|
||||
enable = mkEnableOption "this source";
|
||||
};
|
||||
};
|
||||
in
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.attrsets) attrValues filterAttrs;
|
||||
inherit (lib.lists) map optional;
|
||||
inherit (lib.attrsets) attrValues filterAttrs mapAttrsToList;
|
||||
inherit (lib.lists) map optional elem;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs;
|
||||
|
||||
|
@ -24,7 +24,22 @@
|
|||
|
||||
enabledBlinkSources = filterAttrs (_source: definition: definition.enable) cfg.sourcePlugins;
|
||||
blinkSourcePlugins = map (definition: definition.package) (attrValues enabledBlinkSources);
|
||||
|
||||
blinkBuiltins = [
|
||||
"path"
|
||||
"lsp"
|
||||
"snippets"
|
||||
"buffer"
|
||||
"omni"
|
||||
];
|
||||
in {
|
||||
assertions =
|
||||
mapAttrsToList (provider: definition: {
|
||||
assertion = elem provider blinkBuiltins || definition.module != null;
|
||||
message = "`config.vim.autocomplete.blink-cmp.setupOpts.sources.providers.${provider}.module` is `null`: non-builtin providers must set `module`.";
|
||||
})
|
||||
cfg.setupOpts.sources.providers;
|
||||
|
||||
vim = mkIf cfg.enable {
|
||||
startPlugins = ["blink-compat"] ++ blinkSourcePlugins ++ (optional cfg.friendly-snippets.enable "friendly-snippets");
|
||||
lazy.plugins = {
|
||||
|
|
Loading…
Add table
Reference in a new issue