ionide / ionide-vscode-fsharp

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

array[^0]: from-end indexing marked as error in .fsx files #1681

Closed pkese closed 2 years ago

pkese commented 2 years ago

Describe the bug

From-end indices in .fsx files get marked as errors:

image

Hovering over the squiggle says that it requires language > 5.0 even though my dotnet is 6.0.201

 From the end slicing with requires language version 5.0,
 use /langversion:preview.F# Compiler[3303](https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/compiler-messages/fs3303)

Machine info

baronfel commented 2 years ago

The diagnostic says that you have to add the preview flag to the FSI parks in order to use this feature. You can do this in ionide via the fsharp.fsiAdditionalArgs setting. Can you try this and report back if it doesn't work?

pkese commented 2 years ago

Thanks

Setting

"FSharp.fsiExtraParameters": [ "--langversion:preview" ]

in settings.json fixed the problem.

I assumed that since from-end slicing was introduced as preview in FSharp 5.0,
that this would imply that it is then enabled by default in 6.0.
But it is not.

baronfel commented 2 years ago

Closing because it's a preview feature.