benknoble / vim-racket

vim bundle for Racket
MIT License
24 stars 4 forks source link

Fix error: access to unitialized variable when vim9script unavailable… #12

Closed elloskelling closed 7 months ago

elloskelling commented 7 months ago

… (e.g. nvim)

lispoptions only got initialized when vim9script, but later accessed indiscriminately

benknoble commented 7 months ago

I have a different patch in mind that would conditionally reset lispoptions, but I don't think it's "uninitialized", and I don't think :setlocal lispoptions< should be able to fail. I'll try to double-check with a Vim without vim9script and confirm the semantics of :set-<, though.

elloskelling commented 7 months ago

Hey, thanks for the fast response! Here is what I saw: On nvim 0.7.2 that line errors out if it includes lispoptions< and it evaluates fine without it. On vim 9.0, both main and my branch work fine. When I grep for lispoptions in main, I only see two occurrences of it, both in that file. The first one is inside the hasvim9 block. The second one wasn't and was causing the error so my naive solution is to make them consistent.

benknoble commented 7 months ago

Here's what I'm suggesting: that's a bug in neovim. Why? Open a fresh Vim instance and do :setlocal lispoptions<. Now do the same in neovim. In Vim, that succeeds just fine (regardless of whether I have previously :setlocal lispoptions…). That it fails in neovim should be considered an error.

I'll push a fix for this anyway.

elloskelling commented 7 months ago

Thanks!