Skip to content

How to start/restart the LSP server after manual LspStop #56

@madsamjp

Description

@madsamjp

Not really an issue, more of a question. If I stop the LSP server with LspStop, then later try to start it again with LspRestart/LspStart, nothing happens. I'm guessing this is because lze isn't being triggered.

I've tried modifying my config to start with cmd = {"LspStart"} but this doesn't work:

require("lze").register_handlers(require("lzextras").lsp)
require("lze").load({
  {
    "nvim-lspconfig",
    lsp = function(plugin)
      vim.lsp.config(plugin.name, plugin.lsp or {})
      vim.lsp.enable(plugin.name)
    end,
    before = function()
      local capabilities = require("cmp_nvim_lsp").default_capabilities()
      vim.lsp.config("*", {
        capabilities = capabilities,
        on_attach = function()
          require("config.lsp.on_attach")
        end,
      })
    end,
  },
  {
    "lua_ls",
    cmd = { "LspStart" },
    lsp = {
      filetypes = { "lua" },

-- ... rest of code

What would be the correct way to lazily restart/start the language server?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions