Quick way to set custom syntax highlighting in Ecl

2019-06-16 07:26发布

问题:

I know I'm not the first to need this. I am working on an in house created codebase and I would like to apply highlighting to it within Eclipse. In Notepad++ I can set language for the file I'm looking at. Is there any way to do this for Eclipse?

The code I'm working on would use the same syntax styling as C++.

回答1:

Your best bet is to go to Preferences -> General -> Editors -> File associations. Add the file extension of the thing you are trying to open and add the C++ editor as the associated default editor.

If there is no file extension, then things are a little harder. Instead of double-clicking to open the file, right-click -> Open with... -> other -> C++ editor. This will remember your choice for that file only.



回答2:

As Andrew Eisenberg said, go to Window --> Preferences --> General --> Editors --> File Associations and ensure your choices for editor for each file type are correct according to your desires.

However, for Eclipse CDT most of your file types are set in Preferences --> C/C++ --> File Types instead.

Also, like he said, you can use the right-click menu to choose your own editor, including an external system editor, such as Sublime Text 3, Atom, Visual Studio Code, Notepad++, etc.
Right click on the file --> Open With --> Other... --> choose an "Internal editor" or "External program" to your liking, optionally checking the box at the bottom to make this the default choice next time.