Skip to content

chore: deprecate require'avante_lib'.load() #2354

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

teto
Copy link
Contributor

@teto teto commented Jun 27, 2025

mark it as deprecated to avoid breaking user configs but it is now a noop (does nothing). Updated README to reflect changes in #2324

linked PR got reverted in #2353

local os_name = require("avante.utils").get_os_name()
local ext = os_name == "linux" and "so" or (os_name == "darwin" and "dylib" or "dll")
local dirname = string.sub(debug.getinfo(1).source, 2, #"/avante_lib.lua" * -1)
return dirname .. ("../build/?.%s"):format(ext)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

‌‌‌‌‌‌‌Changing build to lua might solve the issue of darwin

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will fix it but it is still extra-code just for darwin. What I've pushed, is instead renamed the .dynlib to .so. From what I read from darwin users, it should work but I would like someone to confirm this.

@teto teto force-pushed the teto/update-readme branch from 544cc50 to 896f4eb Compare June 30, 2025 13:35
@@ -48,7 +48,7 @@ $(foreach lua_version,$(LUA_VERSIONS),$(eval $(call make_definitions,$(lua_versi
define build_package
$1-$2:
cargo build --release --features=$1 -p avante-$2
cp target/release/libavante_$(shell echo $2 | tr - _).$(EXT) $(BUILD_DIR)/avante_$(shell echo $2 | tr - _).$(EXT)
cp target/release/libavante_$(shell echo $2 | tr - _).$(EXT) $(BUILD_DIR)/avante_$(shell echo $2 | tr - _).so
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here we rename to .so even on darwin such that neovim can find the library without extra code

teto added 4 commits July 2, 2025 11:08
mark it as deprecated to avoid breaking user configs but it is now a noop (does nothing). Updated README to reflect changes in yetone#2324
the default LUA_CPATH for interpreters look at .so files but not at .dynlib files which is one of mac's extension. 
Looking at neovim/neovim#21749 seems like the libraries on darwin could also use the .so extension
@teto teto force-pushed the teto/update-readme branch from 896f4eb to 0c5dabf Compare July 2, 2025 09:09
@khaneliman
Copy link
Contributor

khaneliman commented Jul 4, 2025

Tested locally with a barebones config installing it with Lazy from this PR branch. AvanteBuild source=true generated the .so files and allowed the plugin to work as soon as I tried without .load() anywhere.

Having never used the command before, it was a bit weird to see absolutely no UI feedback to whether it was working, or not. I had to check my btop and see the rustc processes spawning to know the command finally worked. AvanteBuild just kept downloading the .dylib libraries.

@teto
Copy link
Contributor Author

teto commented Jul 4, 2025

thanks for testing. Your test showed I dont handle the downloading libraries yet. Once I fix that, we should be good to go o/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants