Home Download Buy Blog Forum Support

Using Sublime Text with a large C codebase

Using Sublime Text with a large C codebase

Postby nathanb on Thu Apr 11, 2013 6:21 pm

Hi all,

My project is a very large (100+ file) low-level system written mostly in C with some C++ in the userspace components.

My current editor (eclipse CDT) is capable of indexing the entire codebase and doing IDE-like things such as find-all-references, goto declaration, goto definition, global symbol rename, and global symbol search.

Is it possible to get Sublime set up with similar features? A walkthrough suitable for a lazy noob would be highly appreciated.

(I'm on 64-bit Arch Linux, if it matters).

Thanks!
nathanb
 
Posts: 4
Joined: Thu Apr 11, 2013 6:16 pm

Re: Using Sublime Text with a large C codebase

Postby shancat on Fri Apr 12, 2013 6:59 am

Goto Anything + Goto Definition (ST3) works fine with big C projects. I just tested on my old laptop with the Ruby programming language ~300 C files not including header files.

Just add a folder to project (drag & drop a folder onto ST3 or Project -> Add to Folder to Project) and it'll index. Check out the Goto menu.
shancat
 
Posts: 12
Joined: Thu Feb 28, 2013 6:57 am

Re: Using Sublime Text with a large C codebase

Postby nathanb on Fri Apr 12, 2013 5:41 pm

Thanks for your suggestion!

I hadn't tried 3 yet (my brief experience was with 2). I'll give it a shot.
nathanb
 
Posts: 4
Joined: Thu Apr 11, 2013 6:16 pm

Re: Using Sublime Text with a large C codebase

Postby rchl on Fri Apr 12, 2013 10:48 pm

SublimeText works well with projects with +80 000 files (chromium project). 100+ is nothing for it.
rchl
 
Posts: 148
Joined: Fri Mar 04, 2011 11:02 pm

Re: Using Sublime Text with a large C codebase

Postby sublimator on Sat Apr 13, 2013 11:28 am

The indexing, while lightning quick, is a pretty basic {symbol : (file,line)} lookup that doesn't afford any refactoring, usage finding or other advanced navigations/analysis an IDE user is accustomed to.

You can checkout a sublime plugin called SublimeClang, which is cross platform but works best on OSX, with degraded support for linux, degrading even more on windows.
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 649
Joined: Thu Mar 20, 2008 5:41 am

Re: Using Sublime Text with a large C codebase

Postby nathanb on Tue Apr 23, 2013 9:33 pm

castles_made_of_sand wrote:The indexing, while lightning quick, is a pretty basic {symbol : (file,line)} lookup that doesn't afford any refactoring, usage finding or other advanced navigations/analysis an IDE user is accustomed to.

You can checkout a sublime plugin called SublimeClang, which is cross platform but works best on OSX, with degraded support for linux, degrading even more on windows.


Hm, good feedback.

Here's the indexing features I use in eclipse:
* Find declaration
* Find definition
* Find all references
* Fuzzy symbol search (for example, I can press ctrl + shift + t and search for obj_*_t to get the declaration for obj_foo_t and obj_bar_t)

Any indication as to whether sublime text + clang can do any of this?

(I'd try it myself, but Sublime Text 3 appears unhappy with the fact that I don't have a license)
nathanb
 
Posts: 4
Joined: Thu Apr 11, 2013 6:16 pm

Re: Using Sublime Text with a large C codebase

Postby sublimator on Wed Apr 24, 2013 2:31 am

I should say that `{symbol : (file,line)}` is actually more like ` {symbol : [(file,line), ...]}` as of course there's multiple entries per symbol.

Clang works for sublime text 2, so you can give it a go.

I've only used it briefly, as I'm just a script kiddie, so can't really say much beyond pointing you in (the right?) direction.

https://github.com/quarnster/SublimeClang
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 649
Joined: Thu Mar 20, 2008 5:41 am

Re: Using Sublime Text with a large C codebase

Postby nathanb on Wed Apr 24, 2013 2:10 pm

OK, cool, I'll give it a shot...
nathanb
 
Posts: 4
Joined: Thu Apr 11, 2013 6:16 pm

Re: Using Sublime Text with a large C codebase

Postby waterup on Thu Apr 25, 2013 2:37 pm

where's the index of symbols stored?
waterup
 
Posts: 8
Joined: Thu Apr 11, 2013 3:29 am

Re: Using Sublime Text with a large C codebase

Postby bizoo on Thu Apr 25, 2013 3:11 pm

waterup wrote:where's the index of symbols stored?

Next to the cache, type this in the console:
Code: Select all
sublime.cache_path()
bizoo
 
Posts: 886
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland


Return to General Discussion

Who is online

Users browsing this forum: FichteFoll, ToddFiske and 17 guests