Giter Site home page Giter Site logo

demiaochen / vscode-clang-format-indent-4 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xaverh/vscode-clang-format

2.0 0.0 0.0 867 KB

A Visual Studio Code extension that provides C++, C, Obj-C, Java formatting with the use of clang-format

Home Page: https://marketplace.visualstudio.com/items?itemName=demiaochen.clang-format-indent-4

License: MIT License

C++ 13.31% TypeScript 86.69%

vscode-clang-format-indent-4's Introduction

Clang-Format Indent 4 for VS Code

License: MIT Marketplace

Code Formatter

Use clang-format to format your C/C++/Java/JavaScript/Objective-C/Objective-C++/Protobuf with indentations of 4 spaces like the following:

if (int i = 0; i < n; ++i) {
    while (true) {
        foo();
    }
} else {
    baz();
}

Acknowledgement

The extension is forked from Xaver Hellauer's Repo and modified to use clang-format with indent 4. More usage details can be found in the original repo.

Usage

Install clang-format use one of the following methods:

npm install -g clang-format       # NPM
sudo apt install clang-format     # Ubuntu Linux
winget install -e --id LLVM.LLVM  # Windows

Obtain the absolute path to clang-format:

which clang-format

Add the following to your vscode settings.json file (open with Ctrl/CMD+Shift+P and select Preferences: Open User Settings (JSON)):

{
  "clang-format.executable": "/absolute/path/to/clang-format",
}

To automatically format a file on save, add the following to your vscode settings.json file (example for C++):

{
  "editor.formatOnSave": true,
  "[cpp]": {
    "editor.defaultFormatter": "demiaochen.clang-format-indent-4",
  }
}

If you want to use a specific clang-format config file, add the following to your vscode settings.json file, and create a .clang-format file in the root of your project:

{
  "clang-format.style": "file",
}

Clang-Format

Clang-Format is a tool to format C/C++/Java/JavaScript/Objective-C/Objective-C++/Protobuf code. It can be configured with a config file named .clang-format within the working folder or a parent folder. Configuration see: http://clang.llvm.org/docs/ClangFormatStyleOptions.html

Source code

Available on github: https://github.com/demiaochen/vscode-clang-format-indent-4

vscode-clang-format-indent-4's People

Contributors

aspurdy avatar chris-cooper avatar cjhowedev avatar demiaochen avatar dependabot[bot] avatar evmar avatar ioachim avatar jlippuner avatar mjbvz avatar moowiz avatar morozov-5f avatar owent avatar prideout avatar r0oland avatar rizadh avatar trxcllnt avatar vperus avatar wade-ryan avatar xandox avatar xaverh avatar zaucy avatar

Stargazers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.