It just uses the basic "console context", so if for instance you are writing a post-function, you don't have issue available.
As you are aware, scripts for different extension points have different compile contexts. The problem is that a) there are quite a lot, and b) worse, several of them are dynamic. For instance if you are adding an event listener, the type of event varies depending on what events you are listening for, and the compile context for script fields has different expected return types depending on the indexer you use.
So the way I see this working, is that there would be a link from the place where the file is used to the script editor, and using that link would set the correct compile context.
If you opened it a different way then you would get the vanilla context.