haskell / vscode-haskell

VS Code extension for Haskell, powered by haskell-language-server
https://marketplace.visualstudio.com/items?itemName=haskell.haskell
Other
561 stars 90 forks source link

the extension doesn't find any suggestions but "Quick fix" does #614

Closed HarmonicPool closed 2 years ago

HarmonicPool commented 2 years ago

Hi I'm having a hard time getting the haskell-language-server features working in VSCode

I have worked previously in haskell in VSCode without problem, but the paused for a month or so

now when setting up a project I was getting errors like

The Haskell (<project>) server crashed 5 times in the last 3 minutes. The server will not be restarted.

thinking there was a problem with my project structure or something I tried doing things by hand running haskell-language-server-wrapper by hand, eventually getting some errors that helped me definitely more than the above error

once managed to run haskell-language-server-wrapper successfully, re-opening the project doesn't show the error but still, the hls features are not present

if it can help the line below is unable to find suggestions by pressing Ctrl+Space but on hover the "Quick fix" options recognises that the most probable module just needs an "s" more

Screenshot from 2022-05-29 16-02-40

Edit: reopening the project still raises the The Haskell (<project>) server crashed 5 times in the last 3 minutes. The server will not be restarted. error

hasufell commented 2 years ago

Edit: reopening the project still raises the The Haskell () server crashed 5 times in the last 3 minutes. The server will not be restarted. error

https://github.com/haskell/vscode-haskell#investigating-and-reporting-problems

HarmonicPool commented 2 years ago

@hasufell thanks for the help

