Olical / conjure

Interactive evaluation for Neovim (Clojure, Fennel, Janet, Racket, Hy, MIT Scheme, Guile, Python and more!)
https://conjure.oli.me.uk
The Unlicense
1.79k stars 110 forks source link

Conjure throws error new Buffer #582

Closed mo-shaz closed 5 months ago

mo-shaz commented 5 months ago

Summary

From today, when opening any CLJ file, Conjure seems to throw the following error. But, there seems to be no update from Conjure since the last two weeks and I haven't made any major changes to my config.

image

Only issue is this error on the new buffer, everything else seems to work fine.

Steps to reproduce

  1. open Neovim
  2. open any .clj file
Olical commented 5 months ago

Sorry about the issue! Could you share which Neovim version you're using and the full error which should be visible in your notifications or messages. That screenshot is cutting off the right hand side of the first line which I think is where the failing function is actually listed.

The rest of that error is the stack above the failure which doesn't narrow it down too much.

I released changes yesterday (see release notes for the full list) which included turning off diagnostics in the log buffer since I had so many people asking how they could remove them, so I made it part of the configuration.

My guess is that the LSP method I'm calling either doesn't exist in your Neovim version (they change method names quite a lot which I keep on top of but sometimes miss backwards compatibility with old method names in older Neovim versions) or you've disabled something that I thought always existed.

Either way, I think I need to wrap one of my new function calls in a guard to prevent some users from seeing this error.

The changes had been used by a few people on the develop branch including myself for a couple of weeks so it must be something slightly rare πŸ€”

Do you use LSP and diagnostics normally? Or tree sitter?

On Tue, 18 Jun 2024, 08:35 Mohammed Shaz, @.***> wrote:

Summary

From today, when opening any CLJ file, Conjure seems to throw the following error. But, there seems to be no update from Conjure since the last two weeks and I haven't made any major changes to my config.

image.png (view on web) https://github.com/Olical/conjure/assets/81179191/ad91831c-41f4-4714-9901-c5dc1bf5aaa8

Only issue is this error on the new buffer, everything else seems to work fine. Steps to reproduce

  1. open Neovim
  2. open any .clj file

β€” Reply to this email directly, view it on GitHub https://github.com/Olical/conjure/issues/582, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACM6XPEMEIUKF7BJ43ILBLZH7PMRAVCNFSM6AAAAABJPOBVOCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGM2TSMJVHEYDEMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

mo-shaz commented 5 months ago

Sorry for the bad screenshot and late response 😬

I do use LSP and diagnostics which is installed via Mason. But I think Treesitter is also configured and running. I really have no clear idea how these things work πŸ˜…

practicalli-johnny commented 5 months ago

I cannot replicate this issue myself, using the latest conjure on master with Neovim 0.10.0. There may be some API changes between 0.9.x and 0.10.0 that cause the issue.

I will do a test later today using Termux as that only has Neovim 0.9.5

I opend Neovim with a README.md from a Clojure project and then opened a *.clj file from the project.

    ● conjure 18.48ms ο€– clojure
        dir     /Users/johnny/.local/share/nvim-astro/lazy/conjure
        url     https://github.com/Olical/conjure
        version 4.52.0
        tag     v4.52.0
        branch  master
        commit  9346878

I am using AstroNvim 4 with the Practicalli Astro configuration which uses Lazy package manager.
This config includes Clojure LSP installed by Mason.
nvim-treesitter is part of the configuration along with nvim-treesitter-sexp plugin and the Treesitter parser for Clojure.

Tested using Neovim 0.10.0 release on Linux and MacOSX.

NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713484068
practicalli-johnny commented 5 months ago

I can replicate the issue in part on Neovim 0.9.5 on Termux (linux-android). The Clojure file does open correctly, but the LSP server seems to fail.

NVIM v0.9.5 Build type: Release LuaJIT 2.1.1716656478

β”‚Error executing vim.schedule lua callback: ...ocal/share/astroβ”‚
β”‚stack traceback:                                              β”‚
β”‚  [C]: in function 'new_buf_fn'                               β”‚
β”‚  ...ocal/share/astronvim/lazy/conjure/lua/conjure/buffer.lua:β”‚
β”‚  .../.local/share/astronvim/lazy/conjure/lua/conjure/log.lua:β”‚
β”‚  ...lazy/conjure/lua/conjure/client/clojure/nrepl/server.lua:β”‚
β”‚  vim/_editor.lua:263: in function <vim/_editor.lua:262>
Akeboshiwind commented 5 months ago

I'm pretty sure this is a problem due to a breaking change in nvim 0.10 for the signature of vim.diagnostic.enable.

The signature seems to have changed from: enable({bufnr}, {namespace}) to enable({enable}, {filter}).

Conjure uses the new signature which is incompatible with the old signature that 0.9 and below use.

mo-shaz commented 5 months ago

I'm pretty sure this is a problem due to a breaking change in nvim 0.10 for the signature of vim.diagnostic.enable.

The signature seems to have changed from: enable({bufnr}, {namespace}) to enable({enable}, {filter}).

Conjure uses the new signature which is incompatible with the old signature that 0.9 and below use.

Yes, it is. I updated my NVIM version to 0.10.0 and no more errors. Thanks for the quick resolution @Akeboshiwind @practicalli-johnny @Olical πŸš€ ❀️

Olical commented 5 months ago

Going to reopen this for now because really we should support older versions for a while at least. I should've caught this one already and I'm surprised my test suite didn't! It runs it under older versions to catch things like this. Or it should be...

Olical commented 5 months ago

Pushed a change to develop that adds

    (if (= 1 (vim.fn.has "nvim-0.10"))
      (vim.diagnostic.enable false {:bufnr buf})
      (vim.diagnostic.disable buf)))

Looks a bit awkward but does the trick.

Olical commented 5 months ago

If someone on Neovim < 0.10 can confirm this too, I'll mark this as complete and release it. It works fine for me now but a 3rd party too would be great!

mo-shaz commented 5 months ago

If someone on Neovim < 0.10 can confirm this too, I'll mark this as complete and release it. It works fine for me now but a 3rd party too would be great!

I can test it out via bob.nvim manager 😁 Should I explicitly mention the branch in Lazy config?

Olical commented 5 months ago

Yep, you'll have to swap to the develop branch with your plugin manager.

On Thu, 20 Jun 2024, 12:23 Mohammed Shaz, @.***> wrote:

If someone on Neovim < 0.10 can confirm this too, I'll mark this as complete and release it. It works fine for me now but a 3rd party too would be great!

I can test it out via bob.nvim manager 😁 Should I explicitly mention the branch in Lazy config?

β€” Reply to this email directly, view it on GitHub https://github.com/Olical/conjure/issues/582#issuecomment-2180436124, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACM6XMHYQ3IZFH5KOBIIITZIK3TRAVCNFSM6AAAAABJPOBVOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBQGQZTMMJSGQ . You are receiving this because you modified the open/close state.Message ID: @.***>

mo-shaz commented 5 months ago

Yep, you'll have to swap to the develop branch with your plugin manager.

I can confirm it works for NVIM version < 0.10.0 now. image

Nvim Version tested:

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1692716794