Convert Figma logo to code with AI

Andersbakken logortags

A client/server indexer for c/c++/objc[++] with integration for Emacs based on clang.

1,829
253
1,829
177

Top Related Projects

6,748

Mirror of CMake upstream repository

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.

2,343

C/C++ language server supporting multi-million line code base, powered by libclang. Emacs, Vim, VSCode, and others with language server protocol support. Cross references, completion, diagnostics, semantic highlighting and more

3,746

C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting

4,771

Bear is a tool that generates a compilation database for clang tooling.

Quick Overview

RTags is a client/server indexer for C/C++ with integration for Emacs. It provides a way to navigate and refactor C++ code efficiently, offering features like real-time syntax checking, auto-completion, and jump-to-definition functionality. RTags uses Clang for parsing C/C++ files and maintains a persistent database of symbol information.

Pros

  • Powerful code navigation and refactoring capabilities for C/C++ projects
  • Seamless integration with Emacs, enhancing the C++ development experience
  • Real-time syntax checking and auto-completion, improving code quality and productivity
  • Uses Clang for accurate parsing and understanding of complex C++ code

Cons

  • Primarily designed for Emacs, which may limit its appeal to users of other editors
  • Initial setup and configuration can be complex, especially for large projects
  • Requires ongoing maintenance of the index for optimal performance
  • May have a steeper learning curve compared to some other C++ development tools

Getting Started

