mistricky / codesnap.nvim

📸 Snapshot plugin with rich features that can make pretty code snapshots for Neovim
MIT License
483 stars 16 forks source link

More info on install #31

Closed alekspickle closed 2 months ago

alekspickle commented 4 months ago

Maybe I'm stupid, but while trying to install, I just added specified line to packer plugin list, and I get this error on init:


Error detected while processing /home/pickle/.config/nvim/init.lua:
E5113: Error while calling lua chunk: Vim:E475: Invalid value for argument cmd: '/home/pickle/.config/nvim/site/pack/packer/start/codesna
p.nvim/snap-server/target/release/snap-server' is not executable
stack traceback:
        [C]: in function 'connect'
        .../pack/packer/start/codesnap.nvim/lua/codesnap/client.lua:29: in function 'init'
        .../pack/packer/start/codesnap.nvim/lua/codesnap/client.lua:33: in function 'start'
        ...te/pack/packer/start/codesnap.nvim/lua/codesnap/init.lua:15: in function 'setup'
        /home/pickle/.config/nvim/init.lua:39: in main chunk

I mean I get that server-snap is not installed, but at which point should it? and is there some command that copies rust binary to path or something? kinda confused it has not happened yet

mistricky commented 4 months ago

Hey @alekspickle, thx for using codesnap.nvim, and reporting the issue, if you can't install it smoothly, there are only one reason, not because you're stupid, but because the documentation isn't detailed enough, sorry about that.

Do you install codesnap.nvim using Lazy.nvim? the config looks like: image

Please notice there is an option build = 'make', before lazy installing the plugin, the build content will execute immediately. Can you provide your configuration?

alekspickle commented 4 months ago

nah, I wish i discovered lazy.nvim when i tried nvim the first time, at the moment I just use packer for all packages and simply adding this line as use statement installs codesnap nvim package, but apparently does not servers run the rust build/install command. If you can hint me where the entrypoint is, I can do a PR, running check that snap-server is available in path and running something like


[[ -x $(command -v snap-server) ]] && \
cd snap-server && \
 cargo build --release && \
 cp target/release/snap-server /usr/bin/

on init

mistricky commented 3 months ago

The reason of this because the codesnap.nvim needs build server code after installed, the document lacks this part how install this plugin with packer, I'll add it later.

Install this plugin use packer you configure like this:

use { 'mistricky/codesnap.nvim', run = 'make' }
alekspickle commented 3 months ago

that's exactly how I added it, every time I try to reset it ends the same way

mistricky commented 3 months ago

After refactor, this issue may out of stale, can you try with latest version?

alekspickle commented 3 months ago

new error!

Error detected while processing /home/pickle/.config/nvim/site/pack/packer/start/codesnap.nvim/plugin/codesnap.lua:
E5113: Error while calling lua chunk: vim/_init_packages.lua:0: /home/pickle/.config/nvim/site/pack/packer/start/codesnap.nvim/lua/genera
tor.so: invalid ELF header
stack traceback:
        [C]: in function 'error'
        vim/_init_packages.lua: in function <vim/_init_packages.lua:0>
        [C]: in function 'require'
        ...te/pack/packer/start/codesnap.nvim/lua/codesnap/init.lua:3: in main chunk
        [C]: in function 'require'
        ...site/pack/packer/start/codesnap.nvim/plugin/codesnap.lua:1: in main chunk
mistricky commented 3 months ago

Can you provide your OS version and neovim version?

alekspickle commented 3 months ago

Ubuntu 23.10 NVIM v0.9.1

mistricky commented 3 months ago

This issue may relate to which arch you use. What output of execute uname -a on your OS?

alekspickle commented 3 months ago

Linux picklelap 6.5.0-25-generic #25-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 7 14:58:39 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

mistricky commented 3 months ago

Hi! CodeSnap was refactored, you can reinstall follow the latest README, if have any problems just let me know

alekspickle commented 3 months ago

Did not work either


