ability to switch between build configurations
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.
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.
I have this older PR that can be spruced up https://github.com/ionide/FsAutoComplete/pull/1065 that is a start
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.
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