haskell / haskell-language-server

Official haskell ide support via language server (LSP). Successor of ghcide & haskell-ide-engine.
Apache License 2.0
2.72k stars 368 forks source link

completionSnippetsOn options does not seem to work #1239

Closed maksbotan closed 3 years ago

maksbotan commented 3 years ago

Your environment

Output of haskell-language-server --probe-tools or haskell-language-server-wrapper --probe-tools:

$ haskell-language-server-8.8.4 --probe-tools
haskell-language-server version: 0.8.0.0 (GHC: 8.8.4) (PATH: /Users/maksbotan/.local/bin/haskell-language-server-8.8.4) (GIT hash: eb58f13f7b8e4f9bc771af30ff9fd82dc4309ff5)
Tool versions found on the $PATH
cabal:      3.2.0.0
stack:      2.5.1
ghc:        8.8.4

Which lsp-client do you use:

vim version: NVIM v0.4.4
node version: v14.15.0
coc.nvim version: 0.0.80-50544406f0

Coc configuration:

"settings": {
    "haskell": {
        "formattingProvider": "stylish-haskell",
        "completionSnippetsOn": false
    }
}

Describe your project (alternative: link to the project): Empty file with foo = _.

Steps to reproduce

Type Just in place of _, select Just~ from the drop down.

Expected behaviour

Just is completed.

Actual behaviour

Just is completed with a placeholder for a, however I tried to explicitly disable that feature - I don't like to use it in nvim.

Include debug information

Execute in the root of your project the command haskell-language-server --debug . and paste the logs here:

Debug output: ``` haskell-language-server version: 0.8.0.0 (GHC: 8.8.4) (PATH: /Users/maksbotan/.local/bin/haskell-language-server-8.8.4) (GIT hash: eb58f13f7b8e4f9bc771af30ff9fd82dc4309ff5) (haskell-language-server)Ghcide setup tester in /Users/maksbotan/temp/foo. Report bugs at https://github.com/haskell/haskell-language-server/issues Tool versions found on the $PATH cabal: 3.2.0.0 stack: 2.5.1 ghc: 8.8.4 Step 1/4: Finding files to test in /Users/maksbotan/temp/foo Found 1 files Step 2/4: Looking for hie.yaml files that control setup Found 1 cradle Step 3/4: Initializing the IDE Step 4/4: Type checking the files [INFO] Consulting the cradle for "test.hs" NotShowMessage (NotificationMessage {_jsonrpc = "2.0", _method = WindowShowMessage, _params = ShowMessageParams {_xtype = MtInfo, _message = "No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for test.hs.\n Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie).\nYou should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error."}}) Output from setting up the cradle Cradle {cradleRootDir = "/Users/maksbotan/temp/foo", cradleOptsProg = CradleAction: Default} Loaded package environment from /Users/maksbotan/.ghc/x86_64-darwin-8.8.4/environments/default [INFO] Using interface files cache dir: ghcide [INFO] Making new HscEnv[main] File: /Users/maksbotan/temp/foo/test.hs Hidden: no Range: 1:7-1:8 Source: typecheck Severity: DsError Message: • Found hole: _ :: t Where: ‘t’ is a rigid type variable bound by the inferred type of foo :: t at /Users/maksbotan/temp/foo/test.hs:1:1-7 • In the expression: _ In an equation for ‘foo’: foo = _ • Relevant bindings include foo :: t (bound at /Users/maksbotan/temp/foo/test.hs:1:1) Valid hole fits include foo Valid refinement hole fits include id _ head _ last _ [INFO] finish: User TypeCheck (took 0.22s) Completed (1 file worked, 0 files failed) ```

Paste the logs from the lsp-client, e.g. for VS Code

LSP logs: ``` 2021-01-20T15:29:05.938 INFO (pid:52958) [services] - registered service "languageserver.hie" 2021-01-20T15:29:05.940 INFO (pid:52958) [services] - registered service "languageserver.pyls" 2021-01-20T15:29:05.940 INFO (pid:52958) [services] - registered service "languageserver.python-language-server" 2021-01-20T15:29:05.940 INFO (pid:52958) [services] - registered service "languageserver.bash-language-server" 2021-01-20T15:29:05.940 INFO (pid:52958) [services] - registered service "languageserver.julia" 2021-01-20T15:29:05.942 INFO (pid:52958) [plugin] - coc.nvim 0.0.80-50544406f0 initialized with node: v14.15.0 after 57ms 2021-01-20T15:29:07.918 INFO (pid:52958) [attach] - receive notification: showInfo [] 2021-01-20T15:29:07.952 INFO (pid:52958) [attach] - receive request: CocAutocmd [ 'BufReadCmd', 'output', 'output:///info' ] 2021-01-20T15:29:08.513 INFO (pid:52958) [attach] - receive notification: highlight [] 2021-01-20T15:29:11.068 INFO (pid:52958) [services] - hie state change: stopped => starting 2021-01-20T15:29:11.073 INFO (pid:52958) [language-client-index] - Language server "languageserver.hie" started with 52963 2021-01-20T15:29:11.493 INFO (pid:52958) [services] - hie state change: starting => running 2021-01-20T15:29:11.498 INFO (pid:52958) [services] - service languageserver.hie started 2021-01-20T15:29:12.613 INFO (pid:52958) [attach] - receive notification: highlight [] 2021-01-20T15:29:13.877 INFO (pid:52958) [attach] - receive notification: highlight [] 2021-01-20T15:29:18.018 INFO (pid:52958) [attach] - receive notification: openLog [] ```

In HLS log with --debug I see that configuration is passed and parsed:

2021-01-20 14:54:54.673085 [ThreadId 5] - ---> {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"haskell":{"formattingProvider":"stylish-haskell",
"completionSnippetsOn":false}}}}
2021-01-20 14:54:54.673211 [ThreadId 21] - Configuration changed: Object (fromList [("haskell",Object (fromList [("completionSnippetsOn",Bool False),("formattingProvider",String "s
tylish-haskell")]))])

And formattingProvider bit is indeed applied. However completionSnippetsOn options does not seem to have any effect.

jneira commented 3 years ago

Hi, that configuration option was being ignored before 5685afb (the merge of #1195, issue #680), your version seems to be the hls-0.8.0 release(eb58f13). It will be honoured in the next 0.9.0 release (you can build hls from source if you want to get it right now)

maksbotan commented 3 years ago

Hm, interesting, I remember it used to work, probably with 0.6.0 or 0.5.0. Anyway, thanks, I'll try building from source :)

When is 0.9.0 planned to be released?

jneira commented 3 years ago

We try to do a monthly release so next month will be a new one if everything goes well

maksbotan commented 3 years ago

Thanks, it seems to work on master (2ad9eb068c53b7cbc2af55a86d0d7a1c41aeb3d5). I'm closing the issue then.

Thanks again for the quick response!