Open lihebi opened 9 years ago
Actually there's another issue for the same reason. Some keywords can't be highlighted in .h
file, class
for example. So maybe remove .h
declaration in the top of grammar/c.cson
should be a better solution to solve both of them? That will make .h
file to have .source.cpp
class in atom.
Well, thats the old C/C++ issue, because .h is marked as both C and C++. You have the following possibilities:
IMO .h should be marked for both languages and it should switch automatically to C++ if keywords like class are detected.
When I want to use
cl
snippet in my c++ project's header file(I prefer to use.h
instead of.hpp
, and I believe so do many people), I notice that it doesn't work.The reason is that, although there are .h declarations in both
grammars/c.cson
andgrammars/c++.cson
, only.source.c
class is added to a.h
file in atom. However in snippets,cl
is defined for only.source.cpp
insnippets/language-c.cson
.It is very common to define Classes in header file, and header files are often used with
.h
suffix, so I think it makes sense to add support for it.The easiest way is to just use the snippets for both c files and c++ files instead of dividing some for c++ only. I don't think people will use those snippets "accidentally" in a c file.