Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [recommenders-dev] [snipmatch] headless API for generating code snippets?


On Aug 30, 2013, at 10:47 AM, stefan.prisca@xxxxxxxxx wrote:

Hi Marcel,
Can you explain this a little please? I don’t think I fully understand what you mean by “work towards a headless snippet api based on your grammar and the generated EMF model”. ​


Sure. At the moment we create the JFace templates by doing our own string concatenations using StringBuffers. The code is hard to read and maintain and bugs hard to spot. I was thinking whether we could build a small api on top of your emf grammar that makes creating snippets much simpler and less error prone. 

for instance I was thinking of an API like this

TemplateBuilder b = new TemplateBuilder();
b.addImport(ITypeName)
b.newVariableDeclaration(String varName, IMethodName ctor, String… parameters) 

etc. A bit like working with the AST API of JDT. Can we build such an API on top of your API?

Best,
Marcel



As for the dependencies, they are needed to generate the language infrastructure. I’ll need to do some more research on this matter.

Exactly as Andreas said. Run-time is different to generation-time. I think most of the dependencies stem from the generator that needs these libraries to be present. The MWE launcher is maybe not needed at runtime when using your APIs (I just picked a random dependency).

Best,
Marcel

 
Thank you,
Best Regards,
Stefan.
 
From: Marcel Bruch
Sent: ‎Thursday‎, ‎August‎ ‎29‎, ‎2013 ‎10‎:‎35‎ ‎PM
To: Recommenders developer discussions
 
Stefan,
Fabian,

I just found a few issues in the current "adaptive templates" completion engine and I was wondering whether it makes sense to fix them there or to work towards a headless snippet api based on your grammar and the generated EMF model.

Therefore I need your assessment (since you know better than I do what really is required here):
Is it possible to create a pure headless API to build code snippets with minimal dependencies to existing libraries? I saw that your plugin depends to quite a few plugins [1] - not sure how many other transitive dependencies they would pull in at runtime.

I'd like to know how many of them we could get rid of to create a very lightweight runtime. I'm thinking of the following plugin structure:
  • o.e.r.templates - the core runtime that can be reused by our chain and template completion engines as well as serveral API doc providers and documentation generators
  • o.e.r.templates.io - the classes responsible for doing the IO, i.e., loading and saving snippets. Not sure whether this actually makes sense?
  • o.e.r.templates.rcp - the RCP integration of your basic snippet editor. This component may be reused by any other project that want's to make use of your framework. Dependencies here should also be as minimal as possible
  • o.e.r.snipmatch.rcp - the specific parts we need to use your editor in the context of Snipmatch, i.e., the multipage editor we talked about briefly before that collects some metadata for snippets etc.

Can your cut your code in that way? How would the dependencies for the minimal runtime look like?


Thanks,
Marcel



[1]
Require-Bundle: org.eclipse.xtext;visibility:=reexport,
 org.eclipse.xtext.xbase;visibility:=reexport,
 org.eclipse.xtext.generator,
 org.apache.commons.logging;bundle-version="1.0.4",
 org.eclipse.emf.codegen.ecore,
 org.eclipse.emf.mwe.utils,
 org.eclipse.emf.mwe2.launch,
 org.eclipse.xtext.util,
 org.eclipse.emf.ecore,
 org.eclipse.emf.common,
 org.antlr.runtime,
 org.eclipse.xtext.common.types,
 org.eclipse.xtext.xbase.lib
Import-Package: org.apache.log4j,
 org.eclipse.xtext.xbase.lib



_______________________________________________
recommenders-dev mailing list
recommenders-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/recommenders-dev


Back to the top