williamboman / mason-lspconfig.nvim

Extension to mason.nvim that makes it easier to use lspconfig with mason.nvim.
Apache License 2.0
2.83k stars 174 forks source link

Clojure-lsp not attaching to clojure buffers. #339

Closed lemonnuggets closed 10 months ago

lemonnuggets commented 10 months ago

Problem description

My setup works fine for other LSPs but just clojure-lsp is never activated when I open a clojure file.

Why do you think this is an issue with mason-lspconfig.nvim?

I made a minimal config to see where the issue could arise from. I'm not too well versed with neovim but the only three dependencies included were mason, nvim-lspconfig and mason-lspconfig. I don't think mason is the issue since as far I understand, its responsibility is installing the lsp which is working as expected. My issue is that the lsp isn't setup properly to attach to the appropriate buffer and I think that's something mason-lspconfig is responsible for. I'm not sure how to validate whether the issue is with mason-lspconfig or nvim-lspconfig so if I'm mistaken by posting this here I apologize for wasting your time.

Neovim version (>= 0.7)

NVIM v0.9.4 Build type: Release LuaJIT 2.1.1702233742

system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

Operating system/version

Linux archlinux 6.6.6-arch1-1 #1 SMP PREEMPT_DYNAMIC Mon, 11 Dec 2023 11:48:23 +0000 x86_64 GNU/Linux

I've manually reviewed the Nvim LPS client log (:LspLog) to find potential errors

I've recently downloaded the latest plugin version of mason.nvim, mason-lspconfig.nvim, and nvim-lspconfig

Affected language servers

clojure_lsp

Steps to reproduce

  1. Use minimal config given below in your init.lua.
    
    vim.g.mapleader = ' '
    vim.g.maplocalleader = ' '

local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' if not vim.loop.fs_stat(lazypath) then vim.fn.system { 'git', 'clone', '--filter=blob:none', 'https://github.com/folke/lazy.nvim.git', '--branch=stable', lazypath, } end vim.opt.rtp:prepend(lazypath)

require('lazy').setup({ { 'neovim/nvim-lspconfig', dependencies = { 'williamboman/mason.nvim', 'williamboman/mason-lspconfig.nvim', }, }, }, {})

local mason = require('mason') local mason_lspconfig = require('mason-lspconfig') mason.setup({ log_level = vim.log.levels.DEBUG }) mason_lspconfig.setup()

local servers = { clojure_lsp = {}, }

mason_lspconfig.setup { ensure_installed = vim.tbl_keys(servers), }

local capabilities = vim.lsp.protocol.make_client_capabilities() local onattach = function(, bufnr) print("attached lsp", bufnr) end local lspconfig = require('lspconfig') mason_lspconfig.setup_handlers({ function(server_name) lspconfig[server_name].setup { capabilities = capabilities, on_attach = on_attach, settings = servers[server_name], filetypes = (servers[server_name] or {}).filetypes, } end, })

-- vim: ts=2 sts=2 sw=2 et

2. Open clojure file.
3. Notice how "attached lsp" not printed and :LspInfo shows that 0 lsps are attached to the buffer in which the file is opened.

### Actual behavior

clojure-lsp doesn't attach to the buffer in which the clojure file is opened, seen by how the on_attach handler is never called and :LspInfo shows that no client is attached to the buffer.

### Expected behavior

clojure-lsp should attach to the buffer like any other lsp client.

### LspInfo

```Text
Press q or <Esc> to close this window. Press <Tab> to view server doc.

 Language client log: /home/adam/.local/state/nvim/lsp.log
 Detected filetype:   clojure

 0 client(s) attached to this buffer: 

 Other clients that match the filetype: clojure

 Config: clojure_lsp
    filetypes:         clojure, edn
    root directory:    Not found.
    cmd:               /home/adam/.local/share/nvim/mason/bin/clojure-lsp
    cmd is executable: true
    autostart:         true
    custom handlers:   

 Configured servers list: lua_ls, clangd, gopls, pyright, html, clojure_lsp, tsserver, emmet_language_server

LspLog

No logs showing up for when I open a clojure file.

Healthcheck

==============================================================================
mason: require("mason.health").check()

mason.nvim ~
- OK mason.nvim version v1.8.3
- OK PATH: prepend
- OK Providers: 
  mason.providers.registry-api
  mason.providers.client
- OK neovim version >= 0.7.0

mason.nvim [Registries] ~
- OK Registry `github.com/mason-org/mason-registry version: 2023-12-15-rude-orchid` is installed.

mason.nvim [Core utils] ~
- OK unzip: `UnZip 6.00 of 20 April 2009, by Info-ZIP.  Maintained by C. Spieler.  Send`
- OK wget: `GNU Wget 1.21.4 built on linux-gnu.`
- OK curl: `curl 8.5.0 (x86_64-pc-linux-gnu) libcurl/8.5.0 OpenSSL/3.1.4 zlib/1.3 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.4 libpsl/0.21.2 (+libidn2/2.3.4) libssh2/1.11.0 nghttp2/1.58.0`
- OK gzip: `gzip 1.13`
- OK tar: `tar (GNU tar) 1.35`
- OK bash: `GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu)`
- OK sh: `Ok`

mason.nvim [Languages] ~
- WARNING cargo: not available
  - ADVICE:
    - spawn: cargo failed with exit code - and signal -. cargo is not executable
- WARNING Composer: not available
  - ADVICE:
    - spawn: composer failed with exit code - and signal -. composer is not executable
- WARNING PHP: not available
  - ADVICE:
    - spawn: php failed with exit code - and signal -. php is not executable
- WARNING luarocks: not available
  - ADVICE:
    - spawn: luarocks failed with exit code - and signal -. luarocks is not executable
- WARNING Ruby: not available
  - ADVICE:
    - spawn: ruby failed with exit code - and signal -. ruby is not executable
- WARNING RubyGem: not available
  - ADVICE:
    - spawn: gem failed with exit code - and signal -. gem is not executable
- OK Go: `go version go1.21.5 linux/amd64`
- WARNING julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. julia is not executable
- OK node: `v18.18.2`
- OK python: `Python 3.11.6`
- WARNING pip: not available
  - ADVICE:
    - spawn: python3 failed with exit code 1 and signal 0. /usr/bin/python3: No module named pip

- OK java: `openjdk version "21" 2023-09-19`
- OK python venv: `Ok`
- OK javac: `javac 21`
- OK npm: `9.8.1`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 0. Remaining: 5000. Limit: 5000. Reset: Fri 15 Dec 2023 03:57:56 PM IST.

Screenshots or recordings

No response

lemonnuggets commented 10 months ago

Just removed mason-lspconfig and the issue still peristed so i'm going to close this issue and instead create an issue with nvim-lspconfig.