Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
owent committed May 24, 2017
2 parents 4b0e47f + 84fcc9e commit 7ef4194
Show file tree
Hide file tree
Showing 19 changed files with 2,341 additions and 566 deletions.
72 changes: 72 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: false
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BreakBeforeBinaryOperators: All
BreakBeforeBraces: WebKit
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: false
BreakStringLiterals: true
ConstructorInitializerAllOnOneLineOrOnePerLine: true
Cpp11BracedListStyle: false
DerivePointerAlignment: false
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|isl|json)/)'
Priority: 3
- Regex: '.\*'
Priority: 1
IndentCaseLabels: false
IndentWrappedFunctionNames: true
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 150
PenaltyBreakComment: 100
PenaltyBreakFirstLessLess: 0
PenaltyBreakString: 100
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
AccessModifierOffset: -2
BreakBeforeBraces: Attach
JavaScriptQuotes: Single
JavaScriptWrapImports: false
UseTab: Never
TabWidth: 2
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 2
IndentWidth: 2
ColumnLimit: 0
Language: JavaScript
...
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ typings/browser
typings/main.d.ts
typings/browser.d.ts
npm-debug.log
.vscode/
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
"typescript.tsdk": "./node_modules/typescript/lib" // we want to use the TS server from our node_modules folder to control its version
"typescript.tsdk": "./node_modules/typescript/lib", // we want to use the TS server from our node_modules folder to control its version
"clang-format.language.typescript.enable": true,
"editor.formatOnType": false
}
3 changes: 2 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ test/**
src/**
**/*.map
.gitignore
tsconfig.json
tsconfig.json
clang-format.xcf
74 changes: 74 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Change Log
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.4.0] - 2017-04-20
### Added
- Output console shows syntax errors in `.clang-format` files
- Extension works on Apex now

## [1.3.0] - 2017-04-20
### Added
- ```-assume-filename=``` option configurable as ```clang-format.assumeFilename``` in user/workspace settings

## [1.2.1] - 2017-03-04
### Added
- Extension works on Objective-C++ now (by [mjbvz](https://github.com/mjbvz))

## [1.1.1]
### Fixed
- Handling of clang-format binaries on Windows without .exe file-endings (by [Rizadh Nizam](https://github.com/rizadh))

## [1.0.0]
### Added
- ```clang-format.executable``` setting to choose clang-format binary (by [iainmcgin](https://github.com/iainmcgin))

## [0.11.2]
### Changed
- remove changelog from readme
- change Marketplace category to "Formatter"

## [0.11.0]
### Removed
- this extension no longer provides its own formatOnSave feature since Visual Studio Code ^1.6.0 provides this out of the box. In order to still use *format on save* you have to put ```"editor.formatOnSave": true``` in your ```settings.json```

## [0.10.3]
### Fixed
- fix info message for when executable is not found (by [prideout](https://github.com/prideout))

## [0.10.2]
### Added
- Marketplace appearance

## [0.10.1]
### Fixed
- minor fixes

## [0.10.0]
- enabling of individual languages with ```clang-format.language.javascript.enable```, etc.*—requires reloading Visual Studio Code*

## [0.9.0]
- add protobuf support (work with https://marketplace.visualstudio.com/items?itemName=peterj.proto)
- add javascript/typescript support
- allow different style & fallback style option for different languages
- format on save is available now (just like https://github.com/Microsoft/vscode-go/blob/master/src/goMain.ts)

## [0.6.1]
- clean up dependencies #9

## [0.6.0]
- fixed multibyte character handling #7 (by [OWenT](https://github.com/owt5008137))
- fixed "clang-format is ignoring the -style setting because of invalid value" #6 (by [OWenT](https://github.com/owt5008137))
- LLVM style is now the default fallback style (fixes #1)
- changed dependency to VS Code 1.0.0 or higher

## [0.5.0]
- Included [OWenT](https://github.com/owt5008137)'s changes:
- add setting of clang-format executable
- add style setting
- add fallback style setting

## [0.1.2]
- Included [ioachim](https://github.com/ioachim/)'s changes:
> it doesn't require saving the file, works by doing partial edits (instead of replacing the whole buffer), and enables range formatting.
64 changes: 40 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,53 @@
# README

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

### v 0.9.0
* add protobuf support (work with https://marketplace.visualstudio.com/items?itemName=peterj.proto)
* add javascript/typescript support
* allow different style & fallback style option for different languages
* format on save is available now (just like https://github.com/Microsoft/vscode-go/blob/master/src/goMain.ts)

### v 0.6.1
* clean up dependencies #9
## Usage

### v 0.6.0
* fixed multibyte character handling #7 (by [OWenT](https://github.com/owt5008137))
* fixed "clang-format is ignoring the -style setting because of invalid value" #6 (by [OWenT](https://github.com/owt5008137))
* LLVM style is now the default fallback style (fixes #1)
* changed dependency to VS Code 1.0.0 or higher
This extension allows clang-format (version 3.6 or higher) to be used to format C/C++, Javascript etc.
source files directly from within Visual Studio Code.

### v 0.5.0
* Included [OWenT](https://github.com/owt5008137)'s changes:
1. add setting of clang-format executable
2. add style setting
3. add fallback style setting
Files can be formatted on-demand by right clicking in the document and
selecting "Format Document", or by using the associated keyboard shortcut
(usually Ctrl+Shift+F on Windows/Linux, and Cmd+Shift+F on Mac).

### v 0.1.2
* Included [ioachim](https://github.com/ioachim/)'s changes:
> it doesn't require saving the file, works by doing partial edits (instead of replacing the whole buffer), and enables range formatting.
To automatically format a file on save, add the following to your
vscode settings.json file:

[Clang-Format](http://clang.llvm.org/docs/ClangFormat.html) is a tool to format C/C++/Java/JavaScript/Objective-C/Protobuf code. It can be configured with a config file within the working folder or a parent folder. Configuration see: http://clang.llvm.org/docs/ClangFormatStyleOptions.html
```json
{
"editor.formatOnSave": true
}
```

## Specifying the location of clang-format

## Usage
If clang-format is installed and in PATH, C/C++ etc source files can be formatted with Visual Studio Code's built-in formatter (Usually: Ctrl+Shift+F).
This extension will attempt to find clang-format on your `PATH`.
Alternatively, the clang-format executable can be specified in your vscode
settings.json file:

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

Placeholders can also be used in the `clang-format.executable` value.
The following placeholders are supported:

- `${workspaceRoot}` - replaced by the absolute path of the current vscode
workspace root.
- `${cwd}` - replaced by the current working directory of vscode.
- `${env.VAR}` - replaced by the environment variable $VAR, e.g. `${env.HOME}`
will be replaced by `$HOME`, your home directory.

Some examples:

- `${workspaceRoot}/node_modules/.bin/clang-format` - specifies the version of
clang that has been added to your workspace by `npm install clang-format`.
- `${env.HOME}/tools/clang38/clang-format` - use a specific clang format version
under your home directory.

## Source code
Available on github: https://github.com/xaverh/vscode-clang-format-provider
Loading

0 comments on commit 7ef4194

Please sign in to comment.