CShell icon indicating copy to clipboard operation
CShell copied to clipboard

Tutorial is outdated and missing information about extension points

Open tsebring opened this issue 9 years ago • 3 comments

Tutorial.csx is somewhat obsolete with the new developments in CShell (ex. references Shell.Repl.Clear() and Mono.CSharp as the compiler etc). It would be nice if there could be some information/examples of extension points (ex. ITool, IModule, IReplCommand, ISink). Are these for internal use only or can we extend CShell with these? I would help write it up but I dont understand them myself and struggling to see if I can extend the UI with a new ITool.

Thank you Luke for your great work on CShell!

tsebring avatar May 08 '15 21:05 tsebring

@tsebring, I agree those things need to be updated, plus a tutorial in how to write extensions is needed indeed.

But there's one big problem, the way sinks work right now is not very nice, they are not very extendable, I do want to radically rewrite how sinks are integrated into CShell and used. See #19

However, you can start hacking on extensions, I'd start with implementing a sink. Feel free to ask here if you get stuck.

lukebuehler avatar May 08 '15 21:05 lukebuehler

Hey Luke,

I'm getting an error message when trying to call my custom sink: "The requested sink doesnt exist ... make sure the URI is spelled correctly and the module containing the specified sink is loaded."

I've created a new binary and defined a module, sinkprovider and sink based off the XhtmlSink in CShell: [Export(typeof (IModule))] public class Module : ModuleBase { ... }

[Export(typeof(ISinkProvider))] public class SinkProvider : ISinkProvider { ... }

Loading the binary in CShell and putting it in the "Modules/" folder both give the same error and the debugger wont catch any calls to the sink provider.

Am I missing something about how these extensions get loaded?

Edit. Actually I think I figured out the problem. They binaries need to be located in the "Modules/" directory but there seem to be a small bug in the code in AppBootstrapper.Configure: var exeDir = Assembly.GetExecutingAssembly().Location;

I believe this should be: var exeDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

tsebring avatar May 08 '15 22:05 tsebring

Sorry for the long delay, I finally got around to work on this. Yes, there was indeed a bug with the exeDir. I fixed it as well.

Also take a look at the sink projects they show how to properly implement a sink, there are still a few kinks but I'm close now.

Example: https://github.com/lukebuehler/CShell/tree/sinks/Src/CShell.Sinks.Xhtml

lukebuehler avatar Jun 19 '15 21:06 lukebuehler