AstroNvim / astrocommunity

A community repository of common plugin specifications
GNU General Public License v3.0
1.16k stars 236 forks source link

fix(pack): pass `astrolsp.on_attach()` to `moonbit.nvim` #1225

Closed rami3l closed 5 days ago

rami3l commented 5 days ago

📑 Description

After installing the moonbit pack, moonbit-lsp still won't launch properly. This looks like an oversight in #1224. (cc @mehalter)

Tested locally with the following override:

  {
    "tonyfettes/moonbit.nvim",
    opts = function(_, opts)
      -- only enable treesitter if the plugin is available
      if not require("astrocore").is_available("nvim-treesitter") then
        opts.treesitter = { enabled = false }
      end
      -- only enable the LSP if the lsp command is executable
      if vim.fn.executable("moonbit-lsp") == 1 then
        local astrolsp_avail, astrolsp = pcall(require, "astrolsp")
        if astrolsp_avail then
          opts.lsp = astrolsp.lsp_opts("moonbit")
          opts.on_attach = astrolsp.on_attach
        end
      else
        opts.lsp = false
      end
    end,
  },
github-actions[bot] commented 5 days ago

Review Checklist

Does this PR follow the [Contribution Guidelines](development guidelines)? Following is a partial checklist:

Proper conventional commit scoping:

mehalter commented 5 days ago

This is incorrect, sorry!

mehalter commented 5 days ago

There is no opts.on_attach option in moonbit.nvim

mehalter commented 5 days ago

I can confirm with a base installation with just this pack as is the moonbit LSP attached correctly

rami3l commented 5 days ago

There is no opts.on_attach option in moonbit.nvim

That's right, my bad :| Maybe I just forgot to restart Neovim so I might be "solving" an inexistent issue...

Thanks again for the quick response :]