haskell / haskell/haskell-language-server

Tab character incorrectly assumed to be composed of 8 characters

Open
#1,987 6 comments 0 reactions 0 assignees View on GitHub
component: ghcide type: bug
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.0.0.0 (GHC: 8.10.4) (PATH: [MYHOME]/.ghcup/bin/haskell-language-server-wrapper-1.0.0) (GIT hash: 4cd1cf934638881e52b3eba9f70157a4b799c0e9)
Tool versions found on the $PATH
cabal: 3.4.0.0
stack: 2.7.1
ghc: 8.6.5

```
Which OS do you use: Ubuntu

Which lsp-client do you use: Vim with Coc

Describe your project (alternative: link to the project): stack-project

Contents of `hie.yaml`:
```yaml
cradle:
stack:
component: "name-of-project:lib"
```

### Steps to reproduce

Type the following code
```haskell
module Test where

main :: IO ()
main = do
putStr "hello" -- there is a tab-character (\t) in front of putStr
```
And request information about `putStr`
### Expected behaviour

I should get a pop-up with type information and a short description.

### Actual behaviour

I get a pop-up about `IO` instead.
If I put my cursor further ahead, over the string "hello", I do get information about `putStr`. It seems HLS treats a tab as 8 separate characters. Setting a tab-size of 8 does not help, since it is still one character.
### Include debug information
Paste the logs from the lsp-client, e.g. for [VS Code](https://github.com/haskell/vscode-haskell#troubleshooting)

LSP logs:

The first part is when the cursor is on `putStr` and gives information about `IO`, the second part is when the cursor is on the last part of "hello" and gives information about `putStr`

File: [hls-output.txt](https://github.com/haskell/haskell-language-server/files/6727553/hls-output.txt)

Gist: [hls-output.txt gist](https://gist.github.com/LiraOnGithub/42d94188632e3343a83f9e98a24bd149)

Please let me know if you need more of the output.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.