Skip to content

Commit 7d622c2

Browse files
committed
Add vscode config for clang+mingw(msys2)
1 parent fb029ec commit 7d622c2

File tree

7 files changed

+370
-0
lines changed

7 files changed

+370
-0
lines changed
Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: Microsoft
4+
AccessModifierOffset: -2
5+
AlignAfterOpenBracket: Align
6+
AlignArrayOfStructures: None
7+
AlignConsecutiveMacros: None
8+
AlignConsecutiveAssignments: None
9+
AlignConsecutiveBitFields: None
10+
AlignConsecutiveDeclarations: None
11+
AlignEscapedNewlines: Right
12+
AlignOperands: Align
13+
AlignTrailingComments: true
14+
AllowAllArgumentsOnNextLine: true
15+
AllowAllConstructorInitializersOnNextLine: true
16+
AllowAllParametersOfDeclarationOnNextLine: true
17+
AllowShortEnumsOnASingleLine: false
18+
AllowShortBlocksOnASingleLine: Never
19+
AllowShortCaseLabelsOnASingleLine: false
20+
AllowShortFunctionsOnASingleLine: None
21+
AllowShortLambdasOnASingleLine: All
22+
AllowShortIfStatementsOnASingleLine: Never
23+
AllowShortLoopsOnASingleLine: false
24+
AlwaysBreakAfterDefinitionReturnType: None
25+
AlwaysBreakAfterReturnType: None
26+
AlwaysBreakBeforeMultilineStrings: false
27+
AlwaysBreakTemplateDeclarations: MultiLine
28+
AttributeMacros:
29+
- __capability
30+
BinPackArguments: true
31+
BinPackParameters: true
32+
BraceWrapping:
33+
AfterCaseLabel: false
34+
AfterClass: true
35+
AfterControlStatement: Always
36+
AfterEnum: true
37+
AfterFunction: true
38+
AfterNamespace: true
39+
AfterObjCDeclaration: true
40+
AfterStruct: true
41+
AfterUnion: false
42+
AfterExternBlock: true
43+
BeforeCatch: true
44+
BeforeElse: true
45+
BeforeLambdaBody: false
46+
BeforeWhile: false
47+
IndentBraces: false
48+
SplitEmptyFunction: true
49+
SplitEmptyRecord: true
50+
SplitEmptyNamespace: true
51+
BreakBeforeBinaryOperators: None
52+
BreakBeforeConceptDeclarations: true
53+
BreakBeforeBraces: Custom
54+
BreakBeforeInheritanceComma: false
55+
BreakInheritanceList: BeforeColon
56+
BreakBeforeTernaryOperators: true
57+
BreakConstructorInitializersBeforeComma: false
58+
BreakConstructorInitializers: BeforeColon
59+
BreakAfterJavaFieldAnnotations: false
60+
BreakStringLiterals: true
61+
ColumnLimit: 80
62+
CommentPragmas: '^ IWYU pragma:'
63+
CompactNamespaces: false
64+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
65+
ConstructorInitializerIndentWidth: 4
66+
ContinuationIndentWidth: 4
67+
Cpp11BracedListStyle: true
68+
DeriveLineEnding: true
69+
DerivePointerAlignment: false
70+
DisableFormat: false
71+
EmptyLineAfterAccessModifier: Never
72+
EmptyLineBeforeAccessModifier: LogicalBlock
73+
ExperimentalAutoDetectBinPacking: false
74+
FixNamespaceComments: true
75+
ForEachMacros:
76+
- foreach
77+
- Q_FOREACH
78+
- BOOST_FOREACH
79+
IfMacros:
80+
- KJ_IF_MAYBE
81+
IncludeBlocks: Preserve
82+
IncludeCategories:
83+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
84+
Priority: 2
85+
SortPriority: 0
86+
CaseSensitive: false
87+
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
88+
Priority: 3
89+
SortPriority: 0
90+
CaseSensitive: false
91+
- Regex: '.*'
92+
Priority: 1
93+
SortPriority: 0
94+
CaseSensitive: false
95+
IncludeIsMainRegex: '(Test)?$'
96+
IncludeIsMainSourceRegex: ''
97+
IndentAccessModifiers: false
98+
IndentCaseLabels: false
99+
IndentCaseBlocks: false
100+
IndentGotoLabels: true
101+
IndentPPDirectives: None
102+
IndentExternBlock: AfterExternBlock
103+
IndentRequires: false
104+
IndentWidth: 4
105+
IndentWrappedFunctionNames: false
106+
InsertTrailingCommas: None
107+
JavaScriptQuotes: Leave
108+
JavaScriptWrapImports: true
109+
KeepEmptyLinesAtTheStartOfBlocks: true
110+
LambdaBodyIndentation: Signature
111+
MacroBlockBegin: ''
112+
MacroBlockEnd: ''
113+
MaxEmptyLinesToKeep: 1
114+
NamespaceIndentation: None
115+
ObjCBinPackProtocolList: Auto
116+
ObjCBlockIndentWidth: 2
117+
ObjCBreakBeforeNestedBlockParam: true
118+
ObjCSpaceAfterProperty: false
119+
ObjCSpaceBeforeProtocolList: true
120+
PenaltyBreakAssignment: 2
121+
PenaltyBreakBeforeFirstCallParameter: 19
122+
PenaltyBreakComment: 300
123+
PenaltyBreakFirstLessLess: 120
124+
PenaltyBreakString: 1000
125+
PenaltyBreakTemplateDeclaration: 10
126+
PenaltyExcessCharacter: 1000000
127+
PenaltyReturnTypeOnItsOwnLine: 1000
128+
PenaltyIndentedWhitespace: 0
129+
PointerAlignment: Right
130+
PPIndentWidth: -1
131+
ReferenceAlignment: Pointer
132+
ReflowComments: true
133+
ShortNamespaceLines: 1
134+
SortIncludes: CaseSensitive
135+
SortJavaStaticImport: Before
136+
SortUsingDeclarations: true
137+
SpaceAfterCStyleCast: false
138+
SpaceAfterLogicalNot: false
139+
SpaceAfterTemplateKeyword: true
140+
SpaceBeforeAssignmentOperators: true
141+
SpaceBeforeCaseColon: false
142+
SpaceBeforeCpp11BracedList: false
143+
SpaceBeforeCtorInitializerColon: true
144+
SpaceBeforeInheritanceColon: true
145+
SpaceBeforeParens: ControlStatements
146+
SpaceAroundPointerQualifiers: Default
147+
SpaceBeforeRangeBasedForLoopColon: true
148+
SpaceInEmptyBlock: false
149+
SpaceInEmptyParentheses: false
150+
SpacesBeforeTrailingComments: 1
151+
SpacesInAngles: Never
152+
SpacesInConditionalStatement: false
153+
SpacesInContainerLiterals: true
154+
SpacesInCStyleCastParentheses: false
155+
SpacesInLineCommentPrefix:
156+
Minimum: 1
157+
Maximum: -1
158+
SpacesInParentheses: false
159+
SpacesInSquareBrackets: false
160+
SpaceBeforeSquareBrackets: false
161+
BitFieldColonSpacing: Both
162+
Standard: Latest
163+
StatementAttributeLikeMacros:
164+
- Q_EMIT
165+
StatementMacros:
166+
- Q_UNUSED
167+
- QT_REQUIRE_VERSION
168+
TabWidth: 4
169+
UseCRLF: false
170+
UseTab: Never
171+
WhitespaceSensitiveMacros:
172+
- STRINGIZE
173+
- PP_STRINGIZE
174+
- BOOST_PP_STRINGIZE
175+
- NS_SWIFT_NAME
176+
- CF_SWIFT_NAME
177+
...
178+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
Checks: "bugprone-*,\
3+
google-*,\
4+
misc-*,\
5+
modernize-*,\
6+
performance-*,\
7+
readability-*,\
8+
portability-*,\
9+
"
10+
HeaderFilterRegex: 'Source/cm[^/]*\.(h|hxx|cxx)$'
11+
CheckOptions:
12+
13+
- key: modernize-use-default-member-init.UseAssignment
14+
value: '1'
15+
- key: modernize-use-equals-default.IgnoreMacros
16+
value: '0'
17+
- key: modernize-use-auto.MinTypeNameLength
18+
value: '80'
19+
...
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "clang",
6+
"type": "lldb",
7+
"request": "launch",
8+
"program": "${fileDirname}/build/${fileBasenameNoExtension}.exe",
9+
"args": [],
10+
"cwd": "${workspaceFolder}/build/",
11+
"sourceLanguages": [
12+
"C"
13+
],
14+
"stdio": [],
15+
"preLaunchTask": "clangBuild_C"
16+
},
17+
{
18+
"name": "clang++",
19+
"type": "lldb",
20+
"request": "launch",
21+
"program": "${fileDirname}/build/${fileBasenameNoExtension}.exe",
22+
"args": [],
23+
"cwd": "${workspaceFolder}/build/",
24+
"sourceLanguages": [
25+
"C++"
26+
],
27+
"stdio": [],
28+
"preLaunchTask": "clangBuild_C++"
29+
},
30+
]
31+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
msys2:
2+
1.
3+
pacman -S --needed mingw-w64-x86_64-{binutils,gcc,gdb,make,clang}
4+
pacman -S --needed mingw-w64-x86_64-clang-tools-extra
5+
[clcs]
6+
pacman -S --needed mingw-w64-x86_64-{clang,clang-tools-extra,polly,cmake,jq,ninja,ncurses,rapidjson}
7+
# 然后下载ccls并编译
8+
cd ccls
9+
cmake -H. -BRelease -G Ninja -DCMAKE_CXX_FLAGS=-D__STDC_FORMAT_MACROS
10+
ninja -C Release
11+
[manjaro]
12+
sudo pacman -S --needed gcc clang
13+
sudo pacman -S --needed ccls
14+
2.
15+
scoop install msys2
16+
msys2
17+
pacman -S mingw-w64-x86_64-toolchain
18+
MinGW
19+
xmake
20+
clangd
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"terminal.integrated.env.windows": {
3+
"CHERE_INVOKING": "1"
4+
},
5+
"editor.minimap.enabled": true,
6+
"[cpp]": {
7+
"editor.quickSuggestions": {
8+
"other": "on",
9+
"comments": "off",
10+
"strings": "off"
11+
}
12+
},
13+
"[c]": {
14+
"editor.quickSuggestions": {
15+
"other": "on",
16+
"comments": "off",
17+
"strings": "off"
18+
}
19+
},
20+
"files.associations": {
21+
"cmath": "c",
22+
"*.tcc": "c",
23+
"stdio.h": "c"
24+
},
25+
"clangd.arguments": [
26+
"--query-driver=C:/Users/Mayuri/scoop/apps/msys2/current/mingw64/bin/clang.exe",
27+
"--completion-style=detailed",
28+
"--header-insertion=never",
29+
"--clang-tidy",
30+
],
31+
"clangd.fallbackFlags": [
32+
"-IC:/Users/Mayuri/scoop/apps/msys2/current/mingw64/include/"
33+
],
34+
"clangd.serverCompletionRanking": true,
35+
"clang.executable": "C:/Users/Mayuri/scoop/apps/msys2/current/mingw64/bin/clang.exe",
36+
"lldb.consoleMode": "evaluate", //调试控制台模式为终端命令模式,可调用lldb命令
37+
"lldb.launch.sourceLanguages": [ //调试语言
38+
"cpp",
39+
"c"
40+
],
41+
"lldb.launch.expressions": "native", //使用原生表达式
42+
"lldb.displayFormat": "auto",
43+
"lldb.dereferencePointers": false,
44+
"lldb.showDisassembly": "auto",
45+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "process",
6+
"label": "clangBuild_C",
7+
"command": "C:/Users/Mayuri/scoop/apps/msys2/current/mingw64/bin/clang.exe",
8+
"args": [
9+
"-glldb",
10+
"-std=c11",
11+
// "${fileBasenameNoExtension}*",
12+
"${fileBasenameNoExtension}.c",
13+
"-o",
14+
"${fileDirname}/build/${fileBasenameNoExtension}.exe"
15+
],
16+
"options": {
17+
"cwd": "${fileDirname}"
18+
},
19+
"problemMatcher": {
20+
"owner": "lldb",
21+
"fileLocation": [
22+
"relative",
23+
"${fileDirname}"
24+
],
25+
"pattern": [
26+
{
27+
"regexp": "^(ld.lld:.*)$",
28+
"message": 1
29+
},
30+
{
31+
"regexp": ">>> referenced by (.*):(\\d+)",
32+
"file": 1,
33+
"line": 2
34+
}
35+
]
36+
},
37+
"group": {
38+
"kind": "build",
39+
"isDefault": true
40+
}
41+
},
42+
{
43+
"type": "process",
44+
"label": "clangBuild_C++",
45+
"command": "C:/Users/Mayuri/scoop/apps/msys2/current/mingw64/bin/clang++.exe",
46+
"args": [
47+
"-glldb",
48+
"-std=c++11",
49+
"${fileBasename}",
50+
"-o",
51+
"${fileDirname}/build/${fileBasenameNoExtension}.exe",
52+
"-IC:/Users/Mayuri/scoop/apps/msys2/current/mingw64/include/"
53+
],
54+
"options": {
55+
"cwd": "${fileDirname}"
56+
},
57+
"problemMatcher": {
58+
"owner": "lldb",
59+
"fileLocation": [
60+
"relative",
61+
"${fileDirname}"
62+
],
63+
"pattern": {
64+
"regexp": "^(.*\\.cpp):(\\d+):(\\d+): (.*)$",
65+
"file": 1,
66+
"line": 2,
67+
"column": 3,
68+
"message": 4
69+
}
70+
}
71+
}
72+
]
73+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-xc
2+
-std=c11
3+
-Wall
4+
-IC:/Users/Mayuri/scoop/apps/msys2/current/mingw64/include

0 commit comments

Comments
 (0)