Open benblo opened 4 years ago
Sorry for the delayed response.
While the extension can be reworked to handle csx. It is a bit challenging for various practical reasons though possible. However I would encourage you to use different approach not based on VS extension.
Install cs-script from choco (https://chocolatey.org/packages/cs-script). This will bring you the ability to load any file file in VS via on-fly generated project (csws.exe /c DebugVS2019.cs %1
).
install https://chocolatey.org/packages/shell-x
(another product from CS-Script family). This will bring you the ability to configure shell extension for any file type.
I have attached the configuration files for x-shell handlers of *.csx extension.
A simple registry key will do the trick:
HKEY_CLASSES_ROOT\.csx\shell\Run\command\(Default):cscs.exe "%1"
The n you can have execute as the extension is compiled for older I can have a look have
Hey, so I already have all that installed & setup, sorry if I wasn't clear.
My problem is, once I've opened the .csx file in the CS-Script-generated solution, Intellisense support is not as good as for a regular .cs file. As I've mentioned, I'm unsure if the problem is with VS's Intellisense or Resharper's Intellisense, as R# bypasses/disables a lot of the builtin VS features.
So my alternative question was, instead of using the .csx extension, could I use for example a .x.cs extension? This way all the regular tools would see it as a proper .cs extension, and it's "only" a matter of hooking up Explorer support (right-click and double-click) for .x.cs.
NP. The Intellisense is fully provided by VS as well as syntax highlight. Thus there is nothing that CS-Script extension can do about it.
BTW Resharper is a well known for is nasty manners when it comes respecting the original user experience of the hosting environment (VS).
As for .x.cs
then of course you can use it. CS-Script is completely neutral to the file extensions. And "hooking up explorer support" can be easily done with shell-x and registry key for double-click.
Apologies for posting this in the Sublime repo, but I couldn't find your repo for the "CS-Script Tools" VS extension. So I'm using .csx extension, because of the ease of just double-clicking in explorer, and right-clicking for more, eg edit/debug in VS when Sublime doesn't cut it. (I spend the rest of my non-script life in C# as well so having that context menu for regular .cs files is kind of awkward.)
2 issues:
Alternatively... could it be possible to use a sub-extension, like myscript.x.cs ? Double-clicking the file in the explorer probably wouldn't be able to differentiate past the last extension, but I think the context menu thing is from another project of yours, would that work?