Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for C++ #26

Open
FramusRock opened this issue Oct 8, 2015 · 8 comments
Open

Support for C++ #26

FramusRock opened this issue Oct 8, 2015 · 8 comments

Comments

@FramusRock
Copy link

Hey,

I absolutely love your tool and use it everyday!

Is it somehow possible (maybe with a setting or auto-recognize) to use #include instead of #import when coding C++ in Xcode?

@lucholaf
Copy link
Contributor

lucholaf commented Oct 8, 2015

@FramusRock good idea thanks, are you using .cpp and/or .mm files for c++? btw, you're welcome to submit a pull request if you want to implement it.

@FramusRock
Copy link
Author

In .mm files #import works just fine. I'm talking about .cpp in which #include is a must. Auto-Importer works just fine there, it should just write #include instead of #import ;)

@FramusRock
Copy link
Author

I looked into it a little, maybe you can help me out, so that I can make an appropriate pull request.

In LAFIDESourceCodeEditor.m, there is this:

  • (NSString *)importStatementFor:(NSString *)header {
    return [NSString stringWithFormat:@"#import "%@"", header];
    }

How can I find out if the current file that this header belongs to is a CPP file or ending in .cpp?

@FramusRock
Copy link
Author

I'm still interested in it, could you give me a hint how I can achieve it, please?

@lucholaf
Copy link
Contributor

hey @FramusRock I spent some time trying to figure out how to get the filename from current editor but still no luck. Another approach would be to get the first existing import/include line on the file and use that to decide if you should be using #import or #include

@FramusRock
Copy link
Author

hey @lucholaf , thank you. I also spent some time on it, but also didn't have any luck getting it right.
What you're saying sounds like a good idea. I'll have a try and report back.

@lucholaf
Copy link
Contributor

@FramusRock +1

@FramusRock
Copy link
Author

I made it! Pull request sent!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants