Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intellisense breaks when targeting multiple frameworks #416

Closed
ntwilson opened this issue Apr 23, 2017 · 7 comments
Closed

Intellisense breaks when targeting multiple frameworks #416

ntwilson opened this issue Apr 23, 2017 · 7 comments
Labels
bug language services Problems related to language services - FSAC or FCS

Comments

@ntwilson
Copy link

When working in a .NET core app with multiple target frameworks:

  <PropertyGroup>
    <TargetFrameworks>netstandard1.6;net40</TargetFrameworks>
  </PropertyGroup>

dotnet restore -> dotnet build compiles successfully, but Ionide doesn't recognize any other files. It recognizes any types/modules/functions defined within the same file, but when opening a module in another file, I get "namespace or module Xyz is not defined".

If I then replace my target framework in the fsproj as follows:

  <PropertyGroup>
    <!--<TargetFrameworks>netstandard1.6;net40</TargetFrameworks>-->
    <TargetFramework>netstandard1.6</TargetFramework>
  </PropertyGroup>

delete my obj folder, dotnet restore -> dotnet build then all the intellisense starts working again.

Environment: Win10, Ionide 2.25.9, VS Code 1.11.2

related issues: #278

@Krzysztof-Cieslak
Copy link
Member

Cc: @enricosada

@Krzysztof-Cieslak Krzysztof-Cieslak added bug language services Problems related to language services - FSAC or FCS labels Apr 23, 2017
@enricosada
Copy link
Contributor

@Krzysztof-Cieslak problem is, fsc args are specific to a target framework.
ionide should ask fsac for a specific framework ihmo (ref #278), that's really needed moving forward.

meanwhile dunno, i can try read that property, and use the first netstandard* or netcoreapp* if nothing is specified.
I think is a sensible default.

added ionide/FsAutoComplete#162 to track that

@Krzysztof-Cieslak
Copy link
Member

Oh yeah, I do realize that choosing target etc should be real fix for that. But I still don't know how to handle it well from UX point of view.

I think that choosing first target framework from the list should be sensible default and decent workaround for now

@enricosada
Copy link
Contributor

I'll do that, like linked issue.

But how the others extensions do something similar? Config file? Where is s good place for transitory config?

@TheAngryByrd
Copy link
Member

I'd say it's probably some config file, UX wise it could just be a command like ctrl/cmd+shift+P > Choose TargetFramework > (scan all fsproj for possible frameworks) present list to choose from > update config

@enricosada
Copy link
Contributor

enricosada commented Jun 15, 2017

support in FSAC will be implemented by ionide/FsAutoComplete#168

atm will be used the first, so if <TargetFrameworks>netcoreapp1.0;net461</TargetFrameworks> => netcoreapp1.0
Starting from that, FSAC will use the correct (same as Build target) framework for all project references.

I dont have found yet a satifying hipotetical way to specifiy my preference in vscode (settings, env var in tasks.json, etc), but FSAC is ready to accept the choice, if we want to improve the UX.
Two possible:

  • a settings somewhere to choose the initial target framework.

  • better to paired with the choosen starting project becase matter a lot of project ref resolution. Guessing like now based on first .fs file open is bad and cause bugs

  • with workaround disabled (a setting? passed to FSAC in initialization?), a flow like:

    1. vscode ask FSAC to parse the fsproj
    2. FSAC reply with error, saying is crossgen and giving the list of avaiable targets frmeworks (FSAC know that)
    3. vscode ask used (with a combo?) what use
    4. vscode retry ask FSAC to parse of fsproj with the choosen target framework

@Krzysztof-Cieslak
Copy link
Member

Initial support for multi-targeting released in 2.27.5 - at the moment we just default to first target.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug language services Problems related to language services - FSAC or FCS
Development

No branches or pull requests

4 participants