Unless I misunderstand you, you are thinking about trying to compile the query in each mode to see which works, but I was more thinking about a simple pre-compile check to guess which mode the user wants and then to proceed as if the user had selected that mode.
For example, if I write a query which includes other classes, but I leave out the main keyword, (which is the trigger for Program mode) then I would expect this to try (and fail) to compile as if I had selected 'C# statements' mode.
Unless I misunderstand you, you are thinking about trying to compile the query in each mode to see which works, but I was more thinking about a simple pre-compile check to guess which mode the user wants and then to proceed as if the user had selected that mode.
For example, if I write a query which includes other classes, but I leave out the main keyword, (which is the trigger for Program mode) then I would expect this to try (and fail) to compile as if I had selected 'C# statements' mode.