ionide / ionide-vscode-fsharp

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

Ionide extension activates for non-F# projects #1701

Closed smcl closed 2 years ago

smcl commented 2 years ago

Describe the bug

If you have created C# or D project with Visual Studio (I've tried 2019 and 2022) in Visual Studio Code with Ionide for F# installed, Ionide thinks it's an F# project so a few seconds after you open it the F# Solution Explorer opens up on the left. It's not the worst thing in the world but it is quite irritating and feels wrong.

Ionide is presumably looking for the existence of a .sln file or .csproj file, rather than trying to detect whether F# is used at all.

Steps to reproduce

Prerequisites:

To reproduce the issue:

  1. create a C# project in Visual Studio (or clone the linked repo)
  2. switch to Visual Studio Code, open the folder containing the solution
  3. notice that a couple of seconds after opening, the F# Solution Explorer pops up in the left pane (replacing the files list or whatever you were looking at)

Link to sample reproduction

I have created a repo which contains two projects: https://github.com/smcl/ionide-issue

You can reproduce the issue by opening either of the folders with VS Code (note: if you open the top-level it won't reproduce, you need to drill down at least one level into either folder).

Expected behaviour

Since there are no .fsproj or .fs files or anything to do with F#, I don't think Ionide should try to start up or do anything, and importantly it shouldn't raise the F# Solution Explorer.

Screenshots

n/a

Machine info

Additional context

n/a

olivercoad commented 2 years ago

See #1041 for more info.

I still don't know why #1401 wasn't merged. @Krzysztof-Cieslak

smcl commented 2 years ago

Ah @olivercoad you're right, sorry I didn't realise. It does indeed seem that this activation event can catch all sorts of non-F# projects:

    "workspaceContains:**/*.sln",

1401 is closed though and it doesn't seem like it shouldn't have been, since .sln doesn't necessarily imply "F#" (and as we can see from my example, it doesn't even necessarily imply .NET).

Krzysztof-Cieslak commented 2 years ago

Duplicate of #1041

smcl commented 2 years ago

@Krzysztof-Cieslak Would you mind giving a quick explanation why Ionide shouldn’t behave as I and a couple of others here and on #1041 think it should? You've acknowledged the issue at hand here:

It’s .Net project so I assume it has .sln file. As stated before in the thread presence of .sln file is one of the activation events of the plugin

Is there an issue with removing the **/*.sln activation event that causes this that I am not seeing? Because honestly this behaviour is a little bit over-eager. Right now Ionide thinks EVERY folder that contains a Visual Studio .sln somewhere in it is an F# project, when it could be C# or D (as described in my example) or anything else. It is quite an annoying issue with, apparently, a very easy fix that doesn’t seem to interfere with Ionide's ability to activate when it encounters F# projects (.fsproj files).

olivercoad commented 2 years ago

This is not a duplicate of #1041. That issue addressed just one symptom. https://github.com/fsharp/FsAutoComplete/pull/668 was always just a band-aid fix and was never meant to be the only measure taken. I'm quite disapponted to see this issue and 1401 be closed without an explaination and would still like to see it merged.