liquidz / vim-iced

Clojure Interactive Development Environment for Vim8/Neovim
https://liquidz.github.io/vim-iced/
MIT License
518 stars 35 forks source link

How to disable LSP in iced_stdout - QUESTION #382

Open sittim opened 2 years ago

sittim commented 2 years ago

My iced_stdout window gets lots of errors any way to disable clojure-ls/vim-lsp in the iced_stdout window?

image

liquidz commented 2 years ago

@sittim Thanks for your reporting!

Are you sure that you are using vim-iced v3.7.0 or earlier? This problem should have been fixed with v3.7.1. https://github.com/liquidz/vim-iced/blob/main/CHANGELOG.adoc#371-2021-12-12

sittim commented 2 years ago

@liquidz, here is my version:

image

image

It gets upgraded through :PlugUpdate command.

liquidz commented 2 years ago

@sittim Thanks! Hmm.. just to clarify, is vim-lsp the latest? vim-iced is using this flag. https://github.com/prabirshrestha/vim-lsp/pull/983

sittim commented 2 years ago

OK, per installation instruction, the executable folder for vim-iced is in ~/.vim/plugged folder. I had both VIM and NeoVIM installed. Both installations had vim-iced. I was not updating the ~/.vim/plugged folder, but instead I was updating the ~/.config/neovim/plugged folder. I removed the older installation, the ~/.vim/plugged/vim-iced folder and now it looks better except the first line: image

sittim commented 2 years ago

As far as LSP, I keep it fresh, almost daily.

liquidz commented 2 years ago

@sittim Thanks for your confirmation! I couldn't reproduce the problem vim(8.2.4118) and nvim(0.6.1) in my environment...

But may this hook help you?

call iced#hook#add('connected', {
      \ 'type': 'function',
      \ 'exec': {_ -> lsp#disable_diagnostics_for_buffer(bufnr('iced_stdout'))},
      \ })
sittim commented 2 years ago

I get this when I use these lines:

2022-01-20T11:40:46.911Z MuellerITs-MacBook-Pro.local DEBUG [com.zaxxer.hikari.pool.HikariPool:521] - HikariPool-1 - Fill pool skipped, pool has sufficient level or currently being filled (queueDepth=0.
Exception in thread "nREPL-session-c822c60d-3927-484a-bb8e-a4e48e4c0bfb" java.net.SocketException: Socket closed
        at java.base/sun.nio.ch.NioSocketImpl.ensureOpenAndConnected(NioSocketImpl.java:165)
        at java.base/sun.nio.ch.NioSocketImpl.beginWrite(NioSocketImpl.java:366)
        at java.base/sun.nio.ch.NioSocketImpl.implWrite(NioSocketImpl.java:411)
        at java.base/sun.nio.ch.NioSocketImpl.write(NioSocketImpl.java:440)
        at java.base/sun.nio.ch.NioSocketImpl$2.write(NioSocketImpl.java:826)
        at java.base/java.net.Socket$SocketOutputStream.write(Socket.java:1035)
        at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81)
        at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142)
        at nrepl.transport$bencode$fn__2328.invoke(transport.clj:131)
        at nrepl.transport.FnTransport.send(transport.clj:34)
        at nrepl.middleware.print$send_nonstreamed.invokeStatic(print.clj:159)
        at nrepl.middleware.print$send_nonstreamed.invoke(print.clj:138)
        at nrepl.middleware.print$printing_transport$reify__2779.send(print.clj:174)
        at nrepl.middleware.caught$caught_transport$reify__2814.send(caught.clj:58)
        at nrepl.middleware.load_file$wrap_load_file$fn$reify__3434.send(load_file.clj:95)
        at nrepl.middleware.interruptible_eval$evaluate$fn__2882.invoke(interruptible_eval.clj:132)
        at clojure.main$repl$fn__9119.invoke(main.clj:460)
        at clojure.main$repl.invokeStatic(main.clj:458)
        at clojure.main$repl.doInvoke(main.clj:368)
        at clojure.lang.RestFn.invoke(RestFn.java:1523)
        at nrepl.middleware.interruptible_eval$evaluate.invokeStatic(interruptible_eval.clj:84)
        at nrepl.middleware.interruptible_eval$evaluate.invoke(interruptible_eval.clj:56)
        at nrepl.middleware.interruptible_eval$interruptible_eval$fn__2890$fn__2894.invoke(interruptible_eval.clj:152)
        at clojure.lang.AFn.run(AFn.java:22)
        at nrepl.middleware.session$session_exec$main_loop__2960$fn__2964.invoke(session.clj:218)
        at nrepl.middleware.session$session_exec$main_loop__2960.invoke(session.clj:217)
        at clojure.lang.AFn.run(AFn.java:22)
        at java.base/java.lang.Thread.run(Thread.java:833)
liquidz commented 2 years ago

when I use these lines

What lines? The following lines?

call iced#hook#add('connected', {
      \ 'type': 'function',
      \ 'exec': {_ -> lsp#disable_diagnostics_for_buffer(bufnr('iced_stdout'))},
      \ })

The above code don't affect to REPL, so the exception should be another problem. Please open another issue with concrete steps to reproduce.

heralden commented 1 year ago

I have the same problem getting rid of Can't parse [...]/iced_stdout, No matching clause: :unknown. Adding call iced#hook#add[...] to my init.vim makes the REPL throw the error Exception in thread "nREPL-session-2eb02a74-6016-4c3e-8e9c-8f8b7c0b9b2f" java.net.SocketException: Socket closed after I do <Plug>(iced_connect) using the hotkey. I also get:

Connected.
Unexpected error: Vim(return):E117: Unknown function: lsp#disable_diagnostics_for_buffer
Disconnected.
Press ENTER or type command to continue

This is using NVIM v0.8.0 and its built-in lsp. So it doesn't seem to have that function, so I've been trying to rewrite it

call iced#hook#add('connected', {
      \ 'type': 'command',
      \ 'exec': 'lua vim.diagnostic.disable(vim.api.nvim_buf_get_number("iced_stdout"))',
      \ })

but unfortunately I can't figure out how to get the buffer number by using a name, like you can with vimscript's bufnr and I can't find a vimscript function to do this, hence having to use lua.

heralden commented 1 year ago

I got the genius (ugly) idea of using interop, so I got something that works:

call iced#hook#add('connected', {
      \ 'type': 'command',
      \ 'exec': 'lua vim.diagnostic.disable(tonumber(vim.api.nvim_command_output("echo bufnr(\"iced_stdout\")")))',
      \ })
liquidz commented 1 year ago

@heralden It seems supporting lua type for hook will be useful for neovim :)

liquidz commented 1 year ago

Lua function seems to be callable from vimscript in neovim. @heralden How about the following?

lua <<EOC
  vim.fn['iced#hook#add']('connected', {
    type = "function",
    exec = function()
      vim.diagnostic.disable(vim.fn.bufnr("iced_stdout"))
    end
  })
EOC
heralden commented 1 year ago

Thanks! That's much cleaner 🙂