Application scripting classes/objects, Extensibility Studio and IntelliSense

Here is my use-case:
I want to be able to write a few classes within my C# application that expose a simple API to scripting.
I would like to be able to create, edit and debug scripts using the Extensibility Studio program.
I want the exposed class(es) to show-up in the Extensibility Studio editor so that Intellisence works for C# and VB.NET and I can see the methods and properties.
I need to be able to run multiple instances of my application and be able and edit, run… scripts in each of them (you have already helped here).
I don’t want to modify extensibility Studio for each application but rather have it as a standard tool that can be used with whatever application calls it.
Question:
I have read the documentation with the Scripter and added a simple class to the Debugger > Debug My Script example.
public class MyItem
{
public MyItem(string text)
{
this.Text = text;
}
public string Text;
}
scriptRun.GlobalItems.Add(new ScriptGlobalItem("MyItem", obj: new MyItem("hello")))

However, when I click Start Debugger, I can never access or see MyItem in the editor.
This seems to be related to the issue “Code Completion (Intellisense) from custom classes”. In which you say, “For code editor code completion you either need to register assembly that contains a class with all the methods, or just a source code of the file you'd like to include for code completion.”
The application assembly contains an instance of my scripting API class and so how to I properly register it and how do I expose only certain classes or objects? Or do I have to create a separate DLL that references my exe and contains just the exposed scripting API?
Can you provide a working example because there is something that I don’t understand.
Once this is working I can complete my evaluation.
Many thanks in advance,
Matthew
Hi,
I've sent an email with suggestions how this can be achieved.
regards,
Andrew
I am also intresting in the solution for this use case. Could you send me the solution too? Thank you.
Regards,
Pablo
I am only interested in the edition part of this use case, using the syntax editor, because the scripting part I am already doing it myself using roslyn.
Could you send me your suggestions?
Regards,
Pablo
Hi Pablo,
I've sent an email with suggestions how this can be achieved.
regards,
Andrew
Could you please send me your suggestion too?
Thank you in advance.

Regards,
Johannes
Hi Johannes,
I've sent an email with suggestions how this can be achieved.
regards,
Andrew
Hello,
The fastest solution is to pass script project file to ExtensibilityStudio instead of script file, and list either additional references in this project, or additional source code.
I've done small modifications here:
debuggerProcess = Process.Start(
new ProcessStartInfo
{
UseShellExecute = false,
FileName = pathToDebugDemo,
Arguments = string.Format(
"""-masterfile={0}"" ""-masterprocess={1}"" ""-mastercode={2}"" ""-ipcPortName={3}"" ""-ipcObjectUri={4}""",
dir + @"Resources\Scripter\CallMethod.csproj", // changed line, passing project with additional code instead of script file
Process.GetCurrentProcess().Id,
scriptRun.ScriptHost.ExecutableModulePath,
ipcPortName ?? string.Empty,
ipcObjectUri ?? string.Empty),
});
and added Global.cs to CallMethod.csproj, so code editor can provide a code completion for classes defined in global.cs.
Alternatively it should be possible to pass additional reference (which would have a MyItem class defined there), or additional code between DebugMyScript and ExtensibiltiyStudio via command line parameters, this way you will not need to create a separate script project. Happy to modify DebugMyScript/ExtensibilityStudio to show how it can be done, should it be needed.
I've uploaded script files (CallMethod.cs, CalMethod.csProj and global.cs) here:
http://www.alternetsoft.com/forum/scriptfiles.zip
regards,
Andrew