Skip to content

Commit

Permalink
Add vscode config for clang+mingw(msys2)
Browse files Browse the repository at this point in the history
  • Loading branch information
DataEraserC committed Oct 23, 2022
1 parent fb029ec commit 7d622c2
Show file tree
Hide file tree
Showing 7 changed files with 370 additions and 0 deletions.
178 changes: 178 additions & 0 deletions Windows/.vscode-setting/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
---
Language: Cpp
# BasedOnStyle: Microsoft
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveMacros: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: false
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: true
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 1
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseLabels: false
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentRequires: false
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: Signature
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 1000
PenaltyIndentedWhitespace: 0
PointerAlignment: Right
PPIndentWidth: -1
ReferenceAlignment: Pointer
ReflowComments: true
ShortNamespaceLines: 1
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceAroundPointerQualifiers: Default
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both
Standard: Latest
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 4
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
...

19 changes: 19 additions & 0 deletions Windows/.vscode-setting/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
Checks: "bugprone-*,\
google-*,\
misc-*,\
modernize-*,\
performance-*,\
readability-*,\
portability-*,\
"
HeaderFilterRegex: 'Source/cm[^/]*\.(h|hxx|cxx)$'
CheckOptions:

- key: modernize-use-default-member-init.UseAssignment
value: '1'
- key: modernize-use-equals-default.IgnoreMacros
value: '0'
- key: modernize-use-auto.MinTypeNameLength
value: '80'
...
31 changes: 31 additions & 0 deletions Windows/.vscode-setting/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "clang",
"type": "lldb",
"request": "launch",
"program": "${fileDirname}/build/${fileBasenameNoExtension}.exe",
"args": [],
"cwd": "${workspaceFolder}/build/",
"sourceLanguages": [
"C"
],
"stdio": [],
"preLaunchTask": "clangBuild_C"
},
{
"name": "clang++",
"type": "lldb",
"request": "launch",
"program": "${fileDirname}/build/${fileBasenameNoExtension}.exe",
"args": [],
"cwd": "${workspaceFolder}/build/",
"sourceLanguages": [
"C++"
],
"stdio": [],
"preLaunchTask": "clangBuild_C++"
},
]
}
20 changes: 20 additions & 0 deletions Windows/.vscode-setting/.vscode/note.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
msys2:
1.
pacman -S --needed mingw-w64-x86_64-{binutils,gcc,gdb,make,clang}
pacman -S --needed mingw-w64-x86_64-clang-tools-extra
[clcs]
pacman -S --needed mingw-w64-x86_64-{clang,clang-tools-extra,polly,cmake,jq,ninja,ncurses,rapidjson}
# 然后下载ccls并编译
cd ccls
cmake -H. -BRelease -G Ninja -DCMAKE_CXX_FLAGS=-D__STDC_FORMAT_MACROS
ninja -C Release
[manjaro]
sudo pacman -S --needed gcc clang
sudo pacman -S --needed ccls
2.
scoop install msys2
msys2
pacman -S mingw-w64-x86_64-toolchain
MinGW
xmake
clangd
45 changes: 45 additions & 0 deletions Windows/.vscode-setting/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"terminal.integrated.env.windows": {
"CHERE_INVOKING": "1"
},
"editor.minimap.enabled": true,
"[cpp]": {
"editor.quickSuggestions": {
"other": "on",
"comments": "off",
"strings": "off"
}
},
"[c]": {
"editor.quickSuggestions": {
"other": "on",
"comments": "off",
"strings": "off"
}
},
"files.associations": {
"cmath": "c",
"*.tcc": "c",
"stdio.h": "c"
},
"clangd.arguments": [
"--query-driver=C:/Users/Mayuri/scoop/apps/msys2/current/mingw64/bin/clang.exe",
"--completion-style=detailed",
"--header-insertion=never",
"--clang-tidy",
],
"clangd.fallbackFlags": [
"-IC:/Users/Mayuri/scoop/apps/msys2/current/mingw64/include/"
],
"clangd.serverCompletionRanking": true,
"clang.executable": "C:/Users/Mayuri/scoop/apps/msys2/current/mingw64/bin/clang.exe",
"lldb.consoleMode": "evaluate", //调试控制台模式为终端命令模式,可调用lldb命令
"lldb.launch.sourceLanguages": [ //调试语言
"cpp",
"c"
],
"lldb.launch.expressions": "native", //使用原生表达式
"lldb.displayFormat": "auto",
"lldb.dereferencePointers": false,
"lldb.showDisassembly": "auto",
}
73 changes: 73 additions & 0 deletions Windows/.vscode-setting/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "process",
"label": "clangBuild_C",
"command": "C:/Users/Mayuri/scoop/apps/msys2/current/mingw64/bin/clang.exe",
"args": [
"-glldb",
"-std=c11",
// "${fileBasenameNoExtension}*",
"${fileBasenameNoExtension}.c",
"-o",
"${fileDirname}/build/${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": {
"owner": "lldb",
"fileLocation": [
"relative",
"${fileDirname}"
],
"pattern": [
{
"regexp": "^(ld.lld:.*)$",
"message": 1
},
{
"regexp": ">>> referenced by (.*):(\\d+)",
"file": 1,
"line": 2
}
]
},
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "process",
"label": "clangBuild_C++",
"command": "C:/Users/Mayuri/scoop/apps/msys2/current/mingw64/bin/clang++.exe",
"args": [
"-glldb",
"-std=c++11",
"${fileBasename}",
"-o",
"${fileDirname}/build/${fileBasenameNoExtension}.exe",
"-IC:/Users/Mayuri/scoop/apps/msys2/current/mingw64/include/"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": {
"owner": "lldb",
"fileLocation": [
"relative",
"${fileDirname}"
],
"pattern": {
"regexp": "^(.*\\.cpp):(\\d+):(\\d+): (.*)$",
"file": 1,
"line": 2,
"column": 3,
"message": 4
}
}
}
]
}
4 changes: 4 additions & 0 deletions Windows/.vscode-setting/compile_flags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-xc
-std=c11
-Wall
-IC:/Users/Mayuri/scoop/apps/msys2/current/mingw64/include

0 comments on commit 7d622c2

Please sign in to comment.