-
Notifications
You must be signed in to change notification settings - Fork 418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HostObjectType/GlobalsType for .csx files is unknown for custom script runners #1171
Comments
This is a very reasonable request, and is something that is definitely on the radar. Unfortunately, the support for this is somewhat complicated, due to current limitations in Roslyn. The main problem is that at the moment Roslyn APIs require the globals type to be passed in as As a short term fix we could allow passing in the assembly+type of the globals via script configuration, that you would configure in an |
That would perfectly fit my needs !My script runner is also a I have also a class that
It would be no problem to create the omnisharp.json as well. Additionaly I didn't think about the problem that So would you like to implement the discussed solution, or should I give it a try and create a pull request ? |
Hi Filip! Any update on allowing to specify a custom globals type? In my use case, I allow to configure my application via C# scripts (using monaco editor + monaco-languageclient + omnisharp). These scripts get executed at runtime via CSharpScript.Create(...) passing a specific "globals" types so that the user can directly access the implicit members of this type. This works great at runtime, but I'm struggling to give proper intellisense experience in the monaco editor due to the fact that it's not possible to customize the globals type through omnisharp.json. Is this still blocked by a poor support in the Roslyn apis? Any workaround? Also, is there a way to specify LangVersion and Nullable (NRT) in omnisharp.json for a script environment? I have managed to configure that for a regular c# project via .csproj file, but not for a script project. Thanks for all the good work in this repo. Germán |
Hi together,
I'm using omnisharp + vscode to execute c# scripts that automate my application.
to execute my script I had to write my own script runner because it is required to have my own host/globals object that provides access to the 'application scripting api' form iside a script.
That works quite good but there is one feature missing that would make writing scripts much simpler.
You do not get language server support for the globals object in the root of a script, because omnisharp does not the type ?
From my first view of the source code of omnisharp-roslyn I thought that it could be possible, but there is this no way to set this
GlobalsType
in theScriptContextModel
class, as it is comming from the ProjectInfo.I followed the way up the call tree to find out the if it could be possible to set this type in any way, but came the result that it is not :-( because the projectInfo is always created with the
CommandLineScriptGlobals
type.Can anybody tell me if I am wrong ?
If not does anybody else think that this should be possible or am I the only one with this problem.
In my oppinion there could be two possible ways to implement that.
I would choose the second one.
Please let me know if I am completely wrong, and if not, is the team interested in solution.
Thanks in advance
Daniel
The text was updated successfully, but these errors were encountered: