pulsar-ide-clangd
C/C++ language support for Pulsar (forked from the original)
Joshua Breeden <jbreeden@me.com> / Andrew Dupont … 874 0 0.6.3 MIT GitHub
  • Made for Pulsar!

    This package was written specifically for Pulsar and did not exist in the Atom package repository.

pulsar-ide-clangd

Provides C and C++ language support for Pulsar using Clangd language server.

About this package

The clangd language server acts as a “brain” for lots of IDE features. This package knows how to feed that information to the packages that consume it.

Install this package, then install any of the following packages to get special features:

  • autocomplete-plus (builtin)
    • See autocompletion options as you type
  • symbols-view (builtin)
    • View and filter a list of symbols in the current file
    • View and filter a list of symbols across all files in the project
    • Jump to the definition of the symbol under the cursor
  • linter and linter-ui-default
    • View diagnostic messages as you type
  • intentions
    • Open a menu to view possible code actions for a diagnostic message
    • Open a menu to view possible code actions for the file at large
  • pulsar-refactor
    • Perform project-wide renaming of variables, methods, classes and types
  • pulsar-find-references
    • Place the cursor inside of a token to highlight other usages of that token
    • Place the cursor inside of a token, then view a find-and-replace-style “results” panel containing all usages of that token across your project
  • pulsar-outline-view
    • View a hierarchical list of the file’s symbols
  • atom-ide-outline
    • View a hierarchical list of the file’s symbols
    • View the call hierarchy for a given file
  • atom-ide-datatip
    • Hover over a symbol to see any related documentation, including method signatures
  • atom-ide-signature-help
    • View a function’s parameter signature as you type its arguments
  • atom-ide-code-format
    • Invoke on a buffer (or a subset of your buffer) to reformat your code according to the language server’s settings
  • atom-ide-definitions
    • Jump to the definition of the symbol under the cursor

All contributions and feedback are appreciated.

Requirements

Autocompletion support via autocomplete-plus is built-in. If you’re running Pulsar 1.113 or later, so is symbol search via symbols-view — symbols within the document and the project, plus go-to-declaration functionality.

Other services can be consumed with various packages. You can install [atom-ide-base] for the maximal experience, but I’d encourage you to pick and choose a bit more carefully!

Compilation Database

In order to make this plugin work effectively, clangd requires information about how your code should be compiled. There are two options: compile_commands.json, or compile_flags.txt.

compile_commands.json

CMake is currently your best bet for generating a compile_commands.json file. The command to generate compile_commands.json along with your project looks something like this: cmake (SOURCE_DIR) -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

CMake doesn't include header information in the compile_commands.json file. To rectify this, I use a tool called compdb.

Clangd won't see your compile_commands.json file if it's placed in your build directory, so you should either symlink it to your project directory, or have compdb generate its output there.

compile_flags.txt

Another supported solution is to make a compile_flags.txt file and place it in your project directory. Clangd will treat all project files with the same options. A simple compile_flags.txt might look something like this:

-std=c++11
-Iinclude
-DMY_DEBUG_FLAG

Areas of interest

  • Automatic installation of Clangd