fix # 11/ Read include paths from both C and C++ language settings#30
fix # 11/ Read include paths from both C and C++ language settings#30davidramnero wants to merge 1 commit into
Conversation
| */ | ||
| protected Collection<File> getIncludes(boolean onlyUserDefined) { | ||
| Collection<File> paths = new LinkedList<File>(); | ||
| Collection<File> paths = new LinkedHashSet<File>(); |
There was a problem hiding this comment.
to avoid duplicates if same includes are added in both c and c++ language settings
| private final IProject project; | ||
| private final IWorkspaceRoot root; | ||
| private static final String GCC_LANGUAGE_ID = "org.eclipse.cdt.core.gcc"; | ||
| private static final String GPP_LANGUAGE_ID = "org.eclipse.cdt.core.g++"; |
There was a problem hiding this comment.
hmm this does not feel rock solid to me. eclipse can use different compilers, not just gcc/g++. is it specified somewhere that getLanguageId only returns these strings for C/C++ code?
There was a problem hiding this comment.
btw the old code to compare the extension is not rock solid neither.
| } | ||
| for (ICLanguageSetting ls : allLanguageSettings) { | ||
| String id = ls.getLanguageId(); | ||
| if (GCC_LANGUAGE_ID.equals(id) || GPP_LANGUAGE_ID.equals(id)) { |
There was a problem hiding this comment.
if the file to analyze is a C file then it would be preferable to not use GPP settings. how doable would that be?
If neither GCC_LANGUAGE_ID nor GPP_LANGUAGE_ID is found but another compiler is used.. an idea could be to load all the include paths from all language settings?
There was a problem hiding this comment.
it's a good idea, I'll see what I can do
Addressing: #11
The plugin already scans language settings for includes, but previously it only read in settings for c++ projects, i.e. include paths configured for c projects were ignored. This is now fixed.