michaelb / sniprun

A neovim plugin to run lines/blocs of code (independently of the rest of the file), supporting multiples languages
MIT License
1.49k stars 47 forks source link

Issue: Support for c# #201

Closed MordechaiHadad closed 1 year ago

MordechaiHadad commented 1 year ago

Describe the language you want support for (compiler, specificities) I'd like an interpreter for C# that uses roslyn and that work with detected filetypes cs]

Support Level to achieve There is currently no support for C#

Additional context Can't think of any

michaelb commented 1 year ago

Sure :-) I am a complete novice to C# and roslyn, is there any REPL that I should be aware of (I could integrate it into sniprun modulo some extra work), or is the framework solely 'compiled' ?

MordechaiHadad commented 1 year ago

C# is only compiled but there are third party tools like this one https://github.com/waf/CSharpRepl But don't really know if its any benefit to have REPL

michaelb commented 1 year ago

It's helpful if the REPl is very stable, though interpreted languages benefit most. I'll leave it at that for now, non-REPL and 'the usual' support (bloc-level)

MordechaiHadad commented 1 year ago

fair enough! thank you

michaelb commented 1 year ago

Csharp based on mono is released along with v1.2.9. You can simply update sniprun and have things working, though i've made a (fairly reasonable) assumption: that the filetype (output of :set ft?) for csharp files was 'csharp' or 'cs'.

(Moreover 'cs' may conflict with coffeescript, so you may need to put 'CSharp_original' in the 'selected_interpreters' configuration field if your filetype is 'cs'. More info in the [wiki](https://michaelb.github.io/sniprun/sources/README.html#configuration if it doesn't work out of the box)

MordechaiHadad commented 1 year ago

why exactly mono? @michaelb

michaelb commented 1 year ago

Sniprun uses the csc compiler that is, as I understand it, roslyn under the hood. I still need mono to run the produced executable. So I'm not sure what is the difference, maybe better error message ? idk

MordechaiHadad commented 1 year ago

fair enough! thank you