Home Download Buy Blog Forum Support

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

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

Postby quarnster on Wed Jan 11, 2012 10:33 am

MikeSmith and freewizard, Per project settings is now possible. See here and here for more details
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

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

Postby rchl on Fri Jan 20, 2012 8:02 pm

Shortcuts starting with ctrl+d works quite well on Mac but on Windows they interfere with very useful expand selection shortcut.
rchl
 
Posts: 147
Joined: Fri Mar 04, 2011 11:02 pm

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

Postby ttvd on Mon Jan 23, 2012 8:22 pm

@quarnster

Thank you for this excellent patch! Seems to be working properly on Windows, Sublime x64 build.

There are certain issues with Clang not being able to properly parse MS headers, but that's something else. Also for some reason I cannot settings / sublimeclang_options in .sublime-project .. it does not work. However modifying options in SublimeClang.sublime-settings (adding compile options, include paths, etc) seems to work.

Thanks again, pretty awesome.
ttvd
 
Posts: 8
Joined: Sun Apr 17, 2011 12:57 am

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

Postby quarnster on Mon Jan 23, 2012 9:55 pm

The cache isn't cleared when modifying the project settings, so you might have to issue a manual clear cache for the project settings to take effect.

There are some command line options related to parsing MS headers, see http://clang.llvm.org/docs/UsersManual.html#c_ms.
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

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

Postby rchl on Sat Jan 28, 2012 7:32 pm

Sublime normally uses 64MB after start. With this plugin it quickly raises up to 800MB. :)
Is it the price I have to pay for using this plugin or something might be wrong? Granted, the project I'm working on is quite big.

BTW. Another question. When I have header file opened, usually the "Go to implementation/definition" won't work. Is that normal? I suppose that plugin works in context of opened file only and then resolves all includes from here. In which case it's probably normal as only cpp file includes the main include with all configurations.
rchl
 
Posts: 147
Joined: Fri Mar 04, 2011 11:02 pm

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

Postby quarnster on Sat Jan 28, 2012 7:54 pm

It could be the price, it could be something wrong. I've not investigated, and probably won't unless I notice memory usage drifts higher and higher (in other words a definite memory leak somewhere).

It's a compiler so it works with the current file only. If you don't include the definitions needed for that specific file, then the compiler does not know about them and can't go to the definition.
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

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

Postby exclipy on Tue Jan 31, 2012 12:10 am

I tried it out on a reasonably big project, and when I opened about 15 files, it was using 4GB of RAM. From what I saw of the source, it just accumulates translation units in the cache and never flushes them out?
exclipy
 
Posts: 5
Joined: Fri Jan 27, 2012 11:26 pm

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

Postby quarnster on Tue Jan 31, 2012 6:57 am

They are flushed when you close the file or you can do it manually via "alt+d,alt+c".
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

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

Postby quarnster on Tue Jan 31, 2012 7:59 am

BTW, you might also be interested in setting:
Code: Select all
    // If set to true will warm up the cache for supported files
    // when they are opened
    "cache_on_load": false,

    // When set to true a reparse command will be triggered
    // when a view is activated
    "reparse_on_activated": false,

    // When set to true a reparse command will be triggered
    // when a view is saved
    "reparse_on_save": false,

in your SublimeClang user settings. This way the file is only parsed when you trigger an auto complete event or a go to definition/implementation request. You'll have to wait for a couple of seconds while the file is being compiled though.

You might also want to tweak the following value to something other than the default:
Code: Select all
    // This is the bitmask sent to index.parse.
    // For example, to be able to go to the definition of
    // preprocessed macros, set it to 1, for using an implicit
    // precompiled header set it to 4 and for caching completion
    // results, set it to 8. Or all together 1+4+8=13.
    //
    // See http://clang.llvm.org/doxygen/group__CINDEX__TRANSLATION__UNIT.html#gab1e4965c1ebe8e41d71e90203a723fe9
    // and http://clang.llvm.org/doxygen/Index_8h_source.html
    // for more details
    "index_parse_options": 13,
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

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

Postby exclipy on Wed Feb 01, 2012 12:24 am

What do you think about only keeping the N most recently-activated TUs in memory? Or even better, the N most recent megabytes worth of TUs? Another idea is to persist the TUs to disk when they are unloaded from memory so it won't need to recompile the file the next time it's opened/activated.
exclipy
 
Posts: 5
Joined: Fri Jan 27, 2012 11:26 pm

PreviousNext

Return to Plugin Announcements

Who is online

Users browsing this forum: Yahoo [Bot] and 6 guests