Skip to content

Commit 7ef4194

Browse files
committed
2 parents 4b0e47f + 84fcc9e commit 7ef4194

19 files changed

+2341
-566
lines changed

.clang-format

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
AlignAfterOpenBracket: Align
3+
AlignConsecutiveAssignments: false
4+
AlignConsecutiveDeclarations: false
5+
AlignEscapedNewlinesLeft: false
6+
AlignOperands: true
7+
AlignTrailingComments: true
8+
AllowAllParametersOfDeclarationOnNextLine: true
9+
AllowShortBlocksOnASingleLine: true
10+
AllowShortCaseLabelsOnASingleLine: true
11+
AllowShortFunctionsOnASingleLine: All
12+
AllowShortIfStatementsOnASingleLine: true
13+
AllowShortLoopsOnASingleLine: true
14+
AlwaysBreakAfterReturnType: None
15+
AlwaysBreakBeforeMultilineStrings: true
16+
AlwaysBreakTemplateDeclarations: true
17+
BinPackArguments: true
18+
BinPackParameters: true
19+
BreakBeforeBinaryOperators: All
20+
BreakBeforeBraces: WebKit
21+
BreakBeforeTernaryOperators: false
22+
BreakConstructorInitializersBeforeComma: false
23+
BreakStringLiterals: true
24+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
25+
Cpp11BracedListStyle: false
26+
DerivePointerAlignment: false
27+
IncludeCategories:
28+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
29+
Priority: 2
30+
- Regex: '^(<|"(gtest|isl|json)/)'
31+
Priority: 3
32+
- Regex: '.\*'
33+
Priority: 1
34+
IndentCaseLabels: false
35+
IndentWrappedFunctionNames: true
36+
KeepEmptyLinesAtTheStartOfBlocks: true
37+
MaxEmptyLinesToKeep: 1
38+
NamespaceIndentation: None
39+
ObjCSpaceAfterProperty: false
40+
ObjCSpaceBeforeProtocolList: false
41+
PenaltyBreakBeforeFirstCallParameter: 150
42+
PenaltyBreakComment: 100
43+
PenaltyBreakFirstLessLess: 0
44+
PenaltyBreakString: 100
45+
PenaltyExcessCharacter: 1000000
46+
PenaltyReturnTypeOnItsOwnLine: 200
47+
PointerAlignment: Left
48+
ReflowComments: true
49+
SortIncludes: true
50+
SpaceAfterCStyleCast: false
51+
SpaceBeforeAssignmentOperators: true
52+
SpaceBeforeParens: ControlStatements
53+
SpaceInEmptyParentheses: false
54+
SpacesBeforeTrailingComments: 1
55+
SpacesInAngles: false
56+
SpacesInCStyleCastParentheses: false
57+
SpacesInContainerLiterals: false
58+
SpacesInParentheses: false
59+
SpacesInSquareBrackets: false
60+
Standard: Cpp11
61+
AccessModifierOffset: -2
62+
BreakBeforeBraces: Attach
63+
JavaScriptQuotes: Single
64+
JavaScriptWrapImports: false
65+
UseTab: Never
66+
TabWidth: 2
67+
ConstructorInitializerIndentWidth: 2
68+
ContinuationIndentWidth: 2
69+
IndentWidth: 2
70+
ColumnLimit: 0
71+
Language: JavaScript
72+
...

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ typings/browser
66
typings/main.d.ts
77
typings/browser.d.ts
88
npm-debug.log
9+
.vscode/

.vscode/settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@
66
"search.exclude": {
77
"out": true // set this to false to include "out" folder in search results
88
},
9-
"typescript.tsdk": "./node_modules/typescript/lib" // we want to use the TS server from our node_modules folder to control its version
9+
"typescript.tsdk": "./node_modules/typescript/lib", // we want to use the TS server from our node_modules folder to control its version
10+
"clang-format.language.typescript.enable": true,
11+
"editor.formatOnType": false
1012
}

.vscodeignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ test/**
55
src/**
66
**/*.map
77
.gitignore
8-
tsconfig.json
8+
tsconfig.json
9+
clang-format.xcf

