Skip to content

Sublime Text 3 C, C++ and Objective C code completion, navigation plugin based on RTags.

Notifications You must be signed in to change notification settings

tillt/RTagsComplete

Repository files navigation

RTagsComplete

Master Build Status Staging Build Status

About

Sublime Text 3 C, C++ and Objective C code completion, navigation plugin based on RTags.

This is a fork of the original sublime-rtags by Sergei Turukin. New features have been added and merging those back into the original sublime-rtags has become a bottleneck this fork avoids.

Installation

Prerequisites

Install RTags - for all of the latest features, version 2.19 is the oldest we support. You will however get most functionality with RTags version 2.0 already.

Via Package Control

Manually

cd <sublime-text-Packages-dir>
git clone https://github.com/tillt/RTagsComplete

Features

Symbol navigation (Goto definition/declaration)

Jump to the definition or declaration of a symbol.

Find usages (Find symbol references, Find virtual function re-implementations)

Shows all references of the symbol under the cursor.

Symbol References Example

Find unused functions

Finds and displays dead functions.

Find unused Functions Example

Rename symbol

Allows to refactor symbols. Select a symbol with your cursor, activate the function and enter the new name.

Rename Symbol Example

Find include

Finds the include file for the symbol under the cursor. If any are found, shows a quick panel that copies the selected include into the clipboard when hitting return.

Expand auto

Replaces the 'auto' keyword with the type retrieved from RTags, if possible.

Symbol information

Shows a popup containing information about the symbol under the cursor.

Symbol Info Example

Code completion

Completion Example

Code validation

Validates your current code and shows errors and warnings inline.

Fixits Example

Usage

Typical work-flow

Default key bindings

The default key bindings were originally inspired by Qt Creator.

  • Symbol navigation - F2
  • Find usages / references - CTRL+Shift+u
  • Rename symbol - CTRL+Shift+Alt+u
  • Find virtual function re-implementations - CTRL+Shift+x
  • Symbol information - CTRL+Shift+i
  • Use Alt+/ explicitly for auto-completion
  • Mouse button8 to go backwards (mouse wheel left)
  • Error, fixit and warning navigation - CTRL+Shift+e
  • Find unused functions - Alt+Super+Shift+d
  • Find include file for symbol - CTRL+i
  • Expand auto type for symbol - CTRL+Shift+a
  • Show navigation history - CTRL+Shift+h

Customization

Customize your Key Bindings via Preferences > Package Settings > RTagsComplete > Key Bindings > User

Setup the plugin within the User Settings via Preferences > Package Settings > RTagsComplete > Settings > User

If you need Auto Completion add the following to Preferences > Settings > User

"auto_complete_triggers":
[
  {
    "characters": "<",
    "selector": "text.html"
  },{
    "characters": ".>: ",
    "selector": "source.c++.11, source.c++, source.c - string - comment - constant.numeric"
  }
]

Further reading

For a typical setup of a larger codebase built via autotools, check out Simplify development by adding RTags to your text editor.

Credits

Original code by Sergei Turukin. Hacked with plenty of new features by Till Toenshoff. Some code lifted from EasyClangComplete by Igor Bogoslavskyi.

On that thought, I would like to mention that EasyClangComplete is an excellent plugin, far more complex and in many ways superior to RTagsComplete. However, the approach taken by EasyClangComplete is arguably not so great for larger projects. EasyClangComplete aims to make things conveniently easy while RTagsComplete is attempting to offer plenty of features with highest possible performance at scale. Maybe some day EasyClangComplete will be based on clangd and that is likely the day I stop tinkering with RTagsComplete.

About

Sublime Text 3 C, C++ and Objective C code completion, navigation plugin based on RTags.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages