Ionide-vim icon indicating copy to clipboard operation
Ionide-vim copied to clipboard

ability to switch between build configurations

Open joprice opened this issue 1 year ago • 4 comments

I'd like to be able to switch between Debug and Release mode, to, for instance, see errors in branches guarded by #if DEBUG guards.

Describe alternatives you've considered

I tried setting the configuration in the fsproj file, hoping that the change would be detected and read by fsautocomplete, but it had no effect. I'm not that familiar with the build format, so I may have not configured it correctly, or perhaps fsautocomplete isn't parsing that config.

joprice avatar Jun 18 '24 02:06 joprice

This is a long-standing bug in FSAC itself, actually - we only ever handle Debug configurations currently. I tried looking for an issue for this, but we don't have one right now. This is kind of a fundamental undertaking, and it would require a few different components the learn how to handle the different configurations:

  • https://github.com/ionide/proj-info would need to learn to return a useful view of the configurations of a project from the workspace/MSBuild side of things
  • https://github.com/ionide/FsAutoComplete would need to learn to work with that new view and correctly choose the correct view of the current file when doing operations like completions, error reporting, etc
  • Ionide for VSCode, ionide-vim, and all the other FSAC-based editors would need to surface some kind of UI/configuration/etc to let users pick the Configuration to use for each project

so it's a bit of a project, but one worth doing. I'll try and write something up on proj-info to capture some of the use cases we'd need to support.

baronfel avatar Jun 18 '24 03:06 baronfel

I have this older PR that can be spruced up https://github.com/ionide/FsAutoComplete/pull/1065 that is a start

TheAngryByrd avatar Jun 18 '24 13:06 TheAngryByrd

I'd be willing to chip him however I can!

On the current state of things, checking that pr, I see ProjectLoader.globalProperties being made dynamic. As I'm pretty new to fsharp and dotnet, is there any way I can at least set the Configuration statically by modifying the fsproj file, or providing some other config file or env var in the project's workspace? That would at least enable the workflow of iterating against the release configuration without requiring the full tooling integration.

joprice avatar Jun 20 '24 12:06 joprice

Ah looks like that's just a local list. I thought it was being parsed from the env somehow: https://github.com/ionide/FsAutoComplete/blob/8d6120c78bbb64ea7bf764af109b21b855ac4d0a/src/FsAutoComplete.Core/Consts.fs#L7

joprice avatar Jun 22 '24 09:06 joprice