Giter VIP home page Giter VIP logo

Comments (10)

filipw avatar filipw commented on June 15, 2024 8

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

from vscode-csharp.

hickford avatar hickford commented on June 15, 2024 4

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

from vscode-csharp.

hickford avatar hickford commented on June 15, 2024 2

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.

from vscode-csharp.

filipw avatar filipw commented on June 15, 2024

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.

from vscode-csharp.

DustinCampbell avatar DustinCampbell commented on June 15, 2024

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

from vscode-csharp.

peder avatar peder commented on June 15, 2024

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?

from vscode-csharp.

filipw avatar filipw commented on June 15, 2024

@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 📚

from vscode-csharp.

peder avatar peder commented on June 15, 2024

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.

from vscode-csharp.

filipw avatar filipw commented on June 15, 2024

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.

from vscode-csharp.

hickford avatar hickford commented on June 15, 2024

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

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

from vscode-csharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.