Skip to content
/ Ceer Public

Sublime Text plugin providing code navigation and true intelligence for C and C++.

Notifications You must be signed in to change notification settings

andylamb/Ceer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ceer

Ceer is a C and C++ plugin for Sublime Text that provides code intelligence across source files by continuously parsing and indexing a project. Because Ceer is actually starting to compiling the code, but stopping before code generation, it reflects the true state and structure of the program.

Ceer is in an early prototype phase, and we are working hard to improve stability, scalability, and portability. Currently, Ceer is only available on OSX, support for other major platforms is in the works. I haven't developed a good framework for testing yet, so any feedback is greatly appreciated!

Table of Contents

  1. Features
  1. Setup
  2. Installation * Package Control * Cloning
  3. Quickstart
  4. Configure * Compilation Commands * Diagnostics
  5. Contribute

Features

Open Definition

Right clicking any reference to a method, field, class, etc. and selecting the Open Definition command will jump to the definition of that reference, even if it is defined in another source file. Note that in C or C++ a definition is not the same as a declaration. A declaration must be present in each file where there is a reference, while there must only be a single definition across all source files.

Example

The main.cpp file contains a call to Foo's method some_method, which is declared in main.cpp by including Foo.h, and defined in Foo.cpp.

Right click with the cursor anywhere in on some_method to call Open Definition.

Open Definition will open Foo.cpp and highlight the some_method definition.

List References

The List References command can be called on any definition or reference, and will list all references in a menu. Highlighting a reference will navigate to its location in the project.

Example

Call List References on Baz's method some_method. Note that calling List References on any reference to some_method would be the same.

The first reference found is in main.cpp. Here we can see that Ceer is able to infer the compile-time type of the expression ((Baz*)&myFoo). In fact, it should be able to perform type inference identical to a compiler for any valid expression.

The second reference found is in Baz's method another_baz_method.

Expand Superclasses

The Expand Superclasses command can be called on any definition or reference for a C++ class, and displays inheritance hierarchy of the class in a menu.

Example

Call Expand Superclasses on Foo. As with List References, we could also call Expand Superclasses on a reference to Foo.

Foo inherits from Base, which doesn't inherit from any other class.

Baz has a more interesting inheritance structure.

Baz inherits directly from both Foo and Bar, both of which inherit from Base. Note that in the menu, the superclasses are displayed in breath first search order, and are indented by their level in the inheritance hierarchy.

Expand Subclasses

Naturally, the Expand Subclasses command behaves the same as the Expand Superclasses command, but displays classes that inherit from the selected class.

Example

Call Expand Subclasses on Base.

This diagram looks similar to when we called Expand Superclasses on Baz, but is reversed, because we are looking from the top of the inheritance hierarchy down, instead of from the bottom up.

Expand Includes

Right clicking anywhere in a file and selecting the Expand Includes command will show all the files that file is including, whether directly or indirectly. The includes are ordered by depth first search, and indented based on how indirect the inclusion is.

Example

Call Expand Include on Baz.h.

Baz.h includes Foo.h and Bar.h, which both include Base.h. Note that Base.h is indented because it is not directly included in Baz.h.

List Includers

The List Includers displays a menu of all the files that are including the file the command is called on. Similarly to the Expand Includes command, the files are ordered by depth first search, and indented based on indirectness.

Example

Call List Includers on Foo.h.

Baz.h, Foo.cpp, and main.cpp all directly include Foo.h. Baz.cpp indirectly includes Foo.h, because it includes Baz.h.

Diagnostics

If the enable_diagnostics option is set to true in the .sublime-project file, Ceer will display the same errors and warnings as the compiler. Moving the cursor to anywhere in the diagnostic will display a summary in the Sublime status bar at the bottom of the window. A list of all commands in the project or a single file can be viewed in a menu using the View Issues in Project or View Issues in File commands, respectively.

Example

a_private_field is declared to be private in Foo.h. Attempting to access it in Baz results in the error 'a_private_field' is a private member of 'Foo'.

Calling the View Issues in Project command or calling the View Issues in File command on Baz.h displays the error in a menu.

Selecting an error in the menu will jump to the error.

Setup

Currently Ceer is in a prototype phase, and is only available for OSX. Support for other platforms is planned.

Installation

Package Control

Ceer is available in Package Control.

Cloning

Currently, the only way to install is by directly cloning the Ceer repo into ~/Library/Application Support/Sublime Text 3/Packages:

$ cd ~/Library/Application Support/Sublime Text 3/Packages
$ git clone git@github.com:andylamb/Ceer.git

or

$ cd ~/Library/Application Support/Sublime Text 3/Packages
$ git clone https://github.com/andylamb/Ceer.git

Quickstart

  1. Create a .sublime-project file, using 'Project > Save Project As...'
  2. Right click anywhere in the Side Bar and select Build Index.

Configure

Ceer requires a .sublime-project file in order to know which files to parse and index. To create a .sublime-project file, go to 'Project > Save Project As...'

Compilation Commands

In order to produce the most faithful representation of the source code, Ceer can parse a CMakeLists.txt or Makefile and use the same compilation commands. To enable this feature, in the .sublime-project file , under the ceer section, set either cmakelists_path or makefile_path. Note that the 'ceer' section is created automatically on the first call to Build Index

Diagnostics

Diagnostics can be controlled using diagnostics_enabled in the ceer section of the .sublime-project file.

Contribute

Ceer is currently in a prototype phase, and we are working hard to improve stability, scalability, and portability. Issues and Pull Requests are greatly appreciated! Please read over the Contribution Guidelines to get started.

About

Sublime Text plugin providing code navigation and true intelligence for C and C++.

Resources

Stars

Watchers

Forks

Packages

No packages published