Skip to content
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

Support "csx" #23

Closed
prasannavl opened this issue Jan 27, 2016 · 10 comments
Closed

Support "csx" #23

prasannavl opened this issue Jan 27, 2016 · 10 comments

Comments

@prasannavl
Copy link

Support C# script files.
Would be pretty great if csx is supported by OmniSharp.

Aside: VS 2015 Update 1 has bundled csi.

@filipw
Copy link
Contributor

filipw commented Mar 23, 2016

I would like to bump this and 👍 this.

There is CSX support already in OmniSharp (via scriptcs) and Atom uses it, and you can "fake-force" it in VS Code by adding an empty project.json next to your CSX. You will get CSX intellisense, including cross-CSX file navigation and it will respect #r directives and even recognize scriptcs-style NuGet references (by convention).

That said, this whole experience should be normalized (after all, scriptcs is a bit opinionated about some things). As I mentioned in a call a while ago I'd like to see "basic" CSX support as first class citizen in OmniSharp and then scriptcs (with its custom host and what have you), being the superset of regular CSX, could be an opt in plugin.

I have lots of PoCs going on including one that I am working on right now so hopefully we can bring this in soonest.

@DustinCampbell - hopefully it makes sense? we can even start small, single file only and grow from there

@hickford
Copy link

hickford commented May 12, 2016

I've installed the 'csharp' extension for Visual Studio Code. It would be neat if it fully supported .csx files from C# Interactive csi.exe. Syntax highlighting works fine, but there's no autocomplete or debugging.

ext install csharp

@filipw
Copy link
Contributor

filipw commented Dec 20, 2016

I think this can be closed now that OmniSharp/omnisharp-roslyn#659 has been merged.

There are still some issues and ongoing work (see https://github.com/OmniSharp/omnisharp-roslyn/issues?q=is%3Aissue+is%3Aopen+csx+label%3Acsx) but those can be tracked separately in the omnisharp-roslyn repo.

@DustinCampbell
Copy link
Member

Yeah, I agree. The latest beta should be much better.

@DustinCampbell DustinCampbell modified the milestones: 1.6, future Dec 20, 2016
@peder
Copy link

peder commented Jun 15, 2017

There is CSX support already in OmniSharp (via scriptcs) and Atom uses it, and you can "fake-force" it in VS Code by adding an empty project.json next to your CSX. You will get CSX intellisense, including cross-CSX file navigation and it will respect #r directives and even recognize scriptcs-style NuGet references (by convention).

I know I'm lazily posting on a closed issue, but I can't for the life of me find details on this convention. Can someone point me to this reference material or share it here for posterity's sake?

@filipw
Copy link
Contributor

filipw commented Jun 15, 2017

@peder Since last year OmniSharp has no support for scriptcs-style scripting (i.e. nuget packages via packages.config). Instead, we only support standard CSI.exe scripting. This is the official script runner that is built as part of the Roslyn repo and ships with MSBuild tools.

At the moment the only supported way to provide references to external assemblies in CSI is to use #r references, and that is what OmniSharp supports.

Aside from CSI, OmniSharp also supports Azure-Functions like references via project.json (have a look at the .NET Core script runner here https://github.com/filipw/dotnet-script) and soon it will support #r "nuget package" references (PR here - OmniSharp/omnisharp-roslyn#813).

I hope this helps - and apologies for the confusion. Updating the documentation to put all of this information together is on my list 📚

@peder
Copy link

peder commented Jun 15, 2017

Awesome update--thanks. I was giving C# Scripting a whirl last night and started hitting some walls. Despite those issues, I have to think the *.csx is bound to grow, especially when/if Node.js developers dabble in .NET.

I'll check out the Azure Functions approach. Thanks again.

@filipw
Copy link
Contributor

filipw commented Jun 15, 2017

I think the confusion comes from the fact that - due to the popularity of scriptcs project - folks equate C# scripting / CSX with what scriptcs offers.

In reality, scriptcs is a de facto dialect on top of standard CSX scripting and offers some extra features over CSI.exe (it's a superset of standard scripting), mainly packages.config integration and custom # directives. This was partially supported in OmniSharp a while ago, but due to various problems, it was removed. What we decided to have in OmniSharp instead, was full support for standard Roslyn (CSI) scripting, and to do it well.

So if you stick to CSI-only scripting, you will have excellent language support in OmniSharp - on par with "full" C# - refactoring, go to definition, go to metadata, find references, intellisense and so on.

@hickford
Copy link

hickford commented Jun 15, 2017

It's unfortunate there's confusion between scriptcs and csi.exe "C# Interactive". Ideally both would clarify the difference in their documentation:

  1. Document compatibility with csi.exe scriptcs/scriptcs#1162
  2. https://github.com/dotnet/roslyn/wiki/Interactive-Window#command-line-repl

@hickford
Copy link

Here's a feature request for .csx C# script support in Visual Studio https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/7848117-add-scriptcs-csx-intellisense-and-debugging-in-v

You can run .csx scripts with C# Interactive (csi.exe). It would be neat if you could debug them in Visual Studio.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants