Home Download Buy Blog Forum Support

clang (C/C++/Objective-C/Objective-C++) autocomplete

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby sjj_512 on Wed Jan 04, 2012 1:34 pm

That fixed it, thanks for the fast turn around.
sjj_512
 
Posts: 2
Joined: Wed Jan 04, 2012 4:51 am

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby joh on Sat Jan 07, 2012 7:38 pm

Is there a way to configure this to autocomplete OS X and iOS frameworks and autocomplete Objective-C properly?

Unfortunately I can't get the frameworks to autocomplete just by adding an include path since Framework's are structured Name.framework/Headers/<file>.h
But they are included as <Name/file.h>.
joh
 
Posts: 1
Joined: Sat Jan 07, 2012 7:31 pm

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby MikeSmith on Sat Jan 07, 2012 7:54 pm

Is there a way to get per-project settings for plugins like this?

I ask because I work on a lot of embedded projects, where the system headers are not useful, and what you frequently want is project-relative headers plus headers from <insert RTOS name here>. Many (most) RTOS' have headers whose names collide with the names of system headers, so you can't just bulk out the include path.
MikeSmith
 
Posts: 2
Joined: Sat Jan 07, 2012 7:53 pm

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby quarnster on Sat Jan 07, 2012 10:08 pm

joh, Try adding something like this to your clang options:
Code: Select all
        "-isysroot",
        "/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk",
        "-D__IPHONE_OS_VERSION_MIN_REQUIRED=40300",


I don't code in Objective-C/Objective-C++ myself, so while I believe basic support is there I'm sure it could be improved. Pull requests with more fleshed out support would be more than welcome :)

MikeSmith, No idea regarding per-project settings, please do let me know if you figure it out.
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby magey on Sun Jan 08, 2012 10:44 am

Great work, it took me a while to get it up an running since I am parsing Linux system headers on a Windows machine but now it's good. Only one question though, is there a way to enable auto-completion in the global namespace without using ::? if I start typing something like 'epoll_', I want to see all the possible completion options right away. Right now it doesn't show anything unless I type '::epoll_'.
magey
 
Posts: 4
Joined: Sun Jan 08, 2012 10:42 am

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby quarnster on Sun Jan 08, 2012 11:00 am

The default key-binding for triggering autocomplete operations in Sublime Text 2 is "ctrl+space", so typing 'epoll_' and then hitting ctrl+space should work. You can also start typing and hit tab to select the highest scoring completion (another built in Sublime Text 2 feature).

If you are using the dev branch of Sublime Text 2 autocomplete will pop up automatically after typing a few characters, but personally I've turned that off since the completions in my sources takes too long ;)
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby azumanga on Sun Jan 08, 2012 3:51 pm

Wow, this is a great little plugin.

On Mac, is there any way to pick which copy of libclang is used? I don't know how much the ABI changes, but whichever version you are using / picking up is older than the (svn) copy of clang I am using (which has better c++0x support).

Hope that makes sense!
azumanga
 
Posts: 3
Joined: Thu Aug 04, 2011 2:55 pm

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby quarnster on Sun Jan 08, 2012 4:34 pm

azumanga, while I haven't tried it myself, I see no reason why this wouldn't be possible. Try to replace libclang.dylib in ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/SublimeClang/ with the one you've compiled. Not sure if libclang is compiled by default as part of compiling clang, so you might need to specifically compile it as a separate step.
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby magey on Mon Jan 09, 2012 8:12 am

What is preventing this plugin from working in the 64 bit version of Sublime Text for Windows? is it just the clang DLL file that needs to be recompiled or are there are things?
magey
 
Posts: 4
Joined: Sun Jan 08, 2012 10:42 am

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby quarnster on Mon Jan 09, 2012 9:01 am

In theory only the libclang.dll needs to be compiled in 64 bit mode. However ttvd tried that and still ran into issues. If someone gets it to work I'd be happy to accept a pull request/patch.
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

PreviousNext

Return to Plugin Announcements

Who is online

Users browsing this forum: Exabot [Bot] and 10 guests