haskell / haskell/haskell-language-server
Eval codelens crashes hls if eval calls into c-code that triggers an assertion
- Dominant language
- Haskell
- Stars
- 3k
- Forks
- 455
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 11
Description
### Your environment
Output of `haskell-language-server --probe-tools` or `haskell-language-server-wrapper --probe-tools`:
```sh
haskell-language-server version: 1.4.0.0 (GHC: 9.0.1) (PATH: $HOME/.local/bin/haskell-language-server-wrapper) (GIT hash: a0cd84b4f6c6e48eb56e135faf5f9b1e3139886c)
Tool versions found on the $PATH
cabal: 3.2.0.0
stack: 2.7.3
ghc: 9.0.1
```
Which OS do you use:
Linux
Which lsp-client do you use:
Neovim
Describe your project (alternative: link to the project):
Contents of `stack.yaml`:
```yaml
resolver: lts-17.9
packages:
- .
extra-deps:
- tree-sitter-0.9.0.2@sha256:a8e9821575a1bf90455cc164619f5a59f6cc01d66a870944ece84a755b6450d9
```
No `hie.yaml`
`.cabal` contents:
```
executable myexecutable
hs-source-dirs: src
main-is: Main.hs
default-language: Haskell2010
build-depends: base >= 4.7 && < 5
, tree-sitter
```
### Steps to reproduce
Execute the eval code-lens on `parse "bar"`:
```haskell
import qualified TreeSitter.Parser as TS
import qualified TreeSitter.Tree as TS
-- Do something
--
-- >>> parse "bar"
parse content = do
parser <- TS.ts_parser_new
TS.withParseTree parser content processTree
where
processTree tree = TS.withRootNode tree processNode
processNode node = pure ()
```
### Expected behaviour
Some error indication or something like that
### Actual behaviour
hls crashes. Last lines from the LSP log:
```
ERROR][2021-11-05 16:32:33] .../vim/lsp/rpc.lua:412 "rpc" "haskell-language-server-wrapper" "stderr" "2021-11-05 16:32:33.378549034 [ThreadId 722] INFO hls:\tfinish: eval (took 0.00s)\n"
[ERROR][2021-11-05 16:32:33] .../vim/lsp/rpc.lua:412 "rpc" "haskell-language-server-wrapper" "stderr" "2021-11-05 16:32:33.378659895 [ThreadId 725] INFO hls:\tfinish: runEvalCmd.getModSummary (took 0.00s)\n"
[ERROR][2021-11-05 16:32:34] .../vim/lsp/rpc.lua:412 "rpc" "haskell-language-server-wrapper" "stderr" "haskell-language-server-8.10.4: src/bridge.c:44: ts_tree_root_node_p: Assertion `tree != NULL' failed.\n"
```
### Include debug information
Probably not relevant(?)
---
Maybe related to https://github.com/haskell/haskell-language-server/issues/461 ?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.