ionide-vscode-fsharp icon indicating copy to clipboard operation
ionide-vscode-fsharp copied to clipboard

Types in line annotations broken

Open forki opened this issue 3 years ago • 2 comments

image

similar for Options

forki avatar Jun 21 '21 09:06 forki

Hello @forki. Can you provide more information about this bug, like an example code that presents this problem?

64J0 avatar Aug 01 '21 00:08 64J0

@64J0 we used to render the type in the red box as Task<OpenAccounting array> instead of what's currently being rendered.

This is a side effect of us moving to use the postfix type formatting from FCS directly (look for uses of .DisplayContext in FSAC for pointers, e.g. here).

We used to have a bunch of regex that would replace [] with array, but in the move to use these FCS APIs directly we must have lost it.

The fix will be entirely in FSAC and will likely be in this routine. We format types here and we don't do all of the same escaping/type rendering logic that we do in the SignatureFormatter in the first link.

I'd expect that we'd be able to unify these two logics to prevent this kind of drift in the future.

The real fix will involve adding flags to the DisplayEnv type in FCS to allow us to control the way the array type is rendered. Since F# arrays are defined using the [] symbol directly we get this weird half-state. Such a fix would look a lot like the PR I sent to introduce forced generic argument formatting.

baronfel avatar Aug 01 '21 01:08 baronfel