Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Syntax coloring of new keywords

To me it looks like you did not associate your language with any particular content-type - you need to add content-type subelement to your language.

You can also use the "C/C++/Language Mapping" preference page to associate your language with particular file type.

On Oct 17, 2011, at 8:43 AM, Sergey Smolov <ssedai@xxxxxxxxx> wrote:

Hello, List!

My name is Sergey Smolov and I am need your help. My purpose is to make a syntax highlight for our extension of C++ language. This extension just contain about a one hundred of macro directives with different functionality.

For achieving such purpose I've started developing a plugin. Here is my "plugin.xml":

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
   <extension
         id="сppteskkeywords"
         name="CDT Language"
         point="org.eclipse.cdt.core.language">
      <language
            class="cppteskpluginide.Keywords"
            id="CppTESKPluginIDE.language1"
            name="CppTesKLanguage">
      </language>
   </extension>
</plugi

and here is class, that contains necessary keywords:

import org.eclipse.cdt.core.dom.ast.gnu.c.GCCLanguage;
import org.eclipse.cdt.core.model.ICLanguageKeywords;

public class Keywords extends GCCLanguage implements ICLanguageKeywords
{
   
    public Object getAdapter(Keywords keywords)
    {
        return getAdapter(this);
    }
      
    public String[] getKeywords()
    {
        String[] array = new String[14];
       
       
/ array elements initialization
       
        return array;
    }

  
    public String[] getBuiltinTypes()
    {
        String[] array = new String[4];
       
       
/ array elements initialization
       
        return array;
    }
   
    public String[] getPreprocessorKeywords()
    {
        String[] array = new String[152];

        // array elements initialization
       
        return array;
    }

The main problem is that it didn't work in proper way, so I'd like to ask you the following question: what is the way for adding new keywords and making them  highlighted like C++? May be I miss something?

You will be much obliged if you will help me.
Thanks in advance!
-- 
Sincerely yours,
Sergey Smolov
ISP RAS
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev

Back to the top