Closed jakevollkommer closed 2 weeks ago
Seems to be erroring out on local json = vim.fn.json_decode(response)
, where response
is the string containing downloadUrl. Could you include the Neovim version and operating system this occurred on?
NVIM v0.9.5 MacOS Sonoma 14.4.1 (23E224) (ARM Silicon chip)
@jakevollkommer I made the changes for this issue in #22.
I also use MacOS 14.4.1
and Neovim v0.9.5
so I tested it.
@jakevollkommer How have you installed Neovim? Because I can't reproduce the same issue as you, and how is your lazy.nvim setup? I want to be able to try and reproduce it.
-- ~/.config/nvim/init.lua or in a minimal.lua and run:
-- nvim --clean -u minimal.lua
local lazypath = "/tmp/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
{
"supermaven-inc/supermaven-nvim",
config = function()
require("supermaven-nvim").setup({})
end,
},
}, {})
You can use this minimal setup to test if it works for you this way.
my setup is a bit complicated:
init.lua
is just
require("jake")
lua/jake/init.lua
require("jake.lazy_init")
lua/jake/lazy_init.lua
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
spec = "jake.lazy",
change_detection = { notify = false }
})
and finally
lua/jake/lazy/supermaven.lua
return {
{
"supermaven-inc/supermaven-nvim",
config = function()
require("supermaven-nvim").setup({})
end,
},
}
at the end of the day, though, the setup is quite the same
@jakevollkommer I am guessing that require("lazy").setup({ spec = "..." })
works the same as to use require("lazy").setup({ import = "..." })
.
I tested it in my end with the kind of setup that you have an couldn't get the error to show.
I have this Neovim version built from source if it helps:
NVIM v0.9.5
Build type: RelWithDebInfo
LuaJIT 2.1.1692716794
Compilation: /Library/Developer/CommandLineTools/usr/bin/cc -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -fdiagnostics-color=always -fstack-protector-strong -DUNIT_TESTING -DINCLUDE_GENERATED_DECLARATIONS -I/Users/aome/neovim/.deps/usr/include/luajit-2.1 -I/opt/homebrew/opt/gettext/include -I/Users/aome/neovim/.deps/usr/include -I/Users/aome/neovim/build/src/nvim/auto -I/Users/aome/neovim/build/include -I/Users/aome/neovim/build/cmake.config -I/Users/aome/neovim/src -I/Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include -I/Users/aome/neovim/.deps/usr/include -I/Users/aome/neovim/.deps/usr/include -I/Users/aome/neovim/.deps/usr/include -I/Users/aome/neovim/.deps/usr/include -I/Users/aome/neovim/.deps/usr/include -I/Users/aome/neovim/.deps/usr/include
Oh sorry, nvim was installed with homebrew. I'll try your min config tomorrow
@jakevollkommer I was going to try installing from homebrew but they just updated to Neovim v0.10.0 and brew install neovim@0.9.5
doesn't work, with v0.10.0
I didn't have any problems so far.
Just upgraded to v0.10.0
and changed my init.lua
to this:
-- ~/.config/nvim/init.lua or in a minimal.lua and run:
-- nvim --clean -u minimal.lua
local lazypath = "/tmp/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
{
"supermaven-inc/supermaven-nvim",
config = function()
require("supermaven-nvim").setup({})
end,
},
}, {})
but I still get the error
Failed to run `config` for supermaven-nvim
{"downloadUrl":"https://supermaven-public.s3.amazonaws.com/sm-agent/22/darwin/arm64/sm-agent","version":22,"sha256Hash":"32905027da01c41caefcd153f025241e2c9a4da038483baefd6729fa99e9feed7"}
# stacktrace:
- /supermaven-nvim/lua/supermaven-nvim/binary/binary_fetcher.lua:41 _in_ **discover_binary_url**
- /supermaven-nvim/lua/supermaven-nvim/binary/binary_fetcher.lua:63 _in_ **fetch_binary**
- /supermaven-nvim/lua/supermaven-nvim/binary/binary_fetcher.lua:9
- /supermaven-nvim/lua/supermaven-nvim/init.lua:1
- init.lua:20 _in_ **config**
- init.lua:16
nvim --version
NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713773202
Run "nvim -V1 -v" for more info
sw_vers
ProductName: macOS
ProductVersion: 14.4.1
BuildVersion: 23E224
@jakevollkommer can you test the following (from the vim command mode :lua ...
):
local json = '{"downloadUrl":"https://supermaven-public.s3.amazonaws.com/sm-agent/22/darwin/arm64/sm-agent","version":22,"sha256Hash":"32905027da01c41caefcd153f025241e2c9a4da038483baefd6729fa99e9feed7"}'
print(vim.inspect(vim.fn.json_decode(json))) -- if this fails try the next one
print(vim.inspect(vim.json.decode(json)))
[!NOTE]
You can create a
.lua
file with this and run it with:luafile %
or:source %
, if you think is more convenient than trying it directly in command mode:lua ...
.
it should result in a table like:
{
downloadUrl = "https://supermaven-public.s3.amazonaws.com/sm-agent/22/darwin/arm64/sm-agent",
sha256Hash = "32905027da01c41caefcd153f025241e2c9a4da038483baefd6729fa99e9feed7",
version = 22
}
I found this issue that may be the solution to the problem.
[!NOTE]
I changed
vim.fn.json_decode(response)
withvim.json.decode(response)
in my end and still works as expected, so maybe this fixes it.
I'm not @jakevollkommer but I'm running into the same issues.
I'm on:
$ nvim --version
NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713773202
Run "nvim -V1 -v" for more info
# sw_vers
ProductName: macOS
ProductVersion: 14.2.1
BuildVersion: 23C71
Running
local json = '{"downloadUrl":"https://supermaven-public.s3.amazonaws.com/sm-agent/22/darwin/arm64/sm-agent","version":22,"sha256Hash":"32905027da01c41caefcd153f025241e2c9a4da038483baefd6729fa99e9feed7"}'
print(vim.inspect(vim.fn.json_decode(json))) -- if this fails try the next one
print(vim.inspect(vim.json.decode(json)))
works (both versions work for me).
And yet I get the same error @jakevollkommer gets:
Failed to run `config` for supermaven-nvim
Vim:E474: Unidentified byte: ^[[3g^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H
^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[
H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H^M{"downloadUrl":"https://supermaven-publi
c.s3.amazonaws.com/sm-agent/23/darwin/arm64/sm-agent","version":23,"sha256Hash":"9746c9acaea5
7d2b08ae2360bae4775d32abef6ac30c682570bd7162daaf9f56"}
# stacktrace:
- /supermaven-nvim/lua/supermaven-nvim/binary/binary_fetcher.lua:52 _in_ **discover_binary_
url**
- /supermaven-nvim/lua/supermaven-nvim/binary/binary_fetcher.lua:74 _in_ **fetch_binary**
- /supermaven-nvim/lua/supermaven-nvim/binary/binary_handler.lua:9
- /supermaven-nvim/lua/supermaven-nvim/init.lua:1
- lua/plugin/supermaven.lua:4 _in_ **config**
- init.lua:5
I think it is because:
:lua print(vim.fn.system("curl -s 'https://supermaven.com/api/download-path?platform=macosx&arch=aarch64&editor=neovim'"))
returns
^M^[[3g^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^
[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H
^[H ^[H ^[H ^[H ^[H^M{"downloadUrl":"https://supermaven-public.s3.amazonaws.com/sm-agent
/23/darwin/arm64/sm-agent","version":23,"sha256Hash":"9746c9acaea57d2b08ae2360bae4775d32abef6
ac30c682570bd7162daaf9f56"}
There are some leading weird bytes in there for some reason.
The same thing happens with
:lua print(vim.fn.system("echo hello"))
as it prints
^M^[[3g^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^
[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H
^[H ^[H ^[H ^[H ^[H^Mhello
This one does work:
:lua print(vim.fn.system({"echo", "hello"}))
prints
hello
NvChad user here, running into the same issue. Using NVIM v0.9.5.
"Failed to run config
for supermaven-nvim
Vim:E474: Unidentified byte: ....
Windows 11 Home - v. 23H2 12th Gen Intel(R) Core(TM) i7-12700H
@jakevollkommer @claudeloba With the merge of #34 is this issue resolved?
@AlejandroSuero are there any config changes to make to include this PR? From the default config, still having the error.
using :lua print(vim.fn.system("curl -s 'https://supermaven.com/api/download-path?platform=macosx&arch=aarch64&editor=neovim'"))
I do get {"downloadUrl":"https://supermaven-public.s3.amazonaws.com/sm-agent/24/darwin/arm64/sm-agent","version":24,"sha256Hash":"ff756b087232cb4701f5c304e81ce3dc06630b31ea5e107c02848e322830287b"}
which seems correct however I still get the same error sadly
@jakevollkommer I would try removing supermaven's directory with rm -rf ~/.supermaven
and If it still errors, paste the error here, and try using a VM with a MacOS to see if errors the same way.
Also try to the following:
:lua print(vim.inspect(vim.fn.json_decode(vim.fn.system({ "curl", "-s", "https://supermaven.com/api/download-path?platform=macosx&arch=aarch64&editor=neovim" }))))
vim.json.decode
: :lua print(vim.inspect(vim.json.decode(vim.fn.system({ "curl", "-s", "https://supermaven.com/api/download-path?platform=macosx&arch=aarch64&editor=neovim" }))))
It should print this:
{
downloadUrl = "https://supermaven-public.s3.amazonaws.com/sm-agent/24/darwin/arm64/sm-agent",
sha256Hash = "ff756b087232cb4701f5c304e81ce3dc06630b31ea5e107c02848e322830287b",
version = 24
}
Here is my curl version using the default installed curl (/usr/bin/curl
):
> curl --version
curl 8.6.0 (x86_64-apple-darwin23.0) libcurl/8.6.0 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.12 nghttp2/1.61.0
Release-Date: 2024-01-31
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS GSS-API HSTS HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz MultiSSL NTLM NTLM_WB SPNEGO SSL threadsafe UnixSockets
Just chiming in, in case this helps debug. I had a similar issue, I got an error trying to download the binary.
Added a supermaven.lua file to my plugins with the following:
return {
"supermaven-inc/supermaven-nvim",
}
Got the error. Changed my Lua file to:
return {
"supermaven-inc/supermaven-nvim",
config = function()
require("supermaven-nvim").setup({})
end,
}
Was still getting the error.
Deleted the ~/.supermaven directory and restarted Neovim. Problem fixed!
As a follow up, I found the culprit for the weird characters being added to the result of the spawned command. I was seeing the same problem in other programs too.
I'm using fish shell and my fish config had:
tabs -2
This would cause fish to inject characters even if the shell is not interactive.
Changing the config to:
# Set tab width
if status --is-interactive
tabs -2
end
fixed the problem.
This is unrelated to neovim, but other users might find it useful.
Just chiming in, in case this helps debug. I had a similar issue, I got an error trying to download the binary.
Added a supermaven.lua file to my plugins with the following:
return { "supermaven-inc/supermaven-nvim", }
Got the error. Changed my Lua file to:
return { "supermaven-inc/supermaven-nvim", config = function() require("supermaven-nvim").setup({}) end, }
Was still getting the error.
Deleted the ~/.supermaven directory and restarted Neovim. Problem fixed!
Hey all, sorry for late response. After rm -rf ~/.supermaven
and copy/pasting the above config, still getting the same error. :/
I ran :lua print(vim.inspect(vim.fn.json_decode(vim.fn.system({ "curl", "-s", "https://supermaven.com/api/download-path?platform=macosx&arch=aarch64&editor=neovim" }))))
again and got the following:
{
downloadUrl = "https://supermaven-public.s3.amazonaws.com/sm-agent/24/darwin/arm64/sm-agent",
sha256Hash = "ff756b087232cb4701f5c304e81ce3dc06630b31ea5e107c02848e322830287b",
version = 24
}
curl --version
Release-Date: 2023-10-11
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS GSS-API HSTS HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz MultiSSL NTLM NTLM_WB SPNEGO SSL threadsafe UnixSockets
actually not sure how to upgrade the system installed curl
at /usr/bin/curl
?
@jakevollkommer I think updating the system and Xcode should be enough. At least I don't do anything fancier than that when it comes to system default dependencies.
@AlejandroSuero upgraded to grep
2.6.0
, error persists
also tried the minimal default config, no luck still :/ might have to give up tbh
@jakevollkommer I will try brew install curl
and then removing ~/.supermaven
to see if it does the trick.
@jakevollkommer I wish I could be of more help but I have tried with the same OS, arch and Neovim version and have not been able to replicate this.
I'm very surprised to hear that :lua print(vim.inspect(vim.fn.json_decode(vim.fn.system({ "curl", "-s", "https://supermaven.com/api/download-path?platform=macosx&arch=aarch64&editor=neovim" }))))
runs fine in Neovim but the plugin setup doesn't, as this line of code seems to be the same thing that is run by the plugin
If you would like to continue debugging this would you be able to clone the repo and have your plugin manager point to the local directory? I'm curious what would happen if you were to replace line 64 of binary_fetcher
, local json = vim.fn.json_decode(response)
with this line that apparently works?
e.g. have local json = vim.fn.json_decode(vim.fn.system({ "curl", "-s", "https://supermaven.com/api/download-path?platform=macosx&arch=aarch64&editor=neovim" }))
Sure, I can try that. Not actually sure how to point lazy.nvim
at a local dir but can look it up later
It would just be
{ dir = "~/path/to/plugin", config = function() require("supermaven-nvim").setup({}) end, }
so just the regular config but with "supermaven-inc/supermaven-nvim",
replaced with dir = "~/path/to/plugin",
that worked ðŸ«
Didn't make any changes at all to the cloned repo
That's quite strange, I don't have enough of an understanding of lazy.nvim to understand why reading the plugin locally should be any different from pointing to it remotely
@jakevollkommer maybe it wasn't up to date or something, if not, some weird interaction with the cache probably.
Side note:
If you want to have lazy setup so you can do this kind of thing more often, I recommend this setup:
require("lazy")
dev
entry to your options: require("lazy").setup(opts)
-- your lazy config file
require("lazy").setup({
-- your config options...
dev = {
path = vim.env.HOME .. "path/to/plugin",
fallback = true
},
})
-- plugin config
{
"supermaven-inc/supermaven-nvim",
dev = true,
-- ...
}
This way, if dev = true
it will pick up the cloned repo and if you change branches it will pick up the branch you are working on.
More information about this:
I figured any cache would be in ~/.supermaven
, no? Unless you mean lazy
cache or nvim
cache?
FWIW, I just removed the dir
key and instead set it back to supermaven-inc/supermaven-nvim
and now it's working 🚀
I guess it just had trouble downloading initially, but now it's linked
Using the default config for the lazy setup. Getting this stack trace: