Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong sort order in autocomplete list. #2673

Closed
Akhristenko opened this issue Feb 1, 2022 · 7 comments
Closed

Wrong sort order in autocomplete list. #2673

Akhristenko opened this issue Feb 1, 2022 · 7 comments
Labels
component: ghcide type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@Akhristenko
Copy link

Your environment

Which OS do you use: Ubuntu 20.04
Which LSP client (editor/plugin) do you use: VS Code
Describe your project (alternative: link to the project): stack new-template with added bytestring dependency

Steps to reproduce

Modify file Main.hs to this:

module Main where

import qualified Data.ByteString as BS

main :: IO ()
main = do
    BS.read
    pure ()

place cursor after BS.read and invoke autocomplete.

Expected behaviour

Function readFile from Data.ByteString on first position, before all other functions that not from Data.ByteString

Actual behaviour

Function readFileon fourth position.
The first three positions are occupied by functions read from GHC.IO.Device, Prelude, Text.Read.

@Akhristenko Akhristenko added status: needs triage type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels Feb 1, 2022
@jneira
Copy link
Member

jneira commented Feb 1, 2022

hi thanks for the bug report, it is similar to #2082 that was marked closed by #2332, maybe incorrectly
Or it is a regression

@pepeiborra
Copy link
Collaborator

What version of HLS are you using ?

@Akhristenko
Copy link
Author

I'm using haskell-language-server-1.6.1.0-linux-8.10.7
This bug appears only in some cases:
if we invoke autocompletion on BS.re then sequence be correct (readFile from Data.ByteStirng, replicate from Data.ByteString, reverse from Data.ByteString, functions from other modules)
but if we invoke autocompletion on BS.read then sequence be incorrect (read from GHC.IO.Device, read from Prelude, read from Text.Read, readFile from Data.ByteString, functions from other modules)

@pepeiborra
Copy link
Collaborator

I can't seem to repro this

@Akhristenko
Copy link
Author

I dumped the vscode and hls conversations and found that the functions are in the correct order. The reordering happens somewhere on the side of the vscode. So, this is not haskell-language-server issue.

@jneira
Copy link
Member

jneira commented Feb 2, 2022

oh, that is unfortunate if we can't track the root cause, maybe something still could be done in the sever part to make the client behave correctly

maybe it worths a issue in the vscode extension? do you mind if I reopen and move this there?

@Akhristenko
Copy link
Author

do you mind if I reopen and move this there?

I don't mind

I found additional info, that can help reproduce the bug.
In my client i have in settings this line: "haskell.maxCompletions": 10000
One of my friends, after setting this parameter, also observes a bug

mergify bot pushed a commit that referenced this issue Feb 4, 2022
Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: ghcide type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

3 participants