Xtext within CDT [message #649556] |
Wed, 19 January 2011 12:23  |
Eclipse User |
|
|
|
I'm trying to implement some of the Xtext features of my DSL into comment blocks with C code and CDT. I found a thread on this forum from six months ago saying this was fairly impossible ( http://www.eclipse.org/forums/index.php?t=msg&S=3e80cd00 2199fc8317a0f95faa8e050c&th=200906&goto=641477 ).
However, via the DocCommentOwner extension point of CDT, it is possible to specify some user-defined tools for comments within C and C++ code. We've managed to hook the two together, and currently we can activate the first layer of content assist from our DSL within a C comment - by this I mean, a comment can start with one of a half dozen keywords, and these appear within the content assist, with a filtered list or auto-complete if a keyword has been partially typed. (Not much, but it's a big leap from "this is impossible!") However, after that it just shows the first set of keyword options again, rather than the next set of options.
In the future, this extension point may also allow for "an implementation of a documentation comment validation mechanism", so it's going to take some magic to make that work now I think, but anyway.
I'm looking for tips as to how the Xtext editor would go about parsing the editor normally, and how it then passes that information to the content assist. I presume the org.xtext.parser.antlr (from the main project) and org.xtext.ui.contentassist.antlr (from the .ui project) are good places to start looking as they both have Parser.java classes, but any advice would be appreciated.
|
|
|
Re: Xtext within CDT [message #649604 is a reply to message #649556] |
Wed, 19 January 2011 16:17  |
Eclipse User |
|
|
|
Hello,
Le 19/01/2011 18:23, George Lawie a écrit :
> I'm trying to implement some of the Xtext features of my DSL into comment blocks with C code and CDT. I found a thread
> on this forum from six months ago saying this was fairly impossible (
> http://www.eclipse.org/forums/index.php?t=msg&S=3e80cd00 2199fc8317a0f95faa8e050c&th=200906&goto=641477 ).
>
> However, via the DocCommentOwner extension point of CDT, it is possible to specify some user-defined tools for comments
> within C and C++ code. We've managed to hook the two together, and currently we can activate the first layer of content
> assist from our DSL within a C comment - by this I mean, a comment can start with one of a half dozen keywords, and
> these appear within the content assist, with a filtered list or auto-complete if a keyword has been partially typed.
> (Not much, but it's a big leap from "this is impossible!") However, after that it just shows the first set of keyword
> options again, rather than the next set of options.
We are trying to so something somewhat similar, but for compiler directive (#pragmas). So far we use the CDT CODAN
analysis framework to flag errors in w.r.t to our cutsom pragma syntax (which we plan to parse to parse with Xtect).
I did not even imagine that I could try to hool auto-completion too, but that would be really neat.
I'd be very interested to follow your progress on that.
Good luck.
>
> In the future, this extension point may also allow for "an implementation of a documentation comment validation
> mechanism", so it's going to take some magic to make that work now I think, but anyway.
>
> I'm looking for tips as to how the Xtext editor would go about parsing the editor normally, and how it then passes that
> information to the content assist. I presume the org.xtext.parser.antlr (from the main project) and
> org.xtext.ui.contentassist.antlr (from the .ui project) are good places to start looking as they both have Parser.java
> classes, but any advice would be appreciated.
Steven
|
|
|
Powered by
FUDForum. Page generated in 0.03237 seconds