-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
[Feature Request] Allow script globals object type to be passed via .rsp file #23421
Comments
I know this is almost four years old, but I'd like add my support for this feature as well. We run C# scripts in Abbot and we want people to be able to have a nice experience editing Abbot scripts in their local editor. But we also provide a nice global type to the runner. So anyone editing these scripts locally gets a bad experience. |
@jonsequitur have any of the libraries https://github.com/dotnet/interactive has built on top of scripting already solved this problem? |
We haven't spent a lot of time on script automation yet (though it's under discussion). We don't have any experiences based around .csx. As for adding top-level variables that users can interact with in a script, it's pretty simple. This is what we do in .NET Interactive rather than using the globals type. |
How do you add top-level variables for a script? |
We have an API for this in .NET Interactive. Here's the implementation: |
@jonsequitur Ah, I see. That seems to be a runtime injection then, right? What I'm looking for is a way to let people edit Abbot scripts in VS Code with full Intellisense. Right now, it's difficult to tell VS Code about the top-level variables that we inject. |
It is runtime but it enables Intellisense if the script engine is running. |
Version Used:
2.4.0
Expected Behavior:
When using an
.rsp
file withcsi
, I'd like to be able to set/pass globals object type into the script runner. I'd imagine something like:The type could be searched for in the current load context, or there could be an additional configuration parameter for providing the path to the globals assembly.
Actual Behavior:
It is not possible to pass own globals object type.
csi
hardcodesCommandLineScriptGlobals
as globals type.The functionality would offer excellent flexibility for script authors.
This could also help with tooling for custom script hosts. An
.rsp
file with host-specific configuration of usings, references and globals type could be parsed by the editor and relevant host-specific language services/intellisense could be offered - which will have a great, positive impact on the C# scripting ecosystem.Spun off from #23402 (comment)
cc @tmat
The text was updated successfully, but these errors were encountered: