diff --git a/AutoImporter/AutoImporter/LAFIDESourceCodeEditor.m b/AutoImporter/AutoImporter/LAFIDESourceCodeEditor.m index b366b25..4893a66 100644 --- a/AutoImporter/AutoImporter/LAFIDESourceCodeEditor.m +++ b/AutoImporter/AutoImporter/LAFIDESourceCodeEditor.m @@ -22,10 +22,19 @@ @interface LAFIDESourceCodeEditor() @implementation LAFIDESourceCodeEditor +// changed to support C++, it would be better though to check for the actual files +// if there is a .cpp file -> use include - (NSString *)importStatementFor:(NSString *)header { - return [NSString stringWithFormat:@"#import \"%@\"", header]; + NSTextView *textView = [MHXcodeDocumentNavigator currentSourceCodeTextView]; + NSRange range = [textView.string rangeOfString: @"#import"]; + if (range.length > 0) { + return [NSString stringWithFormat:@"#import \"%@\"", header]; + } else { + return [NSString stringWithFormat:@"#include \"%@\"", header]; + } } + - (void)cacheImports { [self invalidateImportsCache];