Application object references in AlternetStudio.Python.Wpf demo not showing up in IntelliSense

Playing with the demo suite, I tried to expose an object from the application to script in the AlternetStudio.Python.Wpf demo. The object is exposed and the methods work but the object does not appear in IntelliSense. Oddly, if I do the same thing in the ObjectReference quickstart it works perfectly. I create and add the object in MainWindow.Scripter:

        private void InitializeScripter()
        {
            scriptRun = new ScriptRun();
            IScriptApi api = new ScriptApi();
            var scriptGlobalItem = new ScriptGlobalItem("Script", api);
            scriptRun.GlobalItems.Clear();
            scriptRun.GlobalItems.Add(scriptGlobalItem);
        }

I saw several other posts here that seem to indicate there may be other steps but all of those were in C#/VB.Net and nothing like that is in the ObjectReference quickstart. What am I missing?
Thanks,
Nathan

Hi Nathan,

In AlternetStudio.Python.Wpf demo, we should be using PythonNETParser instead of PythonParser.

PythonParser can only provide code completion for parsed .py files, while PythonNETParser also understands .NET types/methods.

Here is a code that needs to be changed in MainWindow.Files.cs:

        var parser = new PythonNETParser(); // as PythonhParser
        parser.CodeEnvironment = scriptRun.CodeEnvironment; 

Please let me know if it works for you.

Kind regards,
Dmitry

Thank you Dmitry, that makes sense. That change worked perfectly.

Best regards,
Nathan

1 Like