Skip to content

Intellisense broken in VisualFSharp solution in VS #17794

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

Open
0101 opened this issue Sep 26, 2024 · 4 comments
Open

Intellisense broken in VisualFSharp solution in VS #17794

0101 opened this issue Sep 26, 2024 · 4 comments
Assignees
Labels
Area-VS VS support for F# not covered elsewhere Bug Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code.
Milestone

Comments

@0101
Copy link
Contributor

0101 commented Sep 26, 2024

Please provide a succinct description of the issue.

Repro steps

Provide the steps required to reproduce the problem:

  1. Open VisualFSharp solution in VS
  2. Go to any file in FSharp.Editor project (always seems to happen there but usually also other projects)

Expected behavior

We semantic coloring, type hints, tooltips, F12 works, etc.

Actual behavior

None of that works

Known workarounds

Edit all .fsproj files (e.g. add a whitespace character anywhere).

touch-projects.fsx (Thanks copilot!)
open System
open System.IO

let addWhitespaceToFsprojFiles (directory: string) =
    let fsprojFiles = Directory.GetFiles(directory, "*.fsproj", SearchOption.AllDirectories)
    for file in fsprojFiles do
        let content = File.ReadAllText(file)
        printfn "Modifying %s..." file
        File.WriteAllText(file, content + " ")
        
printfn "Enter the directory to crawl:"
let directoryToCrawl = Console.ReadLine()
addWhitespaceToFsprojFiles(directoryToCrawl)

Related information

VS 17.12 p2, but likely also other versions.

@0101 0101 added Bug Area-VS VS support for F# not covered elsewhere Needs-Triage labels Sep 26, 2024
@github-actions github-actions bot added this to the Backlog milestone Sep 26, 2024
@0101
Copy link
Contributor Author

0101 commented Sep 26, 2024

This seems to be happening since we started using SDK9 preview 7 in the repo.

The cause is that we don't get command line arguments from CPS for a few of the loaded projects. Therefore we cannot create FSharp options for them, or any that depend on them.

Digging further, CPS doesn't send us the command line args, because they are not populated into FscCommandLineArgs variable during design time build.

This happens in CoreCompile target.

image

Here we see that for FSharp.Core netstandard2.0 this target was skipped. Reason being outputs are up to date.

These are the outputs

        Outputs="@(DocFileItem);
                 @(IntermediateAssembly);
                 @(IntermediateRefAssembly);
                 @(_DebugSymbolsIntermediatePath);
                 $(NonExistentFile);
                 @(CustomAdditionalCompileOutputs)"

One of them is NonExistentFile which depends on _ComputeNonExistentFileProperty

And we can see that one is skipped for the projects where we get the issue:

 Target "_ComputeNonExistentFileProperty" skipped, due to false condition; (('$(BuildingInsideVisualStudio)' == 'true') and ('$(BuildingOutOfProcess)' != 'true') and (('$(BuildingProject)' == 'false') or ('$(UseHostCompilerIfAvailable)' == 'true'))) was evaluated as (('true' == 'true') and ('' != 'true') and (('true' == 'false') or ('' == 'true'))).

Condition Analyzer:
❌ '$(BuildingProject)'=='false' ➔ 'true'=='false'
❌ '$(UseHostCompilerIfAvailable)'=='true' ➔ ''=='true'

BuildingProject should be false but it's true. And it's set via an unrelated project:

image

@abonie abonie added Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. and removed Needs-Triage labels Sep 30, 2024
@abonie abonie modified the milestones: Backlog, September-2024 Sep 30, 2024
@T-Gro T-Gro modified the milestones: October-2024, November-2024 Nov 7, 2024
@majocha
Copy link
Contributor

majocha commented Apr 10, 2025

This is still a thing unfortunately.
Less invasive workaround is to touch just the top level Directory.Build.targets.

@xperiandri
Copy link
Contributor

@T-Gro, is this planned as a separate work, or will some other large feature fix this automatically when completed?

@T-Gro
Copy link
Member

T-Gro commented Apr 15, 2025

The biggest work item we have for this year is replacement of FSharp.Editor (this is what is added to VisualFsharp.sln when compared with the small solutions like FSharp.sln).

You are correct = this will both change composition of projects in our solution, as well as how F# in general (for any solution) behaves in VS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-VS VS support for F# not covered elsewhere Bug Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code.
Projects
Status: New
Development

No branches or pull requests

6 participants