Atom Packages Directory

a package directory for a text editor of the 21st Century

Clang by Joe Roback

Install with:
    apm install atom-clang
  

atom-clang

LibClang based code completion and linter for Atom Editor

Features

Requirements

Since this is a package uses C++, it will require the package to be compiled. This is automatically done for you by Atom, but it does have some requirements.

LibClang is detected via llvm-config command. It needs to build and link against the LibClang headers and library. It attempts to find the newest version of llvm-config it can on your system. One can override the search by having the LLVM_CONFIG environment variable set, e.g. LLVM_CONFIG=/opt/clang+llvm-3.9.0-x86_64-linux-gnu-ubuntu-16.04/bin/llvm-config. Currently, I do not know of way “at package install time” through Atom to let the user specify which one to use. See llvm-config.sh.

On Linux, any distro provided libclang versions 3.8 or 3.8 should work, LLVM’s Apt, or directly from LLVM. On Mac, the easiest way to upgrade to an atom-clang compatible LLVM version is with MacPorts, Homebrew, or directly from LLVM.

Currently, this only works on Linux and Mac. I do not have a Windows computer. I would welcome any patches / pull requests to add Windows support.

Installing

This package should be installed through the Atom package manager. Search for package named atom-clang. For the bleeding edge, you can clone this repository and link it into Atom with apm if desired.

Global Configuration

This package can work out-of-the-box, but usually requires some minor configuration. This is because parsing with LibClang, literally runs clang over your source files and usually needs the CFLAGS or CXXFLAGS one would use to compile.

You can set global CFLAGS and CXXFLAGS. This will work for any random projects without any major flags.

Per Project Configuration

Per project configuration with Atom is an ongoing open feature request. Thankfully, Project Manager gives us at least 99% of what we want. It does require you to manually edit the project settings file.

CoffeeScript my_project: title: "Test Project" paths: [ "/home/user/my_project" ] icon: "icon-file-code" settings: "*": "atom-clang": linterEnabled: true includeDeprecated: false defaultCFlags: [ "-std=c99" "-Wall" "-Wextra" "-D_REENTRANT" "-D_GNU_SOURCE" "-I /opt/local/include" "-I /home/user/my_project" ] defaultCXXFlags: [ "-std=c++1z" "-Wall" "-Wextra" "-D_REENTRANT" "-D_GNU_SOURCE" "-fexceptions" "-I /opt/local/include" "-I /home/user/my_project" ]

Keymaps

Issues

Please report all issues in the issue tracker.

The more information you can include, the better. CFlags/CXXFlags especially. Having a reproducible test case would also greatly increase the debug time, though I realize that is not always possible.

Roadmap

I would love the roadmap to be largely driven by users, but her is a list I came up to get started.

Short Term

Long Term

License

MIT License

Copyright (c) 2016, Joe Roback <joe.roback@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Keywords: c, c++, clang, completion, libclang, linter Suggest keywords
Fork me on GitHub