CHANGELOG.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Change Log
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
5+
6+
## [1.4.0] - 2017-04-20
7+
### Added
8+
- Output console shows syntax errors in `.clang-format` files
9+
- Extension works on Apex now
10+
11+
## [1.3.0] - 2017-04-20
12+
### Added
13+
- ```-assume-filename=``` option configurable as ```clang-format.assumeFilename``` in user/workspace settings
14+
15+
## [1.2.1] - 2017-03-04
16+
### Added
17+
- Extension works on Objective-C++ now (by [mjbvz](https://github.com/mjbvz))
18+
19+
## [1.1.1]
20+
### Fixed
21+
- Handling of clang-format binaries on Windows without .exe file-endings (by [Rizadh Nizam](https://github.com/rizadh))
22+
23+
## [1.0.0]
24+
### Added
25+
- ```clang-format.executable``` setting to choose clang-format binary (by [iainmcgin](https://github.com/iainmcgin))
26+
27+
## [0.11.2]
28+
### Changed
29+
- remove changelog from readme
30+
- change Marketplace category to "Formatter"
31+
32+
## [0.11.0]
33+
### Removed
34+
- 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```
35+
36+
## [0.10.3]
37+
### Fixed
38+
- fix info message for when executable is not found (by [prideout](https://github.com/prideout))
39+
40+
## [0.10.2]
41+
### Added
42+
- Marketplace appearance
43+
44+
## [0.10.1]
45+
### Fixed
46+
- minor fixes
47+
48+
## [0.10.0]
49+
- enabling of individual languages with ```clang-format.language.javascript.enable```, etc.*—requires reloading Visual Studio Code*
50+
51+
## [0.9.0]
52+
- add protobuf support (work with https://marketplace.visualstudio.com/items?itemName=peterj.proto)
53+
- add javascript/typescript support
54+
- allow different style & fallback style option for different languages
55+
- format on save is available now (just like https://github.com/Microsoft/vscode-go/blob/master/src/goMain.ts)
56+
57+
## [0.6.1]
58+
- clean up dependencies #9
59+
60+
## [0.6.0]
61+
- fixed multibyte character handling #7 (by [OWenT](https://github.com/owt5008137))
62+
- fixed "clang-format is ignoring the -style setting because of invalid value" #6 (by [OWenT](https://github.com/owt5008137))
63+
- LLVM style is now the default fallback style (fixes #1)
64+
- changed dependency to VS Code 1.0.0 or higher
65+
66+
## [0.5.0]
67+
- Included [OWenT](https://github.com/owt5008137)'s changes:
68+
- add setting of clang-format executable
69+
- add style setting
70+
- add fallback style setting
71+
72+
## [0.1.2]
73+
- Included [ioachim](https://github.com/ioachim/)'s changes:
74+
> it doesn't require saving the file, works by doing partial edits (instead of replacing the whole buffer), and enables range formatting.

README.md

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,53 @@
11
# README
22

3-
## Release history
3+
[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
44

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

11-
### v 0.6.1
12-
* clean up dependencies #9
6+
## Usage
137

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

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

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

30-
[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
18+
```json
19+
{
20+
"editor.formatOnSave": true
21+
}
22+
```
3123

24+
## Specifying the location of clang-format
3225

33-
## Usage
34-
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).
26+
This extension will attempt to find clang-format on your `PATH`.
27+
Alternatively, the clang-format executable can be specified in your vscode
28+
settings.json file:
29+
30+
```json
31+
{
32+
"clang-format.executable": "/absolute/path/to/clang-format"
33+
}
34+
```
35+
36+
Placeholders can also be used in the `clang-format.executable` value.
37+
The following placeholders are supported:
38+
39+
- `${workspaceRoot}` - replaced by the absolute path of the current vscode
40+
workspace root.
41+
- `${cwd}` - replaced by the current working directory of vscode.
42+
- `${env.VAR}` - replaced by the environment variable $VAR, e.g. `${env.HOME}`
43+
will be replaced by `$HOME`, your home directory.
44+
45+
Some examples:
46+
47+
- `${workspaceRoot}/node_modules/.bin/clang-format` - specifies the version of
48+
clang that has been added to your workspace by `npm install clang-format`.
49+
- `${env.HOME}/tools/clang38/clang-format` - use a specific clang format version
50+
under your home directory.
3551

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

0 commit comments

Comments
 (0)