Skip to content

Commit 2dc4291

Browse files
authored
Better VS Code compatibility (#272)
* enable swift-format * add vscode-related configs * temporarily update tests CI to the other PR's branch * run swift-format * Revert "temporarily update tests CI to the other PR's branch" This reverts commit 75e8138. * commit launch.json as well
1 parent 4f93883 commit 2dc4291

File tree

136 files changed

+3559
-2346
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+3559
-2346
lines changed

.github/workflows/test.yml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
with_tsan: false
1616
with_api_check: false
1717
with_deps_submission: true
18+
with_linting: true
1819

1920
cloudformation-lint:
2021
name: Check CloudFormation

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@ DerivedData/
1212
.vscode/launch.json
1313
.devcontainer
1414
Sources/DBMigration/Data
15-
.vscode/

.sourcekit-lsp/config.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"backgroundIndexing": true,
3+
"backgroundPreparationMode": "build",
4+
"maxCoresPercentageToUseForBackgroundIndexing": 0.7,
5+
"experimentalFeatures": ["on-type-formatting"]
6+
}

.swift-format

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"version": 1,
3+
"indentation": {
4+
"spaces": 4
5+
},
6+
"tabWidth": 4,
7+
"fileScopedDeclarationPrivacy": {
8+
"accessLevel": "private"
9+
},
10+
"spacesAroundRangeFormationOperators": false,
11+
"indentConditionalCompilationBlocks": false,
12+
"indentSwitchCaseLabels": false,
13+
"lineBreakAroundMultilineExpressionChainComponents": false,
14+
"lineBreakBeforeControlFlowKeywords": false,
15+
"lineBreakBeforeEachArgument": true,
16+
"lineBreakBeforeEachGenericRequirement": true,
17+
"lineLength": 120,
18+
"maximumBlankLines": 1,
19+
"respectsExistingLineBreaks": true,
20+
"prioritizeKeepingFunctionOutputTogether": true,
21+
"rules": {
22+
"AllPublicDeclarationsHaveDocumentation": false,
23+
"AlwaysUseLiteralForEmptyCollectionInit": false,
24+
"AlwaysUseLowerCamelCase": false,
25+
"AmbiguousTrailingClosureOverload": true,
26+
"BeginDocumentationCommentWithOneLineSummary": false,
27+
"DoNotUseSemicolons": true,
28+
"DontRepeatTypeInStaticProperties": true,
29+
"FileScopedDeclarationPrivacy": true,
30+
"FullyIndirectEnum": true,
31+
"GroupNumericLiterals": true,
32+
"IdentifiersMustBeASCII": true,
33+
"NeverForceUnwrap": false,
34+
"NeverUseForceTry": false,
35+
"NeverUseImplicitlyUnwrappedOptionals": false,
36+
"NoAccessLevelOnExtensionDeclaration": true,
37+
"NoAssignmentInExpressions": true,
38+
"NoBlockComments": true,
39+
"NoCasesWithOnlyFallthrough": true,
40+
"NoEmptyTrailingClosureParentheses": true,
41+
"NoLabelsInCasePatterns": true,
42+
"NoLeadingUnderscores": false,
43+
"NoParensAroundConditions": true,
44+
"NoVoidReturnOnFunctionSignature": true,
45+
"OmitExplicitReturns": true,
46+
"OneCasePerLine": true,
47+
"OneVariableDeclarationPerLine": true,
48+
"OnlyOneTrailingClosureArgument": true,
49+
"OrderedImports": true,
50+
"ReplaceForEachWithForLoop": true,
51+
"ReturnVoidInsteadOfEmptyTuple": true,
52+
"UseEarlyExits": false,
53+
"UseExplicitNilCheckInConditions": false,
54+
"UseLetInEveryBoundCaseVariable": false,
55+
"UseShorthandTypeNames": true,
56+
"UseSingleLinePropertyGetter": false,
57+
"UseSynthesizedInitializer": false,
58+
"UseTripleSlashForDocumentationComments": true,
59+
"UseWhereClausesInForLoops": false,
60+
"ValidateDocumentationComments": false
61+
}
62+
}

.swiftformatignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lambdas/GitHubAPI/GeneratedSources/

.vscode/extensions.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"recommendations": [
3+
"sswg.swift-lang",
4+
"foxundermoon.shell-format",
5+
"esbenp.prettier-vscode",
6+
"usernamehw.errorlens",
7+
"redhat.vscode-yaml",
8+
"francisco.html-leaf"
9+
]
10+
}

.vscode/launch.json

+170
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
{
2+
"configurations": [
3+
{
4+
"type": "lldb",
5+
"request": "launch",
6+
"sourceLanguages": ["swift"],
7+
"name": "Debug Penny",
8+
"program": "${workspaceFolder:penny-bot}/.build/debug/Penny",
9+
"args": [],
10+
"cwd": "${workspaceFolder:penny-bot}",
11+
"preLaunchTask": "swift: Build Debug Penny",
12+
"env": {
13+
"DEPLOYMENT_ENVIRONMENT": "local"
14+
}
15+
},
16+
{
17+
"type": "lldb",
18+
"request": "launch",
19+
"sourceLanguages": ["swift"],
20+
"name": "Release Penny",
21+
"program": "${workspaceFolder:penny-bot}/.build/release/Penny",
22+
"args": [],
23+
"cwd": "${workspaceFolder:penny-bot}",
24+
"preLaunchTask": "swift: Build Release Penny",
25+
"env": {
26+
"DEPLOYMENT_ENVIRONMENT": "local"
27+
}
28+
},
29+
{
30+
"type": "lldb",
31+
"request": "launch",
32+
"sourceLanguages": ["swift"],
33+
"name": "Debug UsersLambda",
34+
"program": "${workspaceFolder:penny-bot}/.build/debug/UsersLambda",
35+
"args": [],
36+
"cwd": "${workspaceFolder:penny-bot}",
37+
"preLaunchTask": "swift: Build Debug UsersLambda"
38+
},
39+
{
40+
"type": "lldb",
41+
"request": "launch",
42+
"sourceLanguages": ["swift"],
43+
"name": "Release UsersLambda",
44+
"program": "${workspaceFolder:penny-bot}/.build/release/UsersLambda",
45+
"args": [],
46+
"cwd": "${workspaceFolder:penny-bot}",
47+
"preLaunchTask": "swift: Build Release UsersLambda"
48+
},
49+
{
50+
"type": "lldb",
51+
"request": "launch",
52+
"sourceLanguages": ["swift"],
53+
"name": "Debug SponsorsLambda",
54+
"program": "${workspaceFolder:penny-bot}/.build/debug/SponsorsLambda",
55+
"args": [],
56+
"cwd": "${workspaceFolder:penny-bot}",
57+
"preLaunchTask": "swift: Build Debug SponsorsLambda"
58+
},
59+
{
60+
"type": "lldb",
61+
"request": "launch",
62+
"sourceLanguages": ["swift"],
63+
"name": "Release SponsorsLambda",
64+
"program": "${workspaceFolder:penny-bot}/.build/release/SponsorsLambda",
65+
"args": [],
66+
"cwd": "${workspaceFolder:penny-bot}",
67+
"preLaunchTask": "swift: Build Release SponsorsLambda"
68+
},
69+
{
70+
"type": "lldb",
71+
"request": "launch",
72+
"sourceLanguages": ["swift"],
73+
"name": "Debug GHOAuthLambda",
74+
"program": "${workspaceFolder:penny-bot}/.build/debug/GHOAuthLambda",
75+
"args": [],
76+
"cwd": "${workspaceFolder:penny-bot}",
77+
"preLaunchTask": "swift: Build Debug GHOAuthLambda"
78+
},
79+
{
80+
"type": "lldb",
81+
"request": "launch",
82+
"sourceLanguages": ["swift"],
83+
"name": "Release GHOAuthLambda",
84+
"program": "${workspaceFolder:penny-bot}/.build/release/GHOAuthLambda",
85+
"args": [],
86+
"cwd": "${workspaceFolder:penny-bot}",
87+
"preLaunchTask": "swift: Build Release GHOAuthLambda"
88+
},
89+
{
90+
"type": "lldb",
91+
"request": "launch",
92+
"sourceLanguages": ["swift"],
93+
"name": "Debug GHHooksLambda",
94+
"program": "${workspaceFolder:penny-bot}/.build/debug/GHHooksLambda",
95+
"args": [],
96+
"cwd": "${workspaceFolder:penny-bot}",
97+
"preLaunchTask": "swift: Build Debug GHHooksLambda"
98+
},
99+
{
100+
"type": "lldb",
101+
"request": "launch",
102+
"sourceLanguages": ["swift"],
103+
"name": "Release GHHooksLambda",
104+
"program": "${workspaceFolder:penny-bot}/.build/release/GHHooksLambda",
105+
"args": [],
106+
"cwd": "${workspaceFolder:penny-bot}",
107+
"preLaunchTask": "swift: Build Release GHHooksLambda"
108+
},
109+
{
110+
"type": "lldb",
111+
"request": "launch",
112+
"sourceLanguages": ["swift"],
113+
"name": "Debug FaqsLambda",
114+
"program": "${workspaceFolder:penny-bot}/.build/debug/FaqsLambda",
115+
"args": [],
116+
"cwd": "${workspaceFolder:penny-bot}",
117+
"preLaunchTask": "swift: Build Debug FaqsLambda"
118+
},
119+
{
120+
"type": "lldb",
121+
"request": "launch",
122+
"sourceLanguages": ["swift"],
123+
"name": "Release FaqsLambda",
124+
"program": "${workspaceFolder:penny-bot}/.build/release/FaqsLambda",
125+
"args": [],
126+
"cwd": "${workspaceFolder:penny-bot}",
127+
"preLaunchTask": "swift: Build Release FaqsLambda"
128+
},
129+
{
130+
"type": "lldb",
131+
"request": "launch",
132+
"sourceLanguages": ["swift"],
133+
"name": "Debug AutoPingsLambda",
134+
"program": "${workspaceFolder:penny-bot}/.build/debug/AutoPingsLambda",
135+
"args": [],
136+
"cwd": "${workspaceFolder:penny-bot}",
137+
"preLaunchTask": "swift: Build Debug AutoPingsLambda"
138+
},
139+
{
140+
"type": "lldb",
141+
"request": "launch",
142+
"sourceLanguages": ["swift"],
143+
"name": "Release AutoPingsLambda",
144+
"program": "${workspaceFolder:penny-bot}/.build/release/AutoPingsLambda",
145+
"args": [],
146+
"cwd": "${workspaceFolder:penny-bot}",
147+
"preLaunchTask": "swift: Build Release AutoPingsLambda"
148+
},
149+
{
150+
"type": "lldb",
151+
"request": "launch",
152+
"sourceLanguages": ["swift"],
153+
"name": "Debug AutoFaqsLambda",
154+
"program": "${workspaceFolder:penny-bot}/.build/debug/AutoFaqsLambda",
155+
"args": [],
156+
"cwd": "${workspaceFolder:penny-bot}",
157+
"preLaunchTask": "swift: Build Debug AutoFaqsLambda"
158+
},
159+
{
160+
"type": "lldb",
161+
"request": "launch",
162+
"sourceLanguages": ["swift"],
163+
"name": "Release AutoFaqsLambda",
164+
"program": "${workspaceFolder:penny-bot}/.build/release/AutoFaqsLambda",
165+
"args": [],
166+
"cwd": "${workspaceFolder:penny-bot}",
167+
"preLaunchTask": "swift: Build Release AutoFaqsLambda"
168+
}
169+
]
170+
}

