Posted 8 years ago by Adolfo Marinucci
Version: 15.1.0192
Avatar

Hi Team,

I need to integrate IntelliPrompt for IronPython. As you certanly know IronPython is the .NET integration of Python. Problem I'm facing is that IntelliPrompt can't reach .NET types when "resolve" and I don't know how to provide info it needs.

My attempt is to add my custom IModuleDefinition to ActiveModules collection of project:

var language = new PythonSyntaxLanguage(PythonVersion.Version2);
var prj = language.GetService<IProject>();
prj.Resolver.UnknownReturnTypeReferenceCallback = MyUnknownReturnTypeReferenceCallback;

prj.ActiveModules.Add(new Scripting.AssemblyModuleDefinition(Assembly.GetExecutingAssembly()));

 where AssemblyModuleDefinition class is defined like this:

    public class AssemblyModuleDefinition : IModuleDefinition
    {
        public Assembly Assembly { get; private set; }
        public AssemblyModuleDefinition(Assembly assembly)
        {
            if (assembly == null)
                throw new ArgumentNullException("assembly");

            Assembly = assembly;
        }

        ///......omitted

        public IFunctionDefinitionCollection Functions
        {
            get { return null; }
        }

        public IImportDefinitionCollection Imports
        {
            get { return null; }
        }

        public System.Collections.Generic.IEnumerable<string> PublicNames
        {
            get { return new string[] { }; }
        }

        public ITypeDefinitionCollection Types
        {
            get { return new AssemblyTypeDefinitionCollection(Assembly.GetTypes().Select(_ => new AssemblyTypeDefinition(_))); }
        }

        public IVariableDefinitionCollection Variables
        {
            get { return null; }
        }

        public string Key
        {
            get { return Assembly.FullName; }
        }

        public bool IsBuiltin
        {
            get { return false; }
        }

        ///.....omitted...
    }

In other words I'm trying the feed the resolver with types that come from .NET assemblies instead of normal .py files.

When I run this code I see that SyntaxEditor calls the Key property of the custom module defintion several times but nothing more.

Can you suggest a correct way to proceed? Is there any other approach to address my task?

Please let me know if you need further info,

Thanks

Comments (1)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Adolfo,

Can you write our support address and we'll communicate with you privately there to discuss things in further detail?  In your email, please provide an example of .NET code you'd like accessible in the Python code, and a Python snippet showing how it would ideally be imported and accessed/used.  Thanks!


Actipro Software Support

The latest build of this product (v18.1 build 0233) was released 4 years ago, which was after the last post in this thread.