summaryrefslogtreecommitdiff
path: root/lua/blink/cmp/fuzzy/rust.lua
diff options
context:
space:
mode:
authorMike Vink <mike@pionative.com>2025-01-19 13:52:52 +0100
committerMike Vink <mike@pionative.com>2025-01-19 13:52:52 +0100
commitb77413ff8f59f380612074f0c9bd49093d8db695 (patch)
tree32c39a811ba96ed4ab0a1c81cce9f8d518ed7e31 /lua/blink/cmp/fuzzy/rust.lua
Squashed 'mut/neovim/pack/plugins/start/blink.cmp/' content from commit 1cc3b1a
git-subtree-dir: mut/neovim/pack/plugins/start/blink.cmp git-subtree-split: 1cc3b1a908fbcfd15451c4772759549724f38524
Diffstat (limited to 'lua/blink/cmp/fuzzy/rust.lua')
-rw-r--r--lua/blink/cmp/fuzzy/rust.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/lua/blink/cmp/fuzzy/rust.lua b/lua/blink/cmp/fuzzy/rust.lua
new file mode 100644
index 0000000..e2374cf
--- /dev/null
+++ b/lua/blink/cmp/fuzzy/rust.lua
@@ -0,0 +1,20 @@
+--- @return string
+local function get_lib_extension()
+ if jit.os:lower() == 'mac' or jit.os:lower() == 'osx' then return '.dylib' end
+ if jit.os:lower() == 'windows' then return '.dll' end
+ return '.so'
+end
+
+-- search for the lib in the /target/release directory with and without the lib prefix
+-- since MSVC doesn't include the prefix
+package.cpath = package.cpath
+ .. ';'
+ .. debug.getinfo(1).source:match('@?(.*/)')
+ .. '../../../../target/release/lib?'
+ .. get_lib_extension()
+ .. ';'
+ .. debug.getinfo(1).source:match('@?(.*/)')
+ .. '../../../../target/release/?'
+ .. get_lib_extension()
+
+return require('blink_cmp_fuzzy')