mistricky / codesnap.nvim

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

The latest version 1.0 & 1.0.1 install failed #39

Closed JohnWickzzz closed 3 months ago

JohnWickzzz commented 3 months ago

Failed to source /Users/lee/.local/share/nvim/site/lazy/codesnap.nvim/plugin/codesnap.lua

vim/_editor.lua:0: /Users/lee/.config/nvim/init.lua..nvim_exec2() called at /Users/lee/.config/nvim/init.lua:0../Users/lee/.local/share/nvim/site/lazy/codesnap.nvim/plugin/codesnap.lua: Vim(source):E5113: Err or while calling lua chunk: vim/loader.lua:0: dlopen(/Users/lee/.local/share/nvim/site/lazy/codesnap.nvim/lua/generator.so, 0x0006): tried: '/Users/lee/.local/share/nvim/site/lazy/codesnap.nvim/lua/generator.s o' (mach-o file, but is an incompatible architecture (have (arm64), need (x86_64h))) stack traceback: ^I[C]: in function 'error' ^Ivim/loader.lua: in function <vim/loader.lua:0> ^I[C]: in function 'require' ^I...share/nvim/site/lazy/codesnap.nvim/lua/codesnap/init.lua:3: in main chunk ^I[C]: in function 'require' ^I...l/share/nvim/site/lazy/codesnap.nvim/plugin/codesnap.lua:1: in main chunk ^I[C]: in function 'nvim_exec2' ^Ivim/_editor.lua: in function 'cmd' ^I.../share/nvim/site/lazy/lazy.nvim/lua/lazy/core/loader.lua:485: in function <.../share/nvim/site/lazy/lazy.nvim/lua/lazy/core/loader.lua:484> ^I[C]: in function 'xpcall' ^I...al/share/nvim/site/lazy/lazy.nvim/lua/lazy/core/util.lua:113: in function 'try' ^I... ^I.../share/nvim/site/lazy/lazy.nvim/lua/lazy/core/loader.lua:191: in function 'load' ^I.../share/nvim/site/lazy/lazy.nvim/lua/lazy/core/loader.lua:123: in function 'startup' ^I.../.local/share/nvim/site/lazy/lazy.nvim/lua/lazy/init.lua:110: in function 'setup' ^I/Users/lee/.config/nvim/lua/core/pack.lua:135: in function 'load_lazy' ^I/Users/lee/.config/nvim/lua/core/pack.lua:138: in main chunk ^I[C]: in function 'require' ^I/Users/lee/.config/nvim/lua/core/init.lua:160: in function 'load_core' ^I/Users/lee/.config/nvim/lua/core/init.lua:170: in main chunk ^I[C]: in function 'require' ^I/Users/lee/.config/nvim/init.lua:2: in main chunk

stacktrace:

The error msg.

mistricky commented 3 months ago

Hi @JohnWickzzz, can you provide the following information:

JohnWickzzz commented 3 months ago

sorry, forgot to say. OS: Mac OS 12.7.3 (intel) nvim version: 0.9.5 codesnap version: v1.0.1

mistricky commented 3 months ago

Have you installed codesnap another version before? Since v1.0.0 codesnap has break change, can you try clean codesnap plugin use Lazy, and reinstall it again?

JohnWickzzz commented 3 months ago

I tried to uninstall and reinstall several times, but I get the same error every time. As the error msg Error while calling lua chunk: vim/loader.lua:0: dlopen(/Users/lee/.local/share/nvim/site/lazy/codesnap.nvim/lua/generator.so, 0x0006): tried: '/Users/lee/.local/share/nvim/site/lazy/codesnap.nvim/lua/generator.s o' (mach-o file, but is an incompatible architecture (have (arm64), need (x86_64h))) I found the problem may be in the 'generator.so', my Mac chip is Intel, not ARM.

mistricky commented 3 months ago

Thx for your bug report, I'll check as soon

mistricky commented 3 months ago

Hi @JohnWickzzz can you try again with codesnap.nvim the latest version?

JohnWickzzz commented 3 months ago

Sorry, the error still occurred when I intall the latest version.

Failed to source /Users/lee/.local/share/nvim/site/lazy/codesnap.nvim/plugin/codesnap.lua

