OmniSharp ignoring #if / #endif blocks in Visual Studio Code (0.1.0 - 0.5.0)

422 views Asked by At

Several people at my studio are trying Visual Studio Code for Unity development on OSX, however all code within #if/#endif blocks is ignored by OmniSharp it seems like.

Within the #if/#endif block there is no intellisense, no "go to definition", no tracking of references, etc. As far as the rest of the OmniSharp features are concerned: the code within those blocks might as well not exist. Having no intellisense or "go to definition" gets to be bad enough that sometimes I have to switch IDEs when I'm writing code that is within #if/#endif blocks.

Is there something I can do to fix this? Is this something OmniSharp knows about already? I can't find anything through Google about this problem, so I feel like I'm the only one seeing it (along with everyone else on my project trying to use Visual Studio Code).

1

There are 1 answers

2
Quido3 On

I reported this same bug to VSCode and in response they moved it to OmniSharp's Github page; It is caused by OmniSharp's lack of support for MSBuild files, so it just ignores <DefineConstants> inside .csproj files. I think there has been some discussion about fixing this, but I have not seen any time-frame or work done.

I had to abandon using VSCode for the time being, since many plugins rely on those tags. I have been trying to find some other way to define those constants so that the editor would see them, but none of them have been fruitful yet.