Sunday Dec 30, 2012

Code Completion for Lang Attribute in XHTML Files

Olivier Schmitt from the French Ministry of Agriculture published a brilliant article and sample code in his (French) blog recently:

http://jeecookbook.blogspot.fr/2012/12/developpez-un-module-de-completion-pour.html

The source code:

https://github.com/olivier-schmitt/the-jee-architect-cookbook/tree/master/netbeans/ISO6391

The result is code completion for the "lang" attribute in text/xhtml files: 

Source structure, take note of the CSV file, which is a cool way to get the code completion words:

I'm thinking of making the ultimate generic solution on top of Oliver's code: a new @CompletionRegistration annotation, that takes a MIME type, content (i.e., a list of completion words), and a condition (e.g., "lang" attribute). Then, at compile time, the layer entries are generated and mapped to Oliver's code. The @CompletionRegistration annotation would not be set on a class, but within the package-info.java class, i.e., similar to how file templates can now be registered via @TemplateRegistration. In other words, nothing at all would need to be implemented or extended, no API, nothing at all; instead, you'd register some info via the annotation and then everything else would be generated for you and you could immediately begin using your newly mapped completion provider.

About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Categories
Archives
« December 2012 »
SunMonTueWedThuFriSat
      
1
15
23
24
25
29
     
Today