ionide / ionide-vscode-fsharp

VS Code plugin for F# development
http://ionide.io
MIT License
849 stars 276 forks source link

When name's of a discriminated union type and module collide, intellisense in the context of a type definition will show the cases instead of the type name #1980

Open MangelMaxime opened 5 months ago

MangelMaxime commented 5 months ago

Describe the bug

If I have type definition like this one in a file:

[<RequireQualifiedAccess>]
module Response =

    module Read =

        type Question = {
            Id: System.Guid
        }

    [<RequireQualifiedAccess>]
    type Read =
        | Found of Read.Question
        | NotFound

Then trying to define the type a variable will show the cases names instead of the Question record type.

CleanShot 2024-02-04 at 21 38 38@2x

Accessing intellisense from inside of the body of a variable declaration will however show the cases + record name/reference:

https://github.com/ionide/ionide-vscode-fsharp/assets/4760796/db7b5030-82b9-4002-bf51-78bff3e20651

Steps to reproduce

  1. Create an F# file with the following content:

    [<RequireQualifiedAccess>]
    module Response =
    
        module Read =
    
            type Question = {
                Id: System.Guid
            }
    
        [<RequireQualifiedAccess>]
        type Read =
            | Found of Read.Question
            | NotFound
  2. let x : Response.Read. Try to get intellisense while typing and see that the record name/reference is not here.

Expected behaviour

Intellisense in this context should only report the record name/reference because cases cannot be used for type definition.

Machine info

Additional context

Add any other context about the problem here.