codesnap.nvim icon indicating copy to clipboard operation
codesnap.nvim copied to clipboard

Crashing when run on not popular languages (e.g. gleam)

Open wczyz opened this issue 1 year ago • 5 comments

  1. Create main.gleam file
  2. Fill it with:
pub fn main() {
    
}
  1. Save file
  2. Select all lines and do :CodeSnap
  3. Crashes with:
thread '<unnamed>' panicked at library/core/src/panicking.rs:221:5:                                                                                                                                                                                            
panic in a function that cannot unwind                                                                                                                                                      
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace                                                                         
unwinding panic. aborting.      
  • Works for other languages: C++, Python
  • Using packer
  • Compiled from source
  • Arch-linux

wczyz avatar Oct 10 '24 19:10 wczyz

I came here specifically to also ask for Gleam support. It's a pretty language to share!

VoxelMC avatar Oct 16 '24 09:10 VoxelMC

I'll take a closer look asap, but for now, here's what I found:

  • Gleam is not yet handled by syntect (and adding support for new langs seems to be tricky): https://github.com/trishume/syntect/issues/168
  • the way the syntax detection is done, might lead to a panic: https://github.com/mistricky/codesnap.nvim/blob/6400480aa6cc366cbd931146c429aaa64680dab9/generator/src/highlight.rs#L44-L66

rbobillot avatar Dec 21 '24 03:12 rbobillot

Have the same issue with GDscript

TrickyFatCat avatar Jan 10 '25 21:01 TrickyFatCat

Same issue with python, not working here.

FelipeMarcelino avatar Jan 16 '25 02:01 FelipeMarcelino

@wczyz Codesnap.nvim v2.0.0-beta.17 has been released. Could you test whether everything works correctly on beta 17? This version introduces some breaking changes, so it's best to completely uninstall your previous Codesnap.nvim installation and follow the v2 README

mistricky avatar Nov 19 '25 04:11 mistricky