To get started with RTags:

  1. Install RTags and its dependencies:

    git clone https://github.com/Andersbakken/rtags.git
    cd rtags
    cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 .
    make
    
  2. Add RTags to your PATH and start the RTags daemon:

    export PATH=$PATH:/path/to/rtags/bin
    rdm &
    
  3. In your Emacs configuration, add RTags support:

    (add-to-list 'load-path "/path/to/rtags/src")
    (require 'rtags)
    (rtags-enable-standard-keybindings)
    
  4. Index your project:

    rc -J /path/to/your/project
    

Now you can use RTags features in Emacs, such as rtags-find-symbol-at-point (usually bound to M-.) to jump to definitions.

Competitor Comparisons

6,748

Mirror of CMake upstream repository

Pros of CMake

  • Widely adopted and supported across multiple platforms and IDEs
  • Extensive documentation and large community for support
  • Powerful scripting capabilities for complex build configurations

Cons of CMake

  • Steeper learning curve, especially for complex projects
  • Can be verbose and require more boilerplate code
  • Less focused on code indexing and refactoring capabilities

Code Comparison

CMake example:

cmake_minimum_required(VERSION 3.10)
project(MyProject)
add_executable(MyApp main.cpp)
target_link_libraries(MyApp PRIVATE MyLibrary)

RTags doesn't have a direct code equivalent, as it's primarily a C/C++ indexer and source code navigation tool. It uses compilation databases generated by build systems like CMake.

Key Differences

  • Purpose: CMake is a build system generator, while RTags is a code indexer and navigation tool
  • Scope: CMake manages the entire build process, RTags focuses on code analysis and navigation
  • Integration: CMake integrates with various build tools and IDEs, RTags works alongside existing build systems

Use Cases

  • CMake: Ideal for cross-platform projects requiring flexible build configurations
  • RTags: Best for developers seeking advanced code navigation and refactoring in C/C++ projects

Both tools can be complementary in a C/C++ development workflow, with CMake generating the build system and compilation database, which RTags can then use for indexing and analysis.

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.

Pros of llvm-project

  • Comprehensive toolchain: Includes compiler, debugger, and runtime libraries
  • Widely adopted and supported by major tech companies
  • Extensive documentation and community resources

Cons of llvm-project

  • Steeper learning curve due to its complexity
  • Larger codebase, which may be overwhelming for small projects
  • Requires more system resources to build and run

Code Comparison

rtags:

class Project : public std::enable_shared_from_this<Project>
{
public:
    std::shared_ptr<IndexDataMessage> createIndexDataMessage() const;
};

llvm-project:

class Module {
public:
  Module(StringRef Name, LLVMContext& C);
  const GlobalVariable *getNamedGlobal(StringRef Name) const;
};

Summary

rtags is a lightweight C/C++ indexer focused on code navigation and refactoring, while llvm-project is a comprehensive compiler infrastructure project. rtags is more suitable for quick setup and integration with editors, whereas llvm-project offers a complete toolchain for building compilers and related tools. The code snippets show rtags' focus on project management and indexing, while llvm-project demonstrates its emphasis on module-level operations within a compiler framework.

2,343

C/C++ language server supporting multi-million line code base, powered by libclang. Emacs, Vim, VSCode, and others with language server protocol support. Cross references, completion, diagnostics, semantic highlighting and more

Pros of cquery

  • Faster indexing and query response times
  • Lower memory usage, especially for large projects
  • Built-in support for cross-compilation and multiple compilation databases

Cons of cquery

  • Less mature and potentially less stable than RTags
  • Smaller community and fewer integrations with editors/IDEs
  • Limited support for non-C++ languages compared to RTags

Code Comparison

cquery uses libclang for parsing, while RTags uses its own custom parser. This can lead to differences in how they handle certain C++ constructs.

cquery:

void cquery_parse(const char* filename) {
    CXIndex index = clang_createIndex(0, 0);
    CXTranslationUnit unit = clang_parseTranslationUnit(index, filename, nullptr, 0, nullptr, 0, CXTranslationUnit_None);
    // ... process the translation unit
}

RTags:

void rtags_parse(const char* filename) {
    Source source(filename);
    Parser parser;
    parser.parse(source);
    // ... process the parsed AST
}

Both projects aim to provide efficient code indexing and querying for C++ projects, but they take different approaches in implementation and feature sets. cquery focuses on performance and resource efficiency, while RTags offers broader language support and integration options.

3,746

C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting

Pros of ccls

  • Faster indexing and lower memory usage
  • Better support for C++20 features
  • More actively maintained with frequent updates

Cons of ccls

  • Less mature and potentially less stable than RTags
  • Fewer integration options with text editors and IDEs
  • May have a steeper learning curve for configuration

Code Comparison

RTags:

class RTagsClangThread : public Thread {
public:
    RTagsClangThread(const std::shared_ptr<Project> &project,
                     const Source &source,
                     const std::shared_ptr<Connection> &connection);
};

ccls:

struct Project {
  std::unordered_map<std::string, std::vector<std::string>> folder2compilers;
  std::vector<Directory> extra_flags;
  std::string project_dir;
};

Both projects aim to provide C/C++ language servers, but they differ in their implementation and focus. RTags has been around longer and offers more integrations, while ccls is newer, faster, and more actively developed. The code snippets show different approaches to project management, with RTags using a thread-based model and ccls utilizing a more data-oriented structure.

4,771

Bear is a tool that generates a compilation database for clang tooling.

Pros of Bear

  • Language-agnostic: Works with any compiler or build system
  • Simpler setup: Generates compilation database without complex configuration
  • Lightweight: Focuses solely on generating compilation database

Cons of Bear

  • Limited functionality: Only generates compilation database, no indexing or code navigation
  • Requires manual integration: Must be run separately for each build
  • Less real-time: Doesn't provide live updates as code changes

Code Comparison

Bear usage:

bear -- make

RTags usage:

rc -J .
rdm &
rc -w

Bear generates a compile_commands.json file, while RTags creates an in-memory index. Bear is simpler to use but provides less functionality. RTags offers more advanced features like code navigation and refactoring, but requires more setup and ongoing management.

Bear is best for projects needing a quick compilation database, while RTags is suited for developers wanting comprehensive C/C++ code analysis and navigation tools integrated into their workflow.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

#+OPTIONS: ^:nil

#+html:

MELPA MELPA
#+html:
rtags
MELPA
#+html:
rtags-xrefac-rtagscompany-rtagsflycheck-rtagshelm-rtagsivy-rtags
MELPAMELPAMELPAMELPAMELPAMELPA

  • Introduction RTags is a client/server application that indexes C/C++ code and keeps a persistent file-based database of references, declarations, definitions, symbolnames etc. There's also limited support for ObjC/ObjC++. It allows you to find symbols by name (including nested class and namespace scope). Most importantly we give you proper follow-symbol and find-references support. We also have neat little things like rename-symbol, integration with clang's "fixits" (https://clang.llvm.org/diagnostics.html). We also integrate with flymake using clang's vastly superior errors and warnings. Since RTags constantly will reindex "dirty" files you get live updates of compiler errors and warnings. Since we already know how to compile your sources we have a way to quickly bring up the preprocessed output of the current source file in a buffer.

While existing taggers like gnu global, cscope, etags, ctags etc do a decent job for C they often fall a little bit short for C++. With its incredible lexical complexity, parsing C++ is an incredibly hard task and we make no bones about the fact that the only reason we are able to improve on the current tools is because of clang (https://clang.llvm.org/). RTags is named RTags in recognition of Roberto Raggi on whose C++ parser we intended to base this project but he assured us clang was the way to go. The name stuck though.

Tarball releases are available here: https://github.com/Andersbakken/rtags/releases/

Build RTags

#+BEGIN_SRC sh git clone --recursive https://github.com/Andersbakken/rtags.git cd rtags cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 . make #+END_SRC

Start the RTags daemon (=rdm=)

#+BEGIN_SRC sh ./bin/rdm & #+END_SRC

Index the RTags project, and wait until =rdm= is silent

#+BEGIN_SRC sh ./bin/rc -J . #+END_SRC

Open source file in =emacs=

#+BEGIN_SRC sh emacs +74:34 src/rdm.cpp #+END_SRC

Load =rtags.el=

#+BEGIN_EXAMPLE M-: (load-file "rtags.el") RET #+END_EXAMPLE

Ensure =rc= can be found

#+BEGIN_EXAMPLE M-x set-variable RET rtags-path RET "../bin" RET #+END_EXAMPLE

Call =rtags-find-symbol-at-point=

#+BEGIN_EXAMPLE M-x rtags-find-symbol-at-point RET #+END_EXAMPLE

Your location is now on the definition of =Server::instance()=

  • Documentation The documentation can be found in the [[https://github.com/Andersbakken/rtags/wiki][Wiki]].
  • Disclaimer RTags is still under development and is not the most stable piece of software you'll ever find. We're constantly working to improve on it.