.vscode/settings.json

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
"files.autoSave": "afterDelay",
3+
"debug.onTaskErrors": "abort",
4+
"git.openRepositoryInParentFolders": "always",
5+
"editor.unicodeHighlight.nonBasicASCII": false,
6+
"files.associations": {
7+
"*.swift": "swift"
8+
},
9+
"workbench.editor.enablePreview": false,
10+
"swift.sourcekit-lsp.trace.server": "messages",
11+
"markdown.validate.enabled": true,
12+
"diffEditor.codeLens": true,
13+
"editor.stickyScroll.enabled": true,
14+
"editor.stickyScroll.maxLineCount": 8,
15+
"json.maxItemsComputed": 1000000,
16+
"editor.foldingMaximumRegions": 65000,
17+
"git.confirmSync": false,
18+
"cSpell.ignorePaths": [
19+
"vscode-extension",
20+
".git/objects",
21+
".vscode",
22+
".vscode-insiders",
23+
".build",
24+
".*-build",
25+
".swiftpm"
26+
],
27+
"yaml.maxItemsComputed": 1000000,
28+
"yaml.format.enable": true,
29+
"editor.rulers": [120],
30+
"editor.minimap.enabled": false,
31+
"editor.wordWrapColumn": 100,
32+
"githubPullRequests.pullBranch": "never",
33+
"errorLens.statusBarColorsEnabled": true,
34+
"errorLens.statusBarIconsEnabled": true,
35+
"errorLens.scrollbarHackEnabled": true,
36+
"errorLens.delayMode": "debounce",
37+
"errorLens.delay": 500,
38+
"errorLens.editorHoverPartsEnabled": {
39+
"messageEnabled": true,
40+
"sourceCodeEnabled": true,
41+
"buttonsEnabled": true
42+
},
43+
"editor.unicodeHighlight.invisibleCharacters": false,
44+
"editor.unicodeHighlight.ambiguousCharacters": false,
45+
"editor.largeFileOptimizations": false,
46+
"editor.defaultFormatter": "esbenp.prettier-vscode",
47+
"files.insertFinalNewline": true,
48+
"editor.indentSize": "tabSize",
49+
"editor.formatOnSave": true,
50+
"editor.formatOnPaste": true,
51+
"editor.formatOnType": true,
52+
"[swift]": {
53+
"editor.defaultFormatter": "sswg.swift-lang",
54+
"editor.detectIndentation": false,
55+
"editor.tabSize": 4,
56+
"editor.insertSpaces": true
57+
},
58+
"terminal.integrated.scrollback": 10000,
59+
"swift.buildArguments": ["--force-resolved-versions"],
60+
"swift.additionalTestArguments": ["--disable-xctest"],
61+
"[yaml]": {
62+
"editor.insertSpaces": true,
63+
"editor.tabSize": 2,
64+
"editor.defaultFormatter": "redhat.vscode-yaml"
65+
},
66+
"[shellscript]": {
67+
"editor.defaultFormatter": "foxundermoon.shell-format"
68+
},
69+
"[dotenv]": {
70+
"editor.defaultFormatter": null
71+
},
72+
"[ignore]": {
73+
"editor.defaultFormatter": null
74+
},
75+
"[dockerfile]": {
76+
"editor.defaultFormatter": null
77+
},
78+
"[properties]": {
79+
"editor.defaultFormatter": null
80+
}
81+
}

Lambdas/AutoFaqs/AutoFaqsHandler.swift

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
import AWSLambdaRuntime
21
import AWSLambdaEvents
2+
import AWSLambdaRuntime
33
import AsyncHTTPClient
4+
import LambdasShared
5+
import Models
6+
import Shared
7+
import SotoCore
8+
49
#if canImport(FoundationEssentials)
510
import FoundationEssentials
611
#else
712
import Foundation
813
#endif
9-
import SotoCore
10-
import Models
11-
import Shared
12-
import LambdasShared
1314

1415
@main
1516
struct AutoFaqsHandler: LambdaHandler {

0 commit comments

Comments
 (0)