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

M-x flycheck-list-errors returns no results with invalid syntax #93

Closed mdunnio closed 3 years ago

mdunnio commented 3 years ago

I'm using haskell-mode, lsp-mode, and lsp-haskell usinghaskell-language-server-wrapper and I'm unable to get any flycheck output for invalid syntax. When I switch the flychecker to using haskell-stack-ghc instead of lsp, I get the expected output.

Here is the relevant elisp in my configuration:

(use-package lsp-mode
  :hook
  (haskell-mode . lsp)
  :ensure t
  :commands lsp
  :config
  (setq lsp-auto-configure t
        lsp-eldoc-render-all nil
        lsp-enable-xref nil
        lsp-enable-imenu t
        lsp-response-timeout 1))

(use-package lsp-ui
  :ensure t
  :commands lsp-ui-mode
  :config
  (setq warning-minimum-level ':error))

(use-package lsp-haskell
 :ensure t
 :config

 (use-package lsp-ivy
   :commands lsp-ivy-workspace-symbol)

 (add-hook 'haskell-mode-hook
            (lambda ()
              (lsp)
              (lsp-ui-sideline-enable nil))))

Please let me know if I can provide more information.

mdunnio commented 3 years ago

Here is some output lsp-haskell:stderr

ghcide version: 0.1.0.0 (GHC: 8.6.5) (PATH: /home/mdunn/.local/bin/haskell-language-server-wrapper) (GIT hash: d2654185eef1b0d703cebc694e85438e20600e37)
ghcide version: 0.1.0.0 (GHC: 8.6.5) (PATH: /home/mdunn/.local/bin/haskell-language-server) (GIT hash: d2654185eef1b0d703cebc694e85438e20600e37)
Starting (haskell-language-server)LSP server...
  with arguments: Arguments {argLSP = True, argsCwd = Nothing, argFiles = [], argsVersion = False, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = True, argsLogFile = Just "/tmp/hls.log", argsThreads = 0}
  with plugins: [PluginId "brittany",PluginId "floskell",PluginId "ghcide",PluginId "ormolu",PluginId "pragmas",PluginId "stylish-haskell"]
If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option!
 Started LSP server in 0.00s
Consulting the cradle for "/home/mdunn/Code/coinbase-pro/src/lib/CoinbasePro/Authenticated/API.hs"
> coinbase-pro> configure (lib)
> Configuring coinbase-pro-0.8.3.0...
> coinbase-pro> initial-build-steps (lib)
> Configuring GHCi with the following packages: coinbase-pro
> /home/mdunn/Code/coinbase-pro/.stack-work/install/x86_64-linux-tinfo6/65b06f3bd2185869fea02e4a66e4b2715d03b99b955517142142f6f85065f6de/8.10.2/pkgdb:/home/mdunn/.stack/snapshots/x86_64-linux-tinfo6/65b06f3bd2185869fea02e4a66e4b2715d03b99b955517142142f6f85065f6de/8.10.2/pkgdb:/home/mdunn/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.2/lib/ghc-8.10.2/package.conf.d
Right (ComponentOptions {componentOptions = ["-i","-odir=/home/mdunn/Code/coinbase-pro/.stack-work/odir","-hidir=/home/mdunn/Code/coinbase-pro/.stack-work/odir","-hide-all-packages","-i/home/mdunn/Code/coinbase-pro/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.2.0.0/build","-i/home/mdunn/Code/coinbase-pro/src/lib","-i/home/mdunn/Code/coinbase-pro/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.2.0.0/build/autogen","-i/home/mdunn/Code/coinbase-pro/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.2.0.0/build/global-autogen","-stubdir=/home/mdunn/Code/coinbase-pro/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.2.0.0/build","-I/usr/local/opt/openssl/include","-L/usr/local/opt/openssl/lib","-package-id=HsOpenSSL-0.11.4.19-H7oOAt4qyhVFdERXSNTQvA","-package-id=aeson-1.5.4.0-CUjTi1oENznKXRhVIJyfi2","-package-id=aeson-casing-0.2.0.0-5pp6DWoiRR19BTDXTGoH7v","-package-id=async-2.2.2-KekkAJkpoh6Az2hBaGvAEh","-package-id=base-4.14.1.0","-package-id=binary-0.8.8.0","-package-id=bytestring-0.10.10.0","-package-id=containers-0.6.2.1","-package-id=cryptonite-0.27-HXZNX7I44eP5GBcpM9f7Ht","-package-id=http-api-data-0.4.1.1-AuAXtqiUTWGHdX3Oiyf5um","-package-id=http-client-0.6.4.1-UtIViUxMEJ84gyOAfZ20h","-package-id=http-client-tls-0.3.5.3-7MGbEGMBxKBGiaFWdEp7Mq","-package-id=http-streams-0.8.7.2-9qagzEX0OCe7udvLihVWhR","-package-id=http-types-0.12.3-LMMV4F9OuE2BJ0myUSAImx","-package-id=io-streams-1.5.2.0-HmGlnvpdmya5168QlurVwQ","-package-id=memory-0.15.0-JJt0qzJGoFpEl33Z92vxSb","-package-id=network-3.1.1.1-34MHHHWpXjS4yCHcPyn98x","-package-id=servant-0.18-D9LjB1q1oz2HX8tNt6brC9","-package-id=servant-client-0.18-LcCfEJ1jHW8GbmOonFbCgJ","-package-id=servant-client-core-0.18-9Kvtcq4hJZ66Og675VHCIp","-package-id=text-1.2.3.2","-package-id=time-1.9.3","-package-id=transformers-0.5.6.2","-package-id=unagi-streams-0.2.7-Ge3wAi9EKtSBT9lLbYBiJd","-package-id=unordered-containers-0.2.12.0-BkJSZe2LvIB4fc0ASSWCag","-package-id=uuid-1.3.13-IY2j44vMYWg2da38mi5KAG","-package-id=vector-0.12.1.2-6jlbObSa8iuJfxUVGBQC5r","-package-id=websockets-0.12.7.1-AtPpH14y26883OjBi5orta","-package-id=wuss-1.1.17-JKdS6e3Idb2LNe1e21YUmM","-Wall","-optP-include","-optP/home/mdunn/Code/coinbase-pro/.stack-work/ghci/80fffc5c/cabal_macros.h","-ghci-script=/tmp/haskell-stack-ghci/6998353e/ghci-script","-package-db","/home/mdunn/Code/coinbase-pro/.stack-work/install/x86_64-linux-tinfo6/65b06f3bd2185869fea02e4a66e4b2715d03b99b955517142142f6f85065f6de/8.10.2/pkgdb","-package-db","/home/mdunn/.stack/snapshots/x86_64-linux-tinfo6/65b06f3bd2185869fea02e4a66e4b2715d03b99b955517142142f6f85065f6de/8.10.2/pkgdb","-package-db","/home/mdunn/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.2/lib/ghc-8.10.2/package.conf.d"], componentRoot = "/home/mdunn/Code/coinbase-pro", componentDependencies = ["coinbase-pro.cabal","package.yaml","stack.yaml"]})
"Making new HscEnv[main]"
(([],Just HscEnvEq 4),fromList [("coinbase-pro.cabal",Just 2020-09-12 20:16:22.320998127 UTC),("package.yaml",Just 2020-09-12 20:23:13.129151533 UTC),("stack.yaml",Just 2020-09-12 20:33:12.825681723 UTC)])
mdunnio commented 3 years ago

More output from lsp-log:

Command "haskell-language-server-wrapper --lsp -d -l /tmp/hls.log" is present on the path.
Command "haskell-language-server-wrapper --lsp -d -l /tmp/hls.log" is present on the path.
Found the following clients for /home/mdunn/Code/coinbase-pro/src/lib/CoinbasePro/Authenticated/API.hs: (server-id lsp-haskell, priority 0)
The following clients were selected based on priority: (server-id lsp-haskell, priority 0)
Command "haskell-language-server-wrapper --lsp -d -l /tmp/hls.log" is present on the path.
Command "haskell-language-server-wrapper --lsp -d -l /tmp/hls.log" is present on the path.
Found the following clients for /home/mdunn/Code/coinbase-pro/src/lib/CoinbasePro/Authenticated/API.hs: (server-id lsp-haskell, priority 0)
The following clients were selected based on priority: (server-id lsp-haskell, priority 0)
haskell-lsp:configuration parse error. NotificationMessage {_jsonrpc = "2.0", _method = WorkspaceDidChangeConfiguration, _params = DidChangeConfigurationParams {_settings = Object (fromList [("haskell",Object (fromList [("hlintOn",Bool True),("formatOnImportOn",Bool True),("liquidOn",Bool False),("diagnosticsOnChange",Bool True),("completionSnippetsOn",Bool True),("maxNumberOfProblems",Number 100.0),("formattingProvider",String "ormolu")]))])}} "key \"languageServerHaskell\" not found"
Creating watch for /home/mdunn/Code/coinbase-pro
Creating watch for /home/mdunn/Code/coinbase-pro/src
Creating watch for /home/mdunn/Code/coinbase-pro/src/example
Creating watch for /home/mdunn/Code/coinbase-pro/src/example/request
Creating watch for /home/mdunn/Code/coinbase-pro/src/example/stream
Creating watch for /home/mdunn/Code/coinbase-pro/src/lib
Creating watch for /home/mdunn/Code/coinbase-pro/src/lib/CoinbasePro
Creating watch for /home/mdunn/Code/coinbase-pro/src/lib/CoinbasePro/Authenticated
Creating watch for /home/mdunn/Code/coinbase-pro/src/lib/CoinbasePro/MarketData
Creating watch for /home/mdunn/Code/coinbase-pro/src/lib/CoinbasePro/Unauthenticated
Creating watch for /home/mdunn/Code/coinbase-pro/src/lib/CoinbasePro/WebSocketFeed
Creating watch for /home/mdunn/Code/coinbase-pro/src/lib/CoinbasePro/WebSocketFeed/Channel
Creating watch for /home/mdunn/Code/coinbase-pro/src/lib/CoinbasePro/WebSocketFeed/Channel/Full
Command "haskell-language-server-wrapper --lsp -d -l /tmp/hls.log" is present on the path.
Command "haskell-language-server-wrapper --lsp -d -l /tmp/hls.log" is present on the path.
Found the following clients for /home/mdunn/Code/coinbase-pro/src/lib/CoinbasePro/Authenticated/Fills.hs: (server-id lsp-haskell, priority 0)
The following clients were selected based on priority: (server-id lsp-haskell, priority 0)
Command "haskell-language-server-wrapper --lsp -d -l /tmp/hls.log" is present on the path.
Command "haskell-language-server-wrapper --lsp -d -l /tmp/hls.log" is present on the path.
Found the following clients for /home/mdunn/Code/coinbase-pro/src/lib/CoinbasePro/Authenticated/Fills.hs: (server-id lsp-haskell, priority 0)
The following clients were selected based on priority: (server-id lsp-haskell, priority 0)
michaelpj commented 3 years ago

Do you get any LSP features? e.g. hover doc, code lenses, etc? Or is it completely non-functional?

michaelpj commented 3 years ago

It certainly looks like the server has started up okay.

mdunnio commented 3 years ago

It's pretty much non-functional. I'm using version 20201011.1941.

Let me know what else I can get you.

There is also nothing in the lsp-haskell log.

michaelpj commented 3 years ago

I think this may end up being an lsp-mode issue, since it looks like our stuff is working. Can you try running through the Troubleshooting section?

mdunnio commented 3 years ago

So I figured out the problem: I had another version (old) of haskell-language-server that I had a PATH conflict with the newest one. I was able to fix it.

Thanks for the help!