ionide / ionide-vscode-fsharp

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

Stringinterpolation requires langVersion in .NET 5 #1433

Closed NicoVIII closed 3 years ago

NicoVIII commented 3 years ago

Describe the bug If I want to use string interpolation from F# 5 in a new .NET 5 project, I get an error in the editor that tells me, that string interpolation is not available in F# 4.7. As far as I know, F# 5 is now the default language version and dotnet build runs successfully without this error.

To Reproduce Steps to reproduce the behaviour:

  1. Use string interpolation in an net5.0 project without LangVersion
    <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
    <RootNamespace>test</RootNamespace>
    </PropertyGroup>
let test = "test"
$"%s{test}"

Expected behaviour I would expect that the language version is the same for editor and compiler.

Screenshots string_interpolation

Environment (please complete the following information):

Additional context I created a reproduction repo here: https://github.com/NicoVIII/repro-bug

I don't rule out that I do something wrong. If this is the case: Sorry!

open-collective-bot[bot] commented 3 years ago

Hey @NicoVIII :wave:,

Thank you for opening an issue. We will get back to you as soon as we can. Also, check out our OpenCollective and consider backing us.

https://opencollective.com/ionide

PS.: We offer backer support for all backers. Don't forget to add backer label when you start backing us :smile:

baronfel commented 3 years ago

We're actively working on this, you can follow the status here: https://github.com/fsharp/FsAutoComplete/pull/656

NicoVIII commented 3 years ago

Thank you! I wasn't sure, if this is another thing, which belongs to FsAutoComplete and not directly to Ionide, so I opened the bug here :)

Krzysztof-Cieslak commented 3 years ago

This is fixed in Ionide 5.0 preview

jkone27 commented 3 years ago

is this fixed also for linux/ubuntu ? have v.5.5.4 installed running ubuntu on windows in this case (net 5 sdk)

image

removing the string interpolation sign makes the error disappear

image

NicoVIII commented 3 years ago

Works for me with 5.5.5 and on Manjaro with target framework net5.0.

baronfel commented 3 years ago

That's correct, this is implemented in all ionide 5.x versions.

jkone27 commented 3 years ago

it worked after uninstall of vscode and ionide as well and clean re'install, not sure what was causing it

Darkle commented 1 year ago

Edit: see bottom of post Can this be re-opened? I am running in to this too with the latest ionide. I've tried a bunch of things like uninstalling, then reinstalling ionide. I also created a temporary profile in VSCode to see if it was a problem with my profile, but the issue still occures in the temp profile. Weirdly, if I open the project in Jetbrains Rider and let it load, then switch back to VSCode, the error goes away.

My details:

My App.fsproj file:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
    <LangVersion>7</LangVersion>
  </PropertyGroup>
  <ItemGroup>
    <None Include="index.html" />
    <Compile Include="fs/PropAlias.fs" />
    <Compile Include="fs/Tailwind.fs" />
    <Compile Include="fs/Utils.fs" />
    <Compile Include="fs/apiClient/OpenApiHttp.fs" />
    <Compile Include="fs/apiClient/Types.fs" />
    <Compile Include="fs/apiClient/Client.fs" />
    <Compile Include="fs/ApiClient.fs" />
    <Compile Include="fs/pages/Home.fs" />
    <Compile Include="fs/pages/404.fs" />
    <Compile Include="fs/admin-pages/AdminHome.fs" />
    <Compile Include="fs/admin-pages/AdminUtils.fs" />
    <Compile Include="fs/Router.fs" />
    <Compile Include="fs/Main.fs" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Fable.Core" Version="4.0.0" />
    <PackageReference Include="Fable.SimpleHttp" Version="3.5.0" />
    <PackageReference Include="Fable.SimpleJson" Version="3.24.0" />
    <PackageReference Include="Feliz" Version="2.6.0" />
    <PackageReference Include="Feliz.CompilerPlugins" Version="2.2.0" />
    <PackageReference Include="Feliz.Router" Version="4.0.0" />
    <PackageReference Include="Zanaptak.TypedCssClasses" Version="1.0.0" />
  </ItemGroup>
</Project>

Edit: Ok I think I managed to fix it. I added <PackageReference Include="FSharp.Core" Version="7.0.300"/> to my App.fsproj file and now the error no longer shows.

goswinr commented 10 months ago

@baronfel I still have this problem on net7. The guides suggest using the Update keyword. So when using <PackageReference Update ="FSharp.Core" Version="7.0.300"/> it fails, only <PackageReference Include="FSharp.Core" Version="7.0.300"/> works.