Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dynamic Languages Toolkit (DLTK) » Atomic Types and global methods
Atomic Types and global methods [message #928894] Sun, 30 September 2012 23:45 Go to next message
Scot Malloy is currently offline Scot Malloy
Messages: 2
Registered: September 2012
Junior Member
I'm looking for a bit of advice on the best way to implement atomic types and global methods directly in the model (not AST) for a proprietary language. We've already got a DLTK (v2) based plugin deployed, but have dodged features requiring type knowledge to-date. Now we need to get some type knowledge into the plugin to support more useful code completion and documentation (among other things).

The language itself does not currently allow for user source definition of types (but does allow for user instantiation of the rather large number of built-ins), so there are no corresponding source files for the types and global methods (and while the global methods could be done this way using the short list of primitive types including the generic "Object", the much larger list of specific class and interface types can't be defined in the language syntax itself, since it lacks any kind of type definition statement).

I'm guessing, but in this situation, is the org.eclipse.dltk.core.model extension point is the way to go? (or is there a better way?).

If the model extension point is the suggested approach, where/how in the model would these types and global methods best be inserted (i.e. as children of what model object type in the model hierarchy?). Which classes in the current model package make sense to instantiate/extend for source-less type and method definitions (or should I implement my own IType and IMethod implementing classes?).

Cheers
Re: Atomic Types and global methods [message #958545 is a reply to message #928894] Thu, 25 October 2012 23:26 Go to previous messageGo to next message
Alex Panchenko is currently offline Alex Panchenko
Messages: 342
Registered: July 2009
Senior Member
Hi Scott,

Yes, you can use IModelProvider to inject your own IProjectFragment,
which creates IScriptFolders and IScriptFolder creates BinaryModules.

Then you contribute IBinaryElementParser to "playback" your types and
members, so DLTK will create corresponding binary elements.

Regards,
Alex
Re: Atomic Types and global methods [message #1095331 is a reply to message #958545] Mon, 26 August 2013 19:46 Go to previous message
Scot Malloy is currently offline Scot Malloy
Messages: 2
Registered: September 2012
Junior Member
Alex Panchenko wrote on Thu, 25 October 2012 23:26
Hi Scott,

Yes, you can use IModelProvider to inject your own IProjectFragment,
which creates IScriptFolders and IScriptFolder creates BinaryModules.

Then you contribute IBinaryElementParser to "playback" your types and
members, so DLTK will create corresponding binary elements.

Regards,
Alex


A belated thanks, Alex.
I assumed the use of IProjectFragment, IScriptFolders, etc. implied that all of this hangs off of each relevant IScriptProject.

That approach works, except when the end-user doesn't already have a plugin-associated project open and they open a plugin-associated source file directly (via File->Open File), which in turn causes the parser to look for BinaryModules that aren't there. It appears that since there is no project, there is no place to hang the IProjectFragment from.

...Or...

is there a way to hang the IProjectFragment (and subsequent IScriptFolders and BinaryModules) off of the IScriptModel instead of each IScriptProject? Or is there some other way of doing this that anchors itself at the IScriptModel level?

Previous Topic:How about incremental parser!
Next Topic:Open declaration feature
Goto Forum:
  


Current Time: Thu Jul 31 22:00:51 EDT 2014

Powered by FUDForum. Page generated in 0.01954 seconds