-
Notifications
You must be signed in to change notification settings - Fork 60
vscode csx
All of the info here is about how to setup vscode to debug C# script files (.csx) and provide intellisense for them.
This is an optional step, but can be very helpful when developing your .csx files.
- If you haven't installed
dotnet-script
yet, see this page. - Install the official C# vscode extension.
-
DO NOT install the vscode C#
Dev Kit
extension.
-
DO NOT install the vscode C#
- Re-enable omnisharp (see directly below).
A recent vscode c# extension update removed omnisharp (which we need). It's easy to re-enable though: https://github.com/StateSmith/StateSmith/issues/221
This is now much easier with the StateSmith.Cli tool.
- run
ss.cli
- select
Set up vscode for StateSmith & csx files.
option. - select
vscode for C# script debugging and intellisense
- now use the vscode command pallette to run
OmniSharp: Restart OmniSharp
or restart vscode. - troubleshooting steps below if you have issues.
Recommend using ss.cli (above) if you can for this.
In your vscode project directory, run the below command.
dotnet script init delete_me_dummy_file.csx
This will update the .vscode/launch.json
file to enable C# script debugging and code completion.
💡 TIP! You can improve the launch.json file here.
You can delete the delete_me_dummy_file.csx
file afterwards.
rm ./delete_me_dummy_file.csx
It will also create an omnisharp.json
file for vscode. The omnisharp.json
file should normally not be committed to a repo (.gitignore) as different users may have different versions of dotnet installed.
Now use the vscode command pallette to run OmniSharp: Restart OmniSharp
or restart vscode and you should be good to go.
If your directory has other C# projects/solutions in it, you'll likely need to tell omnisharp to look at .csx files.
Run vscode command: OmniSharp: Select Project
and select CSX
for the correct directory.
See troubleshooting below for more details.
If you've done all the above steps, you might need to tell OmniSharp
which project to select.
Use the vscode command pallette to run OmniSharp: Select Project
and select CSX
for the correct directory.
This problem can happen if OmniSharp
auto selects the a Visual Studio solution in the same directory.
More troubleshooting specific to just .csx files: https://github.com/StateSmith/StateSmith/wiki/csx%E2%80%90troubleshooting