Skip to content

[BUG] Lsp server terminated immediately after launchΒ #145

@hek14

Description

@hek14

I am tyring to use distant.nvim for remote work. It is a really nice plugin. But there is an issue in my setup: after I DistantOpen /path/to/server/file.py, I can see some diagnostic show up but the server is terminated quickly, I check the distant.log, which says that ".../nvim-data/lazy/distant.nvim/lua/distant-core/client.lua:195: Client terminated: "INVALID_SERVER_JSON"".

commands that I use:

  • DistantLaunch ssh://USER@SERVER_IP:PORT
  • DistantOpen /path/to/server/file.py

Related:

  • platform: I have tried on windows/mac as local machine, and linux as remote machine. Both has the same issue.
  • distant version: 0.20.0, I also tried 0.20.0-alpha.10, the same issue.
  • distant.nvim version: v0.3
  • lsp server: pyright/clangd (both of them failed with the same problem)
  • distant.nvim config:
            require('distant'):setup(
              {
                  servers = {
                      ['SERVER_IP'] = {
                          lsp = {
                              ['/home/project'] = {
                                  -- cmd = {'/usr/bin/pyright-langserver', '--stdio'}, -- I have tried both of the two "cmd"
                                  cmd = '/usr/bin/pyright-langserver --stdio',
                                  root_dir = '/home/project/',
                                  settings = {
                                      {
                                          python = {
                                              analysis = {
                                                  autoSearchPaths = true,
                                                  diagnosticMode = "openFilesOnly",
                                                  useLibraryCodeForTypes = true
                                              }
                                          }
                                      }
                                  },
                                  single_file_support = true,
                                  file_types = {'python'},
                                  on_exit = function(code, signal, client_id)
                                      local prefix = '[Client ' .. tostring(client_id) .. ']'
                                      print(prefix .. ' LSP exited with code ' .. tostring(code))

                                      -- Signal can be nil
                                      if signal ~= nil then
                                          print(prefix .. ' Signal ' .. tostring(signal))
                                      end
                                  end,
                              }
                          }
                      }
                  }
              } 
             )

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