vim/_editor.lua:0: /Users/lee/.config/nvim/init.lua..nvim_exec2() called at /Users/lee/.config/nvim/init.lua:0../Users/lee/.local/share/nvim/site/lazy/codesnap.nvim/plugin/codesnap.lua: Vim(source):E5113: Err or while calling lua chunk: ...l/share/nvim/site/lazy/codesnap.nvim/plugin/codesnap.lua:1: loop or previous error loading module 'codesnap' stack traceback: ^I[C]: in function 'require' ^I...l/share/nvim/site/lazy/codesnap.nvim/plugin/codesnap.lua:1: in main chunk ^I[C]: in function 'nvim_exec2' ^Ivim/_editor.lua: in function 'cmd' ^I.../share/nvim/site/lazy/lazy.nvim/lua/lazy/core/loader.lua:485: in function <.../share/nvim/site/lazy/lazy.nvim/lua/lazy/core/loader.lua:484> ^I[C]: in function 'xpcall' ^I...al/share/nvim/site/lazy/lazy.nvim/lua/lazy/core/util.lua:113: in function 'try' ^I.../share/nvim/site/lazy/lazy.nvim/lua/lazy/core/loader.lua:484: in function 'source' ^I.../share/nvim/site/lazy/lazy.nvim/lua/lazy/core/loader.lua:443: in function 'source_runtime' ^I.../share/nvim/site/lazy/lazy.nvim/lua/lazy/core/loader.lua:411: in function 'packadd' ^I.../share/nvim/site/lazy/lazy.nvim/lua/lazy/core/loader.lua:135: in function 'startup' ^I.../.local/share/nvim/site/lazy/lazy.nvim/lua/lazy/init.lua:110: in function 'setup' ^I/Users/lee/.config/nvim/lua/core/pack.lua:135: in function 'load_lazy' ^I/Users/lee/.config/nvim/lua/core/pack.lua:138: in main chunk ^I[C]: in function 'require' ^I/Users/lee/.config/nvim/lua/core/init.lua:160: in function 'load_core' ^I/Users/lee/.config/nvim/lua/core/init.lua:170: in main chunk ^I[C]: in function 'require' ^I/Users/lee/.config/nvim/init.lua:2: in main chunk

stacktrace:

mistricky commented 3 months ago

Mac arm arch & Linux x86_64 works fine, I'll check it again

JohnWickzzz commented 3 months ago

Although an error occurred during installation, when I use the command CodeSnap, it successfully generated snapshot and copied. 🤔 And I hava a little question, why give up the past command 'CodeSnapPreviewOn', I think it's very useful, easy to use.

mistricky commented 3 months ago

Before refactor, the snapshot is generated by browser, which means whenever you start an Neovim instance, there will be a WS server running in background to receive messages from the Neovim instance and send messages to the browser. And the browser will parse DOM tree and create a snapshot then copy it into your clipboard, live preview is cool and browser can render beautiful pictures easier than lower graphic API, but it may bring additional performance overhead, and you still need to use your mouse to click the copy button to trigger snapshot action.

After refactor, the snapshot is generated by skia engine(the tiny implementation), and communicate with Neovim via FFI, the snapshot image is just created without starting any web server and browser, this solution will perform better and you don't have to click anything use mouse to take a snapshot (most Neovim user hate that).

The new solution is experimental, I like the live-preview page, and I also like take snapshot just one command, perhaps we can find better solution in the future. And thx for using codesnap.nvim, I'm glad to hear that someone says like some feature of codesnap.nvim :)

jenkinpan commented 3 months ago

I'm using Arch Linux, and Neovim v0.95. The latest version of codesnap still not working. The same problem with @JohnWickzzz. But I can't generate the snapshot.

mistricky commented 3 months ago

@jenkinpan what is arch of your Arch Linux?

mistricky commented 3 months ago

I run codesnap.nvim works fine on my x86_64 Arch Linux, I have updated document, did u forget add make in your package installation config?

{ "mistricky/codesnap.nvim", build = "make", version = "^1" },
jenkinpan commented 3 months ago

I'm also use arch linux, and I add make in it, the config is right. I try to reinstall it after I clean it by using Lazy. but it also remind me there are some mistakes. "mistricky/codesnap.nvim", event = "BufReadPre", build = "make", version = "^1", config = function() require("codesnap").setup({ mac_window_bar = true, opacity = true, watermark = "Code from Jenkin", preview_title = "CodeSnap.nvim", editor_font_family = "Hack", watermark_font_family = "Pacifico", }) end,

