emacs-lsp / lsp-haskell

lsp-mode :heart: haskell
https://emacs-lsp.github.io/lsp-haskell
GNU General Public License v3.0
227 stars 56 forks source link

Trouble Running lsp-haskell remotely over tramp #121

Closed georgewsinger closed 3 years ago

georgewsinger commented 3 years ago

Problem

Though I am able to run lsp-haskell just fine when editing local Haskell projects, I am unable to get it working when editing remote Haskell files. I am able to run lsp-mode remote remotely in C/C++ projects though, so I included my configuration for lsp-mode below as well for comparison. The most useful log (presented below) can be found in:

$ cat /tmp/lsp-haskell-remote-1-stderr 
error: unrecognised flag '--lsp'
Try '/home/user/.nix-profile/bin/nix-shell --help' for more information.

Context & Details

Binaries. On both my remote and local machine, I have ~/.cabal/bin/haskell-language-server and ~/.cabal/bin/haskell-language-server-wrapper.

Configuration. I am using the following configuration (note in particular the call to (lsp-register-client (make-list--client ... :remote? t ...)).

(defun dotspacemacs/layers ()
  (setq-default
     ;; ...
     lsp
     (haskell :variables haskell-completion-backend 'lsp) ; formerly dante
     ;; ... 
))

(use-package lsp-mode
    :commands lsp
    :hook (haskell-mode . lsp)
    :commands lsp
    :config
    (progn
      (setq lsp-flycheck-live-reporting nil) ;; !
      (setq lsp-ui-doc-enable nil)
      (spacemacs/set-leader-keys "eb" (lambda () (interactive)
                                        (flycheck-buffer)
                                        (lsp-ui-doc-glance)))
      (add-hook 'prog-mode-hook #'lsp)
      (lsp-register-client
       (make-lsp-client :new-connection (lsp-tramp-connection
                                         "/home/user/.nix-profile/bin/clangd")
                        :major-modes '(c-mode c++-mode)
                        :remote? t
                        :server-id 'clangd-remote))))

  (use-package lsp-haskell
    :ensure t
    :config
    (progn
      (setq lsp-haskell-server-args '("-d" "-l" "/tmp/hie.log"))

      (setq lsp-haskell-server-path "/home/user/.cabal/bin/haskell-language-server")
      (setq lsp-haskell-server-wrapper-function (lambda (argv)
                                                  (append
                                                    (append (list "/home/user/.nix-profile/bin/nix-shell" "--attr" "env" "--command" )
                                                            (list (mapconcat 'identity argv " "))
                                                            )
                                                    ;(list (concat (lsp-haskell--get-root) "shell.nix"))
                                                    )
                                                  ))

      (setq lsp-log-io t)

      (lsp-register-client
        (make-lsp--client
          :new-connection (lsp-tramp-connection (lambda () (lsp-haskell--server-command)))
          :major-modes '(haskell-mode haskell-literate-mode)
          :server-id 'lsp-haskell-remote
          :initialized-fn (lambda (workspace)
                            (with-lsp-workspace workspace
                              (lsp--set-configuration (lsp-configuration-section "haskell"))))
          :language-id "haskell"
          :completion-in-comments? t
          :remote? t)))))

Notice also the absolute paths being used for haskell-language-server (and clangd). I noticed that for C/C++ projects, I could only get remote lsp-mode to work by using absolute paths, so I carried this over to lsp-haskell.

lsp versions. Running

cd ~/.emacs.d/elpa
find . -type d -name "*lsp*"

yields

./develop/lsp-python-ms-20200223.2136
./develop/helm-lsp-20200103.1659
./develop/lsp-treemacs-20200220.534
./develop/company-lsp-20190612.1553
./develop/lsp-mode-20200330.2126
./develop/lsp-ui-20200311.1837
./develop/lsp-haskell-20210209.2150

logs. After launching a remote Haskell file, I get the following logs in various buffers

  1. *Messages*

    LSP :: Sending to process failed with the following error: Process lsp-haskell-remote not running
    Reading Haskell configuration failed with exit code 1 and output:
    get-cabal-configuration.hs: dieVerbatim: user error (get-cabal-configuration.hs: Error Parsing: file
    "/ssh:user@192.168.0.53#22:/home/user/SimulaDev/addons/godot-haskell-plugin/godot-haskell-plugin.cabal"
    doesn't exist. Cannot continue.
    )
    
    LSP :: Connected to [lsp-haskell-remote:13796 status:starting].
    Reading Haskell configuration failed with exit code 1 and output:
    get-cabal-configuration.hs: dieVerbatim: user error (get-cabal-configuration.hs: Error Parsing: file
    "/ssh:user@192.168.0.53#22:/home/user/SimulaDev/addons/godot-haskell-plugin/godot-haskell-plugin.cabal"
    doesn't exist. Cannot continue.
    )
    
    LSP :: Connected to [lsp-haskell-remote:13796 status:starting].
    Reading Haskell configuration failed with exit code 1 and output:
    get-cabal-configuration.hs: dieVerbatim: user error (get-cabal-configuration.hs: Error Parsing: file
    "/ssh:user@192.168.0.53#22:/home/user/SimulaDev/addons/godot-haskell-plugin/godot-haskell-plugin.cabal"
    doesn't exist. Cannot continue.
    )
    
    LSP :: Connected to [lsp-haskell-remote:13796 status:starting].
    
    LSP :: Connected to [lsp-haskell-remote:13796 status:starting].
    LSP :: lsp-haskell-remote has exited (exited abnormally with code 1)
    Server lsp-haskell-remote:13796 status:starting exited with status exit. Do you want to restart it? (y or n) n
  2. *lsp-log*

    Command "/home/user/.nix-profile/bin/nix-shell --attr env --command /home/user/.cabal/bin/haskell-language-server --lsp -d -l /tmp/hie.log /home/user/SimulaDev/addons/godot-haskell-plugin/shell.nix" is present on the path.
    Command "/home/user/.nix-profile/bin/nix-shell --attr env --command /home/user/.cabal/bin/haskell-language-server --lsp -d -l /tmp/hie.log /home/user/SimulaDev/addons/godot-haskell-plugin/shell.nix" is present on the path.
    Found the following clients for /ssh:user@192.168.0.53#22:/home/user/SimulaDev/addons/godot-haskell-plugin/src/Plugin/SimulaViewSprite.hs: (server-id lsp-haskell-remote, priority 0)
    The following clients were selected based on priority: (server-id lsp-haskell-remote, priority 0)
    Command "/home/user/.nix-profile/bin/nix-shell --attr env --command /home/user/.cabal/bin/haskell-language-server --lsp -d -l /tmp/hie.log /home/user/SimulaDev/addons/godot-haskell-plugin/shell.nix" is present on the path.
    Command "/home/user/.nix-profile/bin/nix-shell --attr env --command /home/user/.cabal/bin/haskell-language-server --lsp -d -l /tmp/hie.log /home/user/SimulaDev/addons/godot-haskell-plugin/shell.nix" is present on the path.
    Found the following clients for /ssh:user@192.168.0.53#22:/home/user/SimulaDev/addons/godot-haskell-plugin/src/Plugin/SimulaViewSprite.hs: (server-id lsp-haskell-remote, priority 0)
    The following clients were selected based on priority: (server-id lsp-haskell-remote, priority 0)
    Command "/home/user/.nix-profile/bin/nix-shell --attr env --command /home/user/.cabal/bin/haskell-language-server --lsp -d -l /tmp/hie.log /home/user/SimulaDev/addons/godot-haskell-plugin/shell.nix" is present on the path.
    Command "/home/user/.nix-profile/bin/nix-shell --attr env --command /home/user/.cabal/bin/haskell-language-server --lsp -d -l /tmp/hie.log /home/user/SimulaDev/addons/godot-haskell-plugin/shell.nix" is present on the path.
    Found the following clients for /ssh:user@192.168.0.53#22:/home/user/SimulaDev/addons/godot-haskell-plugin/src/Plugin/SimulaViewSprite.hs: (server-id lsp-haskell-remote, priority 0)
    The following clients were selected based on priority: (server-id lsp-haskell-remote, priority 0)
  3. *lsp-haskell-remote* This is just an empty buffer, but it does get created.

  4. *lsp-log: lsp-haskell-remote:13796* Note that the file I attempted to open on my remote machine is /home/user/SimulaDev/addons/godot-haskell-plugin/src/Plugin/SimulaViewSprite.hs; the root of this haskell project is /home/user/SimulaDev/addons/godot-haskell-plugin:

    [Trace - 11:06:38 AM] Sending request 'initialize - (1)'.
    Params: {
      "processId": null,
      "rootPath": "/home/user/SimulaDev/addons/godot-haskell-plugin",
      "clientInfo": {
        "name": "emacs",
        "version": "GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20)"
      },
      "rootUri": "file:///home/user/SimulaDev/addons/godot-haskell-plugin",
      "capabilities": {
        "workspace": {
          "workspaceEdit": {
            "documentChanges": true,
            "resourceOperations": [
              "create",
              "rename",
              "delete"
            ]
          },
          "applyEdit": true,
          "symbol": {
            "symbolKind": {
              "valueSet": [
                1,
                2,
                3,
                4,
                5,
                6,
                7,
                8,
                9,
                10,
                11,
                12,
                13,
                14,
                15,
                16,
                17,
                18,
                19,
                20,
                21,
                22,
                23,
                24,
                25,
                26
              ]
            }
          },
          "executeCommand": {
            "dynamicRegistration": false
          },
          "didChangeWatchedFiles": {
            "dynamicRegistration": true
          },
          "workspaceFolders": true,
          "configuration": true
        },
        "textDocument": {
          "declaration": {
            "linkSupport": true
          },
          "definition": {
            "linkSupport": true
          },
          "implementation": {
            "linkSupport": true
          },
          "typeDefinition": {
            "linkSupport": true
          },
          "synchronization": {
            "willSave": true,
            "didSave": true,
            "willSaveWaitUntil": true
          },
          "documentSymbol": {
            "symbolKind": {
              "valueSet": [
                1,
                2,
                3,
                4,
                5,
                6,
                7,
                8,
                9,
                10,
                11,
                12,
                13,
                14,
                15,
                16,
                17,
                18,
                19,
                20,
                21,
                22,
                23,
                24,
                25,
                26
              ]
            },
            "hierarchicalDocumentSymbolSupport": true
          },
          "formatting": {
            "dynamicRegistration": true
          },
          "rangeFormatting": {
            "dynamicRegistration": true
          },
          "rename": {
            "dynamicRegistration": true,
            "prepareSupport": true
          },
          "semanticHighlightingCapabilities": {
            "semanticHighlighting": false
          },
          "codeAction": {
            "dynamicRegistration": true,
            "isPreferredSupport": true,
            "codeActionLiteralSupport": {
              "codeActionKind": {
                "valueSet": [
                  "",
                  "quickfix",
                  "refactor",
                  "refactor.extract",
                  "refactor.inline",
                  "refactor.rewrite",
                  "source",
                  "source.organizeImports"
                ]
              }
            }
          },
          "completion": {
            "completionItem": {
              "snippetSupport": true,
              "documentationFormat": [
                "markdown"
              ]
            },
            "contextSupport": true
          },
          "signatureHelp": {
            "signatureInformation": {
              "parameterInformation": {
                "labelOffsetSupport": true
              }
            }
          },
          "documentLink": {
            "dynamicRegistration": true,
            "tooltipSupport": true
          },
          "hover": {
            "contentFormat": [
              "markdown",
              "plaintext"
            ]
          },
          "foldingRange": {
            "dynamicRegistration": true,
            "rangeLimit": null,
            "lineFoldingOnly": false
          },
          "callHierarchy": {
            "dynamicRegistration": false
          },
          "publishDiagnostics": {
            "relatedInformation": true,
            "tagSupport": {
              "valueSet": [
                1,
                2
              ]
            },
            "versionSupport": true
          }
        },
        "window": {
          "workDoneProgress": true
        }
      },
      "initializationOptions": null,
      "workDoneToken": "1"
    }
  5. /tmp/lsp-haskell-remote-1-stderr Inspecting this file yields the most helpful log:

    $ cat /tmp/lsp-haskell-remote-1-stderr error: unrecognised flag '--lsp' Try '/home/user/.nix-profile/bin/nix-shell --help' for more information.

michaelpj commented 3 years ago

Unfortunately, I haven't used the TRAMP support at all. I don't think there's anything special that lsp-haskell in particular does here.

Here are some guesses:

$ cat /tmp/lsp-haskell-remote-1-stderr error: unrecognised flag '--lsp' Try '/home/user/.nix-profile/bin/nix-shell --help' for more information.

Given the last line, it looks like the error your getting is from nix-shell, not from haskell-language-server. So I suspect something is up with your lsp-haskell-server-wrapper-function - in fact, I'm not sure you want this at all, given that you've put the binaries on the server yourself.

LSP :: Sending to process failed with the following error: Process lsp-haskell-remote not running Reading Haskell configuration failed with exit code 1 and output: get-cabal-configuration.hs: dieVerbatim: user error (get-cabal-configuration.hs: Error Parsing: file "/ssh:user@192.168.0.53#22:/home/user/SimulaDev/addons/godot-haskell-plugin/godot-haskell-plugin.cabal" doesn't exist. Cannot continue.

This also seems significant, but I have no idea where it's coming from.

georgewsinger commented 3 years ago

@michaelpj Thanks for your help.

I suspect something is up with your lsp-haskell-server-wrapper-function - in fact, I'm not sure you want this at all, given that you've put the binaries on the server yourself.

I think I do need the nix-shell, since cabal commands fail when not ran inside it. Specifically:

without nix shell.

/home/george/.cabal/bin/haskell-language-server -d -l /tmp/hie.log
haskell-language-server version: 1.0.0.0 (GHC: 8.8.4) (PATH: /home/george/.cabal/store/ghc-8.8.4/haskell-language-server-1.0.0.0-e-haskell-language-server-f6b6d1ad3ce833149648054b1034e15a288572a567d281468de04c500bae8dbe/bin/haskell-language-server)
ghcide setup tester in /home/george/SimulaDev/addons/godot-haskell-plugin.
Report bugs at https://github.com/haskell/haskell-language-server/issues

Step 1/4: Finding files to test in /home/george/SimulaDev/addons/godot-haskell-plugin
Found 20 files

Step 2/4: Looking for hie.yaml files that control setup
Found 1 cradle
  (/home/george/SimulaDev/addons/godot-haskell-plugin/hie.yaml)

Step 3/4: Initializing the IDE

Step 4/4: Type checking the files
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
> Warning: cannot determine version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b :
> ""
> cabal: The program 'ghc' version >=7.0.1 is required but the version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b could
> not be determined.
> 
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
> Warning: cannot determine version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b :
> ""
> cabal: The program 'ghc' version >=7.0.1 is required but the version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b could
> not be determined.
> 
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
> Warning: cannot determine version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b :
> ""
> cabal: The program 'ghc' version >=7.0.1 is required but the version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b could
> not be determined.
> 
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
> Warning: cannot determine version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b :
> ""
> cabal: The program 'ghc' version >=7.0.1 is required but the version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b could
> not be determined.
> 
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
> Warning: cannot determine version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b :
> ""
> cabal: The program 'ghc' version >=7.0.1 is required but the version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b could
> not be determined.
> 
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
> Warning: cannot determine version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b :
> ""
> cabal: The program 'ghc' version >=7.0.1 is required but the version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b could
> not be determined.
> 
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
> Warning: cannot determine version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b :
> ""
> cabal: The program 'ghc' version >=7.0.1 is required but the version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b could
> not be determined.
> 
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
> Warning: cannot determine version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b :
> ""
> cabal: The program 'ghc' version >=7.0.1 is required but the version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b could
> not be determined.
> 
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
> Warning: cannot determine version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b :
> ""
> cabal: The program 'ghc' version >=7.0.1 is required but the version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b could
> not be determined.
> 
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
> Warning: cannot determine version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b :
> ""
> cabal: The program 'ghc' version >=7.0.1 is required but the version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b could
> not be determined.
> 
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
> Warning: cannot determine version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b :
> ""
> cabal: The program 'ghc' version >=7.0.1 is required but the version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b could
> not be determined.
> 
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
> Warning: cannot determine version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b :
> ""
> cabal: The program 'ghc' version >=7.0.1 is required but the version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b could
> not be determined.
> 
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
> Warning: cannot determine version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b :
> ""
> cabal: The program 'ghc' version >=7.0.1 is required but the version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b could
> not be determined.
> 
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
> Warning: cannot determine version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b :
> ""
> cabal: The program 'ghc' version >=7.0.1 is required but the version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b could
> not be determined.
> 
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
> Warning: cannot determine version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b :
> ""
> cabal: The program 'ghc' version >=7.0.1 is required but the version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b could
> not be determined.
> 
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
> Warning: cannot determine version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b :
> ""
> cabal: The program 'ghc' version >=7.0.1 is required but the version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b could
> not be determined.
> 
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
> Warning: cannot determine version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b :
> ""
> cabal: The program 'ghc' version >=7.0.1 is required but the version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b could
> not be determined.
> 
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
Files that failed:
 * /home/george/SimulaDev/addons/godot-haskell-plugin/Setup.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/flib/FLib.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/no-telemetry/Telemetry.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/src/Plugin.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/src/Plugin/CanvasBase.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/src/Plugin/CanvasSurface.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/src/Plugin/Debug.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/src/Plugin/Imports.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/src/Plugin/Input.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/src/Plugin/PancakeCamera.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/src/Plugin/Pointer.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/src/Plugin/Simula.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/src/Plugin/SimulaController.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/src/Plugin/SimulaServer.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/src/Plugin/SimulaViewSprite.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/src/Plugin/Types.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/src/Plugin/VR.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/src/Plugin/Input/Grab.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/src/Plugin/Input/Telekinesis.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/telemetry/Telemetry.hs

Completed (0 files worked, 20 files failed)

with nix-shell.

nix-shell --attr env --command "/home/george/.cabal/bin/haskell-language-server -d -l /tmp/hie.log"
haskell-language-server version: 1.0.0.0 (GHC: 8.8.4) (PATH: /home/george/.cabal/store/ghc-8.8.4/haskell-language-server-1.0.0.0-e-haskell-language-server-f6b6d1ad3ce833149648054b1034e15a288572a567d281468de04c500bae8dbe/bin/haskell-language-server)
ghcide setup tester in /home/george/SimulaDev/addons/godot-haskell-plugin.
Report bugs at https://github.com/haskell/haskell-language-server/issues

Step 1/4: Finding files to test in /home/george/SimulaDev/addons/godot-haskell-plugin
Found 20 files

Step 2/4: Looking for hie.yaml files that control setup
Found 1 cradle
  (/home/george/SimulaDev/addons/godot-haskell-plugin/hie.yaml)

Step 3/4: Initializing the IDE

Step 4/4: Type checking the files
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
> Build profile: -w ghc-8.8.4 -O1
> In order, the following will be built (use -v for more details):
>  - godot-haskell-plugin-0.1.0.0 (lib) (first run)
> Preprocessing library for godot-haskell-plugin-0.1.0.0..
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
Files that failed:
 * /home/george/SimulaDev/addons/godot-haskell-plugin/Setup.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/flib/FLib.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/no-telemetry/Telemetry.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/src/Plugin.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/src/Plugin/Simula.hs
 * /home/george/SimulaDev/addons/godot-haskell-plugin/src/Plugin/VR.hs

Completed (14 files worked, 6 files failed)
georgewsinger commented 3 years ago

As a test, I went ahead and set lsp-haskell-server-wrapper-function back to 'identity, and now I get much further (though I don't understand how, given the logs above?). In any event, on the remote machine:

cat /tmp/lsp-haskell-remote-2-stderr
haskell-language-server version: 1.0.0.0 (GHC: 8.8.4) (PATH: /home/george/.cabal/store/ghc-8.8.4/haskell-language-server-1.0.0.0-e-haskell-language-server-f6b6d1ad3ce833149648054b1034e15a288572a567d281468de04c500bae8dbe/bin/haskell-language-server)
Starting (haskell-language-server)LSP server...
  with arguments: LspArguments {argLSP = True, argsCwd = Nothing, argFiles = [], argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = True, argsLogFile = Just "/tmp/hie.log", argsThreads = 0, argsProjectGhcVersion = False}
  with plugins: [PluginId "class",PluginId "eval",PluginId "floskell",PluginId "fourmolu",PluginId "ghcide-code-actions",PluginId "ghcide-completions",PluginId "ghcide-core",PluginId "ghcide-hover-and-symbols",PluginId "ghcide-type-lenses",PluginId "haddockComments",PluginId "hlint",PluginId "importLens",PluginId "moduleName",PluginId "ormolu",PluginId "pragmas",PluginId "retrie",PluginId "splice",PluginId "tactics"]
  in directory: /home/george/SimulaDev/addons/godot-haskell-plugin
If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option!
Starting LSP server...
If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option!
 Started LSP server in 0.02s
setInitialDynFlags cradle: Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
Couldn't load cradle for libdir: (CradleError {cradleErrorDependencies = [], cradleErrorExitCode = ExitFailure 1, cradleErrorStderr = ["Error when calling cabal --builddir=/home/george/.cache/hie-bios/dist-godot-haskell-plugin-9833e75d550cbe4ed4c323e087d4f45c v2-exec --with-compiler /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b ghc -v0 -- --print-libdir","","cabal: The program 'ghc' version >=7.0.1 is required but the version of\n/home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b could\nnot be determined.\n\n"]},"/home/george/SimulaDev/addons/godot-haskell-plugin",Just "/home/george/SimulaDev/addons/godot-haskell-plugin/hie.yaml",Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal})
Output from setting up the cradle Cradle {cradleRootDir = "/home/george/SimulaDev/addons/godot-haskell-plugin", cradleOptsProg = CradleAction: Cabal}
> Warning: cannot determine version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b :
> ""
> cabal: The program 'ghc' version >=7.0.1 is required but the version of
> /home/george/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b could
> not be determined.
> 
haskell-language-server: haskell-language-server: panic! (the 'impossible' happened)
  (GHC version 8.8.4 for x86_64-unknown-linux):
    v_unsafeGlobalDynFlags: settings not initialised

Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug

though in *Messages* I get:

LSP :: Connected to [lsp-haskell-remote:9817 status:starting].
Reading Haskell configuration failed with exit code 1 and output:
get-cabal-configuration.hs: dieVerbatim: user error (get-cabal-configuration.hs: Error Parsing: file
"/ssh:george@192.168.0.53#22:/home/george/SimulaDev/addons/godot-haskell-plugin/godot-haskell-plugin.cabal"
doesn't exist. Cannot continue.
)

LSP :: Connected to [lsp-haskell-remote:9817 status:starting].

LSP :: Connected to [lsp-haskell-remote:9817 status:starting].
LSP :: lsp-haskell-remote:9817 initialized successfully
There are 2687 files in folder /ssh:george@192.168.0.53#22:/home/george/SimulaDev/addons/godot-haskell-plugin so watching the repo may slow Emacs down.
Do you want to watch all files in /ssh:george@192.168.0.53#22:/home/george/SimulaDev/addons/godot-haskell-plugin? (y or n) y
LSP :: You can configure this warning with the `lsp-enable-file-watchers' and `lsp-file-watch-threshold' variables
lsp-request: Timeout while waiting for response. Method: textDocument/hover.
michaelpj commented 3 years ago

So, I think you've got a problem with the server-side command. Perhaps try making a haskell-language-server shell script wrapper that calls haskell-language-server inside a nix-shell? Because it seems like something is going wrong with the argument parsing or something, and nix-shell is picking up the arguments to haskell-language-server.

georgewsinger commented 3 years ago

@michaelpj Thanks for your help. That got it to work brilliantly!