Error detected while processing /home/pickle/.config/nvim/site/pack/packer/start/codesnap.nvim/plugin/codesnap.lua:
E5113: Error while calling lua chunk: ...te/pack/packer/start/codesnap.nvim/lua/codesnap/init.lua:3: module 'generator' not found:
        no field package.preload['generator']
        no file './generator.lua'
        no file '/__w/neovim/neovim/.deps/usr/share/luajit-2.1.0-beta3/generator.lua'
        no file '/usr/local/share/lua/5.1/generator.lua'
        no file '/usr/local/share/lua/5.1/generator/init.lua'
        no file '/__w/neovim/neovim/.deps/usr/share/lua/5.1/generator.lua'
        no file '/__w/neovim/neovim/.deps/usr/share/lua/5.1/generator/init.lua'
        no file '/home/pickle/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/generator.lua'
        no file '/home/pickle/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/generator/init.lua'
        no file '/home/pickle/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/generator.lua'
        no file '/home/pickle/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/generator/init.lua'
        no file './generator.so'
        no file '/usr/local/lib/lua/5.1/generator.so'
        no file '/__w/neovim/neovim/.deps/usr/lib/lua/5.1/generator.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
        no file '/home/pickle/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/generator.so'
stack traceback:
        [C]: in function 'require'
        ...te/pack/packer/start/codesnap.nvim/lua/codesnap/init.lua:3: in main chunk
        [C]: in function 'require'
        ...site/pack/packer/start/codesnap.nvim/plugin/codesnap.lua:1: in main chunk
Simon9991 commented 3 months ago

Did not work either


Error detected while processing /home/pickle/.config/nvim/site/pack/packer/start/codesnap.nvim/plugin/codesnap.lua:
E5113: Error while calling lua chunk: ...te/pack/packer/start/codesnap.nvim/lua/codesnap/init.lua:3: module 'generator' not found:
        no field package.preload['generator']
        no file './generator.lua'
        no file '/__w/neovim/neovim/.deps/usr/share/luajit-2.1.0-beta3/generator.lua'
        no file '/usr/local/share/lua/5.1/generator.lua'
        no file '/usr/local/share/lua/5.1/generator/init.lua'
        no file '/__w/neovim/neovim/.deps/usr/share/lua/5.1/generator.lua'
        no file '/__w/neovim/neovim/.deps/usr/share/lua/5.1/generator/init.lua'
        no file '/home/pickle/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/generator.lua'
        no file '/home/pickle/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/generator/init.lua'
        no file '/home/pickle/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/generator.lua'
        no file '/home/pickle/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/generator/init.lua'
        no file './generator.so'
        no file '/usr/local/lib/lua/5.1/generator.so'
        no file '/__w/neovim/neovim/.deps/usr/lib/lua/5.1/generator.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
        no file '/home/pickle/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/generator.so'
stack traceback:
        [C]: in function 'require'
        ...te/pack/packer/start/codesnap.nvim/lua/codesnap/init.lua:3: in main chunk
        [C]: in function 'require'
        ...site/pack/packer/start/codesnap.nvim/plugin/codesnap.lua:1: in main chunk

I had the same issue with the module generator not being found.

In field package.preload['generator']
cache_loader: module generator not found
cache_loader_lib: module generator not found
In file './generator.lua'

I fixed the issue by using version 0.0.11, instead of ^1 like written in the documentation. Here is my codesnap.lua if needed (I am using LazyVim though):

{
  "mistricky/codesnap.nvim",
  lazy = true,
  version = "0.0.11",
  build = "make",
  cmd = "CodeSnapPreviewOn",
  opts = {
    mac_window_bar = false, -- (Optional) MacOS style title bar switch
},
  config = function(_, opts)
    require("codesnap").setup(opts)
  end,
},
mistricky commented 2 months ago

Hello guys @Simon9991 @alekspickle, this issue has been open for too long, something has changed since I released v1, can you guys test this bug in the latest version? if still not working properly, please let me know.

Simon9991 commented 2 months ago

Hi, I just tried with the new version, and I have no issue anymore on my end! Thanks for this plugin, I love it!

alekspickle commented 2 months ago

Works like intended! Thank you but just out of curiosity, do you have the process of install described somewhere? I also want to write nvim plugin with rust backend

mistricky commented 2 months ago

Hi @alekspickle sorry for replying late.

do you have the process of install described somewhere

Nope yet. CodeSnap.nvim is written by rust, and exposes FFI to communicate with Lua modules, if you are interested in this solution, you can check this repo