Sublime Forum

Using Sublime Text with a large C codebase

#1

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!

0 Likes

#2

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.

1 Like

#3

Thanks for your suggestion!

I hadn’t tried 3 yet (my brief experience was with 2). I’ll give it a shot.

0 Likes

#4

SublimeText works well with projects with +80 000 files (chromium project). 100+ is nothing for it.

0 Likes

#5

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.

0 Likes

#6

[quote=“castles_made_of_sand”]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.[/quote]

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)

0 Likes

#7

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.

github.com/quarnster/SublimeClang

0 Likes

#8

OK, cool, I’ll give it a shot…

0 Likes

#9

where’s the index of symbols stored?

0 Likes

#10

Next to the cache, type this in the console:

sublime.cache_path()
0 Likes