Support of root in IDE

Hi everybody,
I have a problem which is more of an aesthetic nature but it would still be nice to find an answer. I am usually using root on a Linux machine where I use kdevelop. This is very nice, since it knows all the root classes and therefore colors them etc (like a TLorentzVector being shown bold and colored).
But on my Mac all the IDE (I am using CLion, Emacs and Xcode) just highlight the C classes as I am looking at an .cpp file. Is there any way of changing that (differently expressed, how does kdevelop recognize the root classes)?

ROOT Version: 7
Platform: MacOS
Compiler: Not Provided

Coding in ROOT with the horsepower of an F1

Debugging CERN ROOT scripts and ROOT-based programs in Eclipse IDE

How to run ROOT Macros in VS Code
View ROOT Files directly in VS Code!

1 Like

See IDE for ROOT? - #4 by behrenhoff

The solutions pointed by Wile are perfect.

If you prefer rather to tune your current text editor, you can probably add ‘by hand’ custom syntax highlighting fields by defining some ROOT classes as custom keywords.

For example:

Or if you want to use Geany, then I can spare your work and share the one I use:

# For complete documentation of this file, please see Geany's main documentation

# all items must be in one line
# all items must be in one line

primary=alignas alignof and and_eq auto bitand bitor bool char char16_t char32_t class const constexpr decltype double enum explicit export extern false final float friend inline int int8_t int16_t int32_t int64_t long mutable namespace noexcept not not_eq nullptr or or_eq override ptrdiff_t register short signed size_t static static_assert struct template thread_local true typedef typename union unsigned using virtual void volatile wchar_t xor xor_eq TH1 TH1C TH1D TH1F TH1I TH1K TH1S TH2 TH2C TH2D TH2F TH2I TH2S TH3 TH3C TH3D TH3F TH3I TH3S TF1 TF2 TF3 THStack TGraph TGraph2D TRandom TLimit TLatex TNtuple TObject TTree TIter TKey TRandom2 TShape TPad TMacro TString TLine TLegend TFile TRandom3 TMath TLeaf TLeafB TLeafC TLeafD TLeafElement TLeafF TLeafI TLeafL TLeafO TLeafObject TChain TDirectory TList TArc TChain TDirectory TList TArc TBox TEllipse TPolyLine TCurlyLine TCurlyArc TMinuit TFitter TLinearFitter TLorentzVector TLorentzRotation TVector3 TVector2 TRotation TGenPhaseSpace TFeldmanCousins TRobustEstimator TRolke TQuaternion TPostScript TSVG TPDF TImageDump THtml TColor TStyle TComplex TPRegexp TObjArrayIter TMapIter TClass TEnv TGlobal TCint TROOT TDictionary TTime TTimer Double_t Int_t UInt_t Float_t Long_t Bool_t Byte_t char_t Marker_t Double32_t Float16_t Long64_t Short_t Stat_t Style_t Text_t UShort_t ULong64_t Char_t UChar_t TBranch
secondary=asm break catch case continue compl const_cast dynamic_cast do default delete else for goto if new operator public private protected return reinterpret_cast sizeof static_cast switch this throw try typeid while NULL
# these are the Doxygen keywords
docComment=a addindex addtogroup anchor arg attention author authors b brief bug c callergraph callgraph category cite class code cond copybrief copydetails copydoc copyright date def defgroup deprecated details dir dontinclude dot dotfile e else elseif em endcode endcond enddot endhtmlonly endif endinternal endlatexonly endlink endmanonly endmsc endrtfonly endverbatim endxmlonly enum example exception extends file fn headerfile hideinitializer htmlinclude htmlonly if ifnot image implements include includelineno ingroup interface internal invariant latexonly li line link mainpage manonly memberof msc mscfile n name namespace nosubgrouping note overload p package page par paragraph param post pre private privatesection property protected protectedsection protocol public publicsection ref related relatedalso relates relatesalso remark remarks result return returns retval rtfonly sa section see short showinitializer since skip skipline snippet struct subpage subsection subsubsection tableofcontents test throw throws todo tparam typedef union until var verbatim verbinclude version warning weakgroup xmlonly xrefitem

preprocessor.start.$(file.patterns.cpp)=if ifdef ifndef
preprocessor.middle.$(file.patterns.cpp)=else elif


# default extension used when saving files

# the following characters are these which a "word" can contains, see documentation

# single comments, like # in this file
# multiline comments

# set to false if a comment character/string should start at column 0 of a line, true uses any
# indentation of the line, e.g. setting to true causes the following on pressing CTRL+d
# setting to false would generate this
#	command_example();
# This setting works only for single line comments

# context action command (please see Geany's main documentation for details)

# 0 is spaces, 1 is tabs, 2 is tab & spaces

# %f will be replaced by the complete filename
# %e will be replaced by the filename without extension
# (use only one of it at one time)
compiler=g++ -Wall -c "%f"
linker=g++ -Wall -o "%e" "%f"
1 Like