mrWinston commented 3 months ago

I got the same issue, running Fedora 39 with nvim version:

$ nvim --version                      
NVIM v0.10.0-dev-77c0d54
Build type: RelWithDebInfo
LuaJIT 2.1.1700008891

and with the following plugin config (with lazy.nvim):

 {
   "mistricky/codesnap.nvim",
   build = "make",
   version = "^1",
   opts = {
     save_path = "~/Pictures/",
   },
 },

I get an error message during the initial installation. After restarting nvim, i can run CodeSnap and CodeSnapSave, but it doesn't do anything, and doesn't print an error message.

Interestingly, the error i see during the installation contains the following line:

vim/_editor.lua:0: /home/maschulz/.config/nvim/init.lua..nvim_exec2() called at /home/[me]/.config/nvim/init.lua:0../home/[me]/.local/share/nvim/lazy/codesnap.nvim/plugin/codesnap.lua: Vim(source):E5113: Error while calling lua chunk: vim/loader.lua:0: /home/[me]/.local/share/nvim/lazy/codesnap.nvim/lua/generator.so: invalid ELF header

Looks like there is something wrong with the generator library. Is there a way to rebuild that locally?

jenkinpan commented 3 months ago

I'm also use arch linux, and I add make in it, the config is right. I try to reinstall it after I clean it by using Lazy. but it also remind me there are some mistakes. "mistricky/codesnap.nvim", event = "BufReadPre", build = "make", version = "^1", config = function() require("codesnap").setup({ mac_window_bar = true, opacity = true, watermark = "Code from Jenkin", preview_title = "CodeSnap.nvim", editor_font_family = "Hack", watermark_font_family = "Pacifico", }) end,

Failed to source `/home/jenkin/.local/share/nvim/lazy/codesnap.nvim/plugin/
codesnap.lua`                                                              

vim/_editor.lua:0: /home/jenkin/.config/nvim/init.lua..nvim_exec2() called 
at /home/jenkin/.config/nvim/init.lua:0../home/jenkin/.local/share/nvim/laz
y/codesnap.nvim/plugin/codesnap.lua: Vim(source):E5113: Error while calling
 lua chunk: ....local/share/nvim/lazy/codesnap.nvim/plugin/codesnap.lua:1: 
loop or previous error loading module 'codesnap'                           
stack traceback:                                                           
^I[C]: in function 'require'                                               
^I....local/share/nvim/lazy/codesnap.nvim/plugin/codesnap.lua:1: in main ch
unk                                                                        
^I[C]: in function 'nvim_exec2'                                            
^Ivim/_editor.lua: in function 'cmd'                                       
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:485: in funct
ion <...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:484>      
^I[C]: in function 'xpcall'                                                
^I.../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:113: in funct
ion 'try'                                                                  
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:484: in funct
ion 'source'                                                               
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:443: in funct
ion 'source_runtime'                                                       
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:411: in funct
ion 'packadd'                                                              
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:135: in funct
ion 'startup'                                                              
^I...enkin/.local/share/nvim/lazy/lazy.nvim/lua/lazy/init.lua:110: in funct
ion 'setup'                                                                
^I/home/jenkin/.config/nvim/init.lua:20: in main chunk                     

# stacktrace:                                                              
  - vim/_editor.lua:0 _in_ **cmd**                                         
  - init.lua:20                 
mistricky commented 3 months ago

Looks like v0.0.1 is not ready for release now, I'll revert codesnap.nvim to 0.0.11

mistricky commented 3 months ago

If anyone has been upgrade codesnap.nvim to v1.0.x, clear cache and reinstall codesnap.nvim will install v0.0.11, and it should be works fine

mistricky commented 3 months ago

This issue is described in v1.0.x, but the version has rolled back to v0.0.11, so closed now.

mistricky commented 3 months ago

CodeSnap v1.0.0 was released, If there are any issues I will reopen this issue

mistricky commented 3 months ago

Looks like there is something wrong with the generator library. Is there a way to rebuild that locally?

@mrWinston The readme was updated, you can follow the latest version of the docs to build codesnap.nvim manually

JohnWickzzz commented 3 months ago

😁 I decide to stay at 0.0.11 version, cause I prefer the CodeSnapPreviewOn command. Thanks for your work!