ionide / ionide-vscode-fsharp

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

No syntax highlight in VSCode code-workspace for mixed C# & F# solution #1882

Open ilog2000 opened 1 year ago

ilog2000 commented 1 year ago

Describe the bug

I have monorepo with a dozen of subfolders and subprojects including C# app, C# libs, F# libs, Typescript React app, React component libs, azure pipelines, and scripts. In the root there is app.sln including all csproj & fsproj from subdirectories. I also prepared server.code-workspace file for VSCode to work with server side code. When workspace is loaded and code analysis finished, I have no syntax highlight in *.fs files.

Some related details:

  1. In VSCode status bar there is an icon of "C# Project Selector" 1
  2. When click on it, no fsproj files suggested, only csproj ones 2
  3. As a result I see "Not in F# Project (Still loading...)" forever, and no syntax highlight 3
  4. If the first item in server.code-workspace is csproj, then F# file is processed by C# analyzer and the file is full of errors
  5. If I include root (".") into code-workspace or run VSCode without code-workspace, then I am able to select app.sln in "C# Project Selector" and highlighting works. But in this case analysis is running on all (more than thousand) files in monorepo and it takes like 15 minutes on my PC

I am not 100% sure this is exactly Ionide issue, but need to start somewhere. Either I could simply not know about some extras in settings, please give me a clue then.

Machine info

vzarytovskii commented 1 year ago

Iirc, iodide doesn't fully support workspaces, @baronfel ?

ilog2000 commented 1 year ago

I was able to work around the issue:

  1. Created solution subdirectory
  2. Copied app.sln into it and prefixed all project paths with ..\
  3. Added solution into the list of workspaces in server.code-workspace file and put "FSharp.workspacePath": "./solution/app.sln" into settings section

I can conclude that this is OmniSharp issue - having solution file outside workspaces, it cannot access it and ignores all non-C# projects.

If there is a way to force OmniSharp to reference solution or not to ignore fsproj with settings, please do that. Otherwise feel free to close this ticket.