following the steps you suggested ( https://github.com/haskell/vscode-haskell#investigating-and-reporting-problems )

I get the following output (repeated 3 times)

``` 2022-05-29 15:45:09.3720000 [client] INFO Finding haskell-language-server 2022-05-29 15:45:09.3730000 [client] INFO Searching for server executables haskell-language-server-wrapper,haskell-language-server in $PATH 2022-05-29 15:45:09.3730000 [client] INFO $PATH environment variable: /nix/store/pa9416c0x5qa4r2z3zq701qg8gyr0c73-bash-interactive-5.1-p16/bin:/nix/store/rsxads30p3521pzkbana69bl6v1h5wvz-ghc-shell-for-packages-ghc-8.10.4.20210212-env/bin:/nix/store/3d8z7x0p3fzhjkxdfr3cg6vfkfmqadnd-pkg-config-wrapper-0.29.2/bin:/nix/store/dwg97vdk7x8jkqbn1dcziscfs7k9jchd-alex-exe-alex-3.2.6/bin:/nix/store/ap89rjssk3z24ixqfd3jj0caxyqw5xpw-happy-exe-happy-1.20.0/bin:/nix/store/1vzbhrjadjg9m5hwqbv9fy156wzzl0by-doctest-exe-doctest-0.20.0/bin:/nix/store/gjjq429g1yyji9f6ic15ghv7gg1jy2b5-editorconfig-core-c-0.12.1/bin:/nix/store/i6azqjrfl12kfcfdp6vivyd6gp427dr3-ghcid-0.8.7-bin/bin:/nix/store/mv4rsk81kr57yn8j4z6m0fcdxzw1ir3r-jq-1.6-bin/bin:/nix/store/996z3wrdgg8q4cv7brxjc4qbssf6wlrn-nix-flakes-alias/bin:/nix/store/p6qhyfs511i28mx9ganqzgi4b961hi0s-nixpkgs-fmt-1.1.0/bin:/nix/store/3606asf702qv25cayflnrnvf7k45ikm5-nodejs-14.17.4/bin:/nix/store/67rz9k8mfws5rlqcvjw0fgj2ljjj20pf-shellcheck-0.7.2-bin/bin:/nix/store/9rzbq19qr7bm89i94875hzlww1w39rbx-sqlite-3.35.5-bin/bin:/nix/store/ai9x6ljqk6nkyv5jmzv0jhns0gv8vnx9-stack-2.7.3/bin:/nix/store/j3j3b56whky7vgnkgf3jl0b8z1m8xxhh-python3.9-yq-2.12.2/bin:/nix/store/81lwy2hfqj4c1943b1x8a0qsivjhdhw9-python3-3.9.6/bin:/nix/store/n8a0fkpqg3q37j7i6grh9z43qn9mx1xb-python3.9-argcomplete-1.12.3/bin:/nix/store/9h1yndxd2mmxg6hx2qzz5pydnma12llw-python3.9-chardet-4.0.0/bin:/nix/store/j2w9gxh7fbfsgmn13023pdqbn8c3pflm-python2.7-setuptools-44.0.0/bin:/nix/store/xzw7bmrs89a9fzrilsdfkggi3ygk7afm-python-2.7.18/bin:/nix/store/5gxgd0z6bqr8ccay3qz0pi5c3glikpjv-z3-4.8.10/bin:/nix/store/mdcyx0960vfv7gcz4shqk4k8ckbg00lz-cabal-install-exe-cabal-3.6.2.0/bin:/nix/store/k1cgf5qslfngj5m60hywhnhdrfb49irl-cardano-cli-exe-cardano-cli-1.33.0/bin:/nix/store/kf848y7hrqwmgsv436ijx181dlmfyi1b-cardano-node-exe-cardano-node-1.33.0/bin:/nix/store/4gx6vqbwnxkm6d3wiwb9wj2fnnwh5nas-cardano-wallet-2022.1.18/bin:/nix/store/cfak0ipi361sivw8kjf1f3536nn9hq2c-cardano-repo-tool-exe-cardano-repo-tool-0.1.0.0/bin:/nix/store/j7fcvnsalai3019ahz1l355s23i5ihd9-fix-png-optimization/bin:/nix/store/m70yq6rndbml150sc9pdrbms5g0fs9rq-fix-purs-tidy/bin:/nix/store/1ziys6i4i7smv41mgl5r7psbpyvv6rc5-fix-stylish-haskell/bin:/nix/store/sggk4d2d9wzhl5d0qrxaagrl9466v812-haskell-language-server-exe-haskell-language-server-1.5.1.0/bin:/nix/store/7lincqp8ddqx4a26cdyp0w9jfqi7wb1c-haskell-language-server-wrapper/bin:/nix/store/xkqrs5r99prz2rvdc03n578zwrcxqh86-hie-bios-exe-hie-bios-0.8.1/bin:/nix/store/nb16cvwd1jxy1ka1gsrpcbyav6xf0xmw-hlint-exe-hlint-3.2.7/bin:/nix/store/9wgcng3mxgb7rp11qlzsxhxk6ndb4mz8-pab-nami-demo-generate-purs/bin:/nix/store/x0n4isdxq93nrl4x1nsd8sx0v46jby06-pab-nami-demo-server/bin:/nix/store/50gl0c9jayir49xps4dkxvydjg5q3s54-plutus-playground-generate-purs/bin:/nix/store/175hzjngyrq50wdh9v9lv4fz7ww50l31-plutus-playground-server/bin:/nix/store/qicfmf2w68kndzncdmc9xm09yhaa3iry-node_psa-0.8.2/bin:/nix/store/zcp5hq34bfqbf26g6jm68ldy0q3mip0i-node_purescript-language-server-0.15.8/bin:/nix/store/scaax6iccr507bj1chbpf7yi76cx27rp-purescript-v0.14.5/bin:/nix/store/4rvzrgxzwvalwpgkhw004708l28badvc-node_purs-tidy-0.6.2/bin:/nix/store/x68fgmb8rmd6fm0yp5wzzfbglhqij16l-spago-0.20.3/bin:/nix/store/pn12mr27334cx4a81gshvv6lxfnhlr0k-spago2nix/bin:/nix/store/j0cxcbh8677xf5h9v2h4whdfz1gzkprr-stylish-haskell-exe-stylish-haskell-0.13.0.0/bin:/nix/store/df496kkl2k0yk78qswjq6qkcc7mq58d5-updateMaterialized/bin:/nix/store/yc19hg6dv08hllmjnh25l1qf52j527i0-update-client-deps/bin:/nix/store/dvyavbpcczkck2d7d27l8ifsn0x4allc-build-and-serve-docs/bin:/nix/store/zss63iwkbqf8bb83bh5nfcc8mshj89ly-python3-3.9.6-env/bin:/nix/store/wl5vdx1g9wkjgsjb8z1g9gxp5dwr8dfx-patchelf-0.12/bin:/nix/store/qvv5y4fx4x879rbsbs4g27mypl9wxbb9-gcc-wrapper-10.3.0/bin:/nix/store/cj8kp411lblbdm4qj94s14h99dx1pv4b-gcc-10.3.0/bin:/nix/store/wkxfa6jfwsh0n7d7czi0xp2b7sgrkv25-glibc-2.33-47-bin/bin:/nix/store/jj6z78skpdcya84iqbn9cf59sxjy5msv-coreutils-8.32/bin:/nix/store/rs4jynk5rpvag2b2f8m7nrzsypjss4w1-binutils-wrapper-2.35.1/bin:/nix/store/hy3lz2vfv9qq2v5jz9nzlx6mmiaq79rj-binutils-2.35.1/bin:/nix/store/yn7nd41grg2mzvzliphalk70hs0rfpdr-ncurses-6.2/bin:/nix/store/1lr5wgik95n8apy8lbq54v6s4jk94686-ncurses-6.2-dev/bin:/nix/store/srjsqravrmbk5xg7a4xxj6nibrxl6ly9-numactl-2.0.14/bin:/nix/store/jj6z78skpdcya84iqbn9cf59sxjy5msv-coreutils-8.32/bin:/nix/store/2nrji9a3q54bnbf6bh2i01pv7hnb4320-findutils-4.8.0/bin:/nix/store/n0s100cc8q4y31cwik65p497m4y1xrlj-diffutils-3.7/bin:/nix/store/pp6q8mh5ilgsf67cciggkqcrrw8z2hip-gnused-4.8/bin:/nix/store/azjjb2azlva4ifsiyazrl8ajck5njfxn-gnugrep-3.6/bin:/nix/store/1838raw4b33pbry9m3c4mwrfigzbkf6r-gawk-5.1.0/bin:/nix/store/87l7j4jcsl6x50nzpii751cdbsa26b0f-gnutar-1.34/bin:/nix/store/zab716kfmd0h8iy49dldm8x1b695p7sk-gzip-1.10/bin:/nix/store/yr4rc4w2fcf96grwliqr1kgypi47q6j0-bzip2-1.0.6.0.2-bin/bin:/nix/store/pyv3351wlsa5r8sa8bbjpici3ksbvcqc-gnumake-4.3/bin:/nix/store/can473ld4dc8izcjlm4i5daxsh1yl5d8-bash-4.4-p23/bin:/nix/store/ral4i7kjhmxzq2kdg11ymx2bshgxk76m-patch-2.7.6/bin:/nix/store/jjfwszja3l4l4a6rrs2fi4im5hw0cjzc-xz-5.2.5-bin/bin:/media/michele/Data1/cardano/utils/scripts:/home/michele/.local/bin:/root/.nix-profile/bin:/home/michele/.cabal/bin:/home/michele/.ghcup/bin:/home/michele/.nvm/versions/node/v17.5.0/bin:/media/michele/Data1/cardano/utils/scripts:/home/michele/.local/bin:/root/.nix-profile/bin:/home/michele/.nix-profile/bin:/home/michele/.cargo/bin:/home/michele/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin:/usr/local/go/bin:/nix/store/f4sifxcqh4y127mji7ykq9zlp8j80lnd-python3.9-pre-commit-2.13.0/bin 2022-05-29 15:45:09.3880000 [client] INFO Found server executable in $PATH: haskell-language-server-wrapper 2022-05-29 15:45:09.3880000 [client] INFO Activating the language server in working dir: /home/michele/dev/crypto/cardano/NFTwitter/minting-policy (the workspace folder) 2022-05-29 15:45:09.3900000 [client] INFO run command: haskell-language-server-wrapper --lsp -d 2022-05-29 15:45:09.3900000 [client] INFO debug command: haskell-language-server-wrapper --lsp -d 2022-05-29 15:45:09.3900000 [client] INFO server environment variables: 2022-05-29 15:45:09.3900000 [client] DEBUG document selector patten: /home/michele/dev/crypto/cardano/NFTwitter/minting-policy/**/* 2022-05-29 15:45:09.3930000 [client] INFO Starting language server haskell-language-server version: 1.5.1.0 (GHC: 8.10.4.20210212) (PATH: /nix/store/sggk4d2d9wzhl5d0qrxaagrl9466v812-haskell-language-server-exe-haskell-language-server-1.5.1.0/bin/haskell-language-server) Starting (haskell-language-server)LSP server... with arguments: GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = True, argsLogFile = Nothing, argsThreads = 0, argsProjectGhcVersion = False} with plugins: [PluginId "pragmas",PluginId "floskell",PluginId "fourmolu",PluginId "tactics",PluginId "ormolu",PluginId "stylish-haskell",PluginId "retrie",PluginId "brittany",PluginId "callHierarchy",PluginId "class",PluginId "haddockComments",PluginId "eval",PluginId "importLens",PluginId "refineImports",PluginId "moduleName",PluginId "hlint",PluginId "splice",PluginId "ghcide-hover-and-symbols",PluginId "ghcide-code-actions-imports-exports",PluginId "ghcide-code-actions-type-signatures",PluginId "ghcide-code-actions-bindings",PluginId "ghcide-code-actions-fill-holes",PluginId "ghcide-completions",PluginId "ghcide-type-lenses",PluginId "ghcide-core"] in directory: /home/michele/dev/crypto/cardano/NFTwitter/minting-policy 2022-05-29 17:45:09.56198932 [ThreadId 4] INFO hls: Starting LSP server... 2022-05-29 17:45:09.562175882 [ThreadId 4] INFO hls: If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option! 2022-05-29 17:45:09.564131118 [ThreadId 9] INFO hls: Started LSP server in 0.00s 2022-05-29 17:45:09.567654059 [ThreadId 9] DEBUG hls: setInitialDynFlags cradle: Cradle {cradleRootDir = "/home/michele/dev/crypto/cardano/NFTwitter/minting-policy", cradleOptsProg = CradleAction: Cabal} 2022-05-29 17:45:10.084761287 [ThreadId 9] DEBUG hls: runSubset: True 2022-05-29 17:45:10.084942336 [ThreadId 15] DEBUG hls: Initializing exports map from hiedb 2022-05-29 17:45:10.085216886 [ThreadId 9] INFO hls: Registering ide configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri 7050526313798375636 "file:///home/michele/dev/crypto/cardano/NFTwitter/minting-policy"], clientSettings = hashed Nothing} 2022-05-29 17:45:10.105857179 [ThreadId 17] ERROR hls: Fatal error in server thread: SQLite3 returned ErrorBusy while attempting to perform step: database is locked [Info - 5:45:10 PM] Connection to server got closed. Server will restart. [Error - 5:45:10 PM] Request textDocument/documentSymbol failed. Error: Connection got disposed. at Object.dispose (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:472910) at Object.dispose (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:552993) at _.handleConnectionClosed (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:553206) at _.handleConnectionClosed (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:613552) at t (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:551295) at invoke (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:474523) at o.fire (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:475284) at Q (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:462168) at invoke (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:474523) at o.fire (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:475284) at m.fireClose (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:483165) at Socket. (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:484750) at Socket.emit (node:events:402:35) at Pipe. (node:net:687:12) [Error - 5:45:10 PM] Request textDocument/codeAction failed. Error: Connection got disposed. at Object.dispose (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:472910) at Object.dispose (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:552993) at _.handleConnectionClosed (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:553206) at _.handleConnectionClosed (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:613552) at t (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:551295) at invoke (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:474523) at o.fire (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:475284) at Q (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:462168) at invoke (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:474523) at o.fire (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:475284) at m.fireClose (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:483165) at Socket. (/home/michele/.vscode/extensions/haskell.haskell-2.2.0/dist/extension.js:1:484750) at Socket.emit (node:events:402:35) at Pipe. (node:net:687:12) ```

Perhaps the problem is in this line

ERROR hls:  Fatal error in server thread: SQLite3 returned ErrorBusy while attempting to perform step: database is locked

do you know which database is talking about here?

hasufell commented 2 years ago

https://github.com/haskell/haskell-language-server/issues/2931

HarmonicPool commented 2 years ago

@hasufell removing ~/.cache/ghcide starts the LSP server at the second try and so it doesn't crashes, meaning no more error, but still there are no suggestions available

HarmonicPool commented 2 years ago

I found out that launching vscode from my usual shell works just fine, the problem is present only when launching from the nix-shell environment created using the files present in the input-output-hk/plutus-apps repository, so is likely not a problem of the extension