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

Tutorial is outdated and missing information about extension points #71

Open
tsebring opened this issue May 8, 2015 · 3 comments
Open
Milestone

Comments

@tsebring
Copy link

tsebring commented May 8, 2015

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!

@lukebuehler
Copy link
Owner

@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 lukebuehler added this to the v0.2 milestone May 8, 2015
@tsebring
Copy link
Author

tsebring commented May 8, 2015

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);

@lukebuehler
Copy link
Owner

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

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

2 participants