ionide / Ionide-vim

F# Vim plugin based on FsAutoComplete and LSP protocol
MIT License
174 stars 21 forks source link

ability to switch between build configurations #85

Open joprice opened 3 months ago

joprice commented 3 months ago

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.

baronfel commented 3 months ago

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:

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.

TheAngryByrd commented 3 months ago

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

joprice commented 3 months ago

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 commented 3 months ago

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