| Re: [cdt-dev] Extend the C language Content Assist in Eclipse to support custom commands |
|
This sounds like an IAutoEditStrategy. See e.g. DefaultMultilineCommentAutoEditStrategy which closes a multiline comment when pressing enter after /*. Unfortunately you cannot add such a strategy via plugin.xml. You would need to add it programmatically to the underlying TextViewer of each C/C++ editor instance. Toni From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
On Behalf Of Lambros Petrou Ok, On 22 May 2012 10:11, Leherbauer, Anton (Toni) <Anton.Leherbauer@xxxxxxxxxxxxx> wrote: One possible trap is that you need to export the package of your class such that it can be instantiated
by cdt.ui. You can do this on the Runtime tab of the plugin manifest editor. Toni From:
cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
On Behalf Of Lambros Petrou Yes, I have been looking at InclusionProposalComputer since your reply and I have a draft ready but it seems there is a probem. How can I check if my plugin is enabled and i use,
because I am trying the pragmas and nothing comes up in the suggestions. My plugin.xml is like this: <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.4"?> <plugin> <extension id="DDMPragmasProposalComputer" point="org.eclipse.cdt.ui.completionProposalComputer"> <completionProposalComputer categoryId="org.eclipse.cdt.ui.parserProposalCategory" class="ddmcontentassistance.DDMPragmasProposalComputer"> <partition type="__c_preprocessor"/> </completionProposalComputer> </extension> </plugin> Thank you. On 21 May 2012 09:57, Leherbauer, Anton (Toni) <Anton.Leherbauer@xxxxxxxxxxxxx> wrote: Hi, Iâd suggest to look into the extension point âorg.eclipse.cdt.ui.completionProposalComputerâ. All internal completion proposal computers are in fact implementations of this extension point. The âInclusionProposalComputerâ class and its plugin.xml extension snippet might provide some boilerplate
code to get you started. HTH Toni From:
cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
On Behalf Of Lambros Petrou I am trying to extend the C/C++ language in Eclipse CDT in order to have auto-complete (Content Assist) for some custom commands ( mostly pragmas ). Let's say I have the command: #pragma IAM THE_CUSTOM_COMMAND var1 var2 I' d like to make a plugin in order to have the ability the moment I type in #pragma and then SPACE to show the possible commands I have like when I am using regular functions. And if I
press enter on one of the suggestions the whole command should be pasted with the default values in the variables. I tried reading in the Eclipse FAQ and found many tutorials online but I only found how to make a completely new editor supporting my commands. I just need to add 20-30 pragmas like this in the CDT editor currently being used in Eclipse. I read that there is an Extension Point for CDT Language and if I could make an extension for that it would be sufficient but I haven't found a tutorial explaining this. Is there any way to add these commands to the CDT Editor with the Auto-complete functionality I want without making my own editor ? The language we use is C and we have these pragmas and this feature would be great since we use them a lot. Thank you all.
--
Lambros Petrou
--
Lambros Petrou
Lambros Petrou |