Skip to content

[RFE] Suggest the most relevant typename first #213

@Hi-Angel

Description

@Hi-Angel

Related to this compiler issue.

Frequently, when typing the name of a function or a type, and there are multiple candidates (I think, the most common function is singleton, which exists basically in every container: Map, HashMap, String…), the candidates that go first are the wrong ones.

I think it would be useful to check what types are used by the current source file, and then suggest those types first, and others second.

Steps to reproduce

  1. Create a new project with spago init
  2. Put the following code to src/Main.purs:
    module Main where
    
    import Prelude
    
    import Effect (Effect)
    import Parsing (Parser)
    import Parsing.Combinators (manyTill)
    import Parsing.String (anyChar, char)
    
    parseOption :: Parser String (List Char)
    parseOption = manyTill anyChar (char '=')
    
    main :: Effect Unit
    main = pure unit
  3. Install deps with spago install parsing lists
  4. Turn on the lsp server in an editor of your choice, put caret over List text, remove t and type t manually. Completion would pop up.

Expected

In the completion, the first List candidate will be the "non-lazy" version.

Actual

In the completion, the first List candidate is the lazy one.

Version

0.18.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions