Skip to content

Commit

Permalink
Better VS Code compatibility (#272)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
MahdiBM authored Dec 14, 2024
1 parent 4f93883 commit 2dc4291
Show file tree
Hide file tree
Showing 136 changed files with 3,559 additions and 2,346 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
with_tsan: false
with_api_check: false
with_deps_submission: true
with_linting: true

cloudformation-lint:
name: Check CloudFormation
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ DerivedData/
.vscode/launch.json
.devcontainer
Sources/DBMigration/Data
.vscode/
6 changes: 6 additions & 0 deletions .sourcekit-lsp/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"backgroundIndexing": true,
"backgroundPreparationMode": "build",
"maxCoresPercentageToUseForBackgroundIndexing": 0.7,
"experimentalFeatures": ["on-type-formatting"]
}
62 changes: 62 additions & 0 deletions .swift-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"version": 1,
"indentation": {
"spaces": 4
},
"tabWidth": 4,
"fileScopedDeclarationPrivacy": {
"accessLevel": "private"
},
"spacesAroundRangeFormationOperators": false,
"indentConditionalCompilationBlocks": false,
"indentSwitchCaseLabels": false,
"lineBreakAroundMultilineExpressionChainComponents": false,
"lineBreakBeforeControlFlowKeywords": false,
"lineBreakBeforeEachArgument": true,
"lineBreakBeforeEachGenericRequirement": true,
"lineLength": 120,
"maximumBlankLines": 1,
"respectsExistingLineBreaks": true,
"prioritizeKeepingFunctionOutputTogether": true,
"rules": {
"AllPublicDeclarationsHaveDocumentation": false,
"AlwaysUseLiteralForEmptyCollectionInit": false,
"AlwaysUseLowerCamelCase": false,
"AmbiguousTrailingClosureOverload": true,
"BeginDocumentationCommentWithOneLineSummary": false,
"DoNotUseSemicolons": true,
"DontRepeatTypeInStaticProperties": true,
"FileScopedDeclarationPrivacy": true,
"FullyIndirectEnum": true,
"GroupNumericLiterals": true,
"IdentifiersMustBeASCII": true,
"NeverForceUnwrap": false,
"NeverUseForceTry": false,
"NeverUseImplicitlyUnwrappedOptionals": false,
"NoAccessLevelOnExtensionDeclaration": true,
"NoAssignmentInExpressions": true,
"NoBlockComments": true,
"NoCasesWithOnlyFallthrough": true,
"NoEmptyTrailingClosureParentheses": true,
"NoLabelsInCasePatterns": true,
"NoLeadingUnderscores": false,
"NoParensAroundConditions": true,
"NoVoidReturnOnFunctionSignature": true,
"OmitExplicitReturns": true,
"OneCasePerLine": true,
"OneVariableDeclarationPerLine": true,
"OnlyOneTrailingClosureArgument": true,
"OrderedImports": true,
"ReplaceForEachWithForLoop": true,
"ReturnVoidInsteadOfEmptyTuple": true,
"UseEarlyExits": false,
"UseExplicitNilCheckInConditions": false,
"UseLetInEveryBoundCaseVariable": false,
"UseShorthandTypeNames": true,
"UseSingleLinePropertyGetter": false,
"UseSynthesizedInitializer": false,
"UseTripleSlashForDocumentationComments": true,
"UseWhereClausesInForLoops": false,
"ValidateDocumentationComments": false
}
}
1 change: 1 addition & 0 deletions .swiftformatignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Lambdas/GitHubAPI/GeneratedSources/
10 changes: 10 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"recommendations": [
"sswg.swift-lang",
"foxundermoon.shell-format",
"esbenp.prettier-vscode",
"usernamehw.errorlens",
"redhat.vscode-yaml",
"francisco.html-leaf"
]
}
170 changes: 170 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
{
"configurations": [
{
"type": "lldb",
"request": "launch",
"sourceLanguages": ["swift"],
"name": "Debug Penny",
"program": "${workspaceFolder:penny-bot}/.build/debug/Penny",
"args": [],
"cwd": "${workspaceFolder:penny-bot}",
"preLaunchTask": "swift: Build Debug Penny",
"env": {
"DEPLOYMENT_ENVIRONMENT": "local"
}
},
{
"type": "lldb",
"request": "launch",
"sourceLanguages": ["swift"],
"name": "Release Penny",
"program": "${workspaceFolder:penny-bot}/.build/release/Penny",
"args": [],
"cwd": "${workspaceFolder:penny-bot}",
"preLaunchTask": "swift: Build Release Penny",
"env": {
"DEPLOYMENT_ENVIRONMENT": "local"
}
},
{
"type": "lldb",
"request": "launch",
"sourceLanguages": ["swift"],
"name": "Debug UsersLambda",
"program": "${workspaceFolder:penny-bot}/.build/debug/UsersLambda",
"args": [],
"cwd": "${workspaceFolder:penny-bot}",
"preLaunchTask": "swift: Build Debug UsersLambda"
},
{
"type": "lldb",
"request": "launch",
"sourceLanguages": ["swift"],
"name": "Release UsersLambda",
"program": "${workspaceFolder:penny-bot}/.build/release/UsersLambda",
"args": [],
"cwd": "${workspaceFolder:penny-bot}",
"preLaunchTask": "swift: Build Release UsersLambda"
},
{
"type": "lldb",
"request": "launch",
"sourceLanguages": ["swift"],
"name": "Debug SponsorsLambda",
"program": "${workspaceFolder:penny-bot}/.build/debug/SponsorsLambda",
"args": [],
"cwd": "${workspaceFolder:penny-bot}",
"preLaunchTask": "swift: Build Debug SponsorsLambda"
},
{
"type": "lldb",
"request": "launch",
"sourceLanguages": ["swift"],
"name": "Release SponsorsLambda",
"program": "${workspaceFolder:penny-bot}/.build/release/SponsorsLambda",
"args": [],
"cwd": "${workspaceFolder:penny-bot}",
"preLaunchTask": "swift: Build Release SponsorsLambda"
},
{
"type": "lldb",
"request": "launch",
"sourceLanguages": ["swift"],
"name": "Debug GHOAuthLambda",
"program": "${workspaceFolder:penny-bot}/.build/debug/GHOAuthLambda",
"args": [],
"cwd": "${workspaceFolder:penny-bot}",
"preLaunchTask": "swift: Build Debug GHOAuthLambda"
},
{
"type": "lldb",
"request": "launch",
"sourceLanguages": ["swift"],
"name": "Release GHOAuthLambda",
"program": "${workspaceFolder:penny-bot}/.build/release/GHOAuthLambda",
"args": [],
"cwd": "${workspaceFolder:penny-bot}",
"preLaunchTask": "swift: Build Release GHOAuthLambda"
},
{
"type": "lldb",
"request": "launch",
"sourceLanguages": ["swift"],
"name": "Debug GHHooksLambda",
"program": "${workspaceFolder:penny-bot}/.build/debug/GHHooksLambda",
"args": [],
"cwd": "${workspaceFolder:penny-bot}",
"preLaunchTask": "swift: Build Debug GHHooksLambda"
},
{
"type": "lldb",
"request": "launch",
"sourceLanguages": ["swift"],
"name": "Release GHHooksLambda",
"program": "${workspaceFolder:penny-bot}/.build/release/GHHooksLambda",
"args": [],
"cwd": "${workspaceFolder:penny-bot}",
"preLaunchTask": "swift: Build Release GHHooksLambda"
},
{
"type": "lldb",
"request": "launch",
"sourceLanguages": ["swift"],
"name": "Debug FaqsLambda",
"program": "${workspaceFolder:penny-bot}/.build/debug/FaqsLambda",
"args": [],
"cwd": "${workspaceFolder:penny-bot}",
"preLaunchTask": "swift: Build Debug FaqsLambda"
},
{
"type": "lldb",
"request": "launch",
"sourceLanguages": ["swift"],
"name": "Release FaqsLambda",
"program": "${workspaceFolder:penny-bot}/.build/release/FaqsLambda",
"args": [],
"cwd": "${workspaceFolder:penny-bot}",
"preLaunchTask": "swift: Build Release FaqsLambda"
},
{
"type": "lldb",
"request": "launch",
"sourceLanguages": ["swift"],
"name": "Debug AutoPingsLambda",
"program": "${workspaceFolder:penny-bot}/.build/debug/AutoPingsLambda",
"args": [],
"cwd": "${workspaceFolder:penny-bot}",
"preLaunchTask": "swift: Build Debug AutoPingsLambda"
},
{
"type": "lldb",
"request": "launch",
"sourceLanguages": ["swift"],
"name": "Release AutoPingsLambda",
"program": "${workspaceFolder:penny-bot}/.build/release/AutoPingsLambda",
"args": [],
"cwd": "${workspaceFolder:penny-bot}",
"preLaunchTask": "swift: Build Release AutoPingsLambda"
},
{
"type": "lldb",
"request": "launch",
"sourceLanguages": ["swift"],
"name": "Debug AutoFaqsLambda",
"program": "${workspaceFolder:penny-bot}/.build/debug/AutoFaqsLambda",
"args": [],
"cwd": "${workspaceFolder:penny-bot}",
"preLaunchTask": "swift: Build Debug AutoFaqsLambda"
},
{
"type": "lldb",
"request": "launch",
"sourceLanguages": ["swift"],
"name": "Release AutoFaqsLambda",
"program": "${workspaceFolder:penny-bot}/.build/release/AutoFaqsLambda",
"args": [],
"cwd": "${workspaceFolder:penny-bot}",
"preLaunchTask": "swift: Build Release AutoFaqsLambda"
}
]
}
81 changes: 81 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"files.autoSave": "afterDelay",
"debug.onTaskErrors": "abort",
"git.openRepositoryInParentFolders": "always",
"editor.unicodeHighlight.nonBasicASCII": false,
"files.associations": {
"*.swift": "swift"
},
"workbench.editor.enablePreview": false,
"swift.sourcekit-lsp.trace.server": "messages",
"markdown.validate.enabled": true,
"diffEditor.codeLens": true,
"editor.stickyScroll.enabled": true,
"editor.stickyScroll.maxLineCount": 8,
"json.maxItemsComputed": 1000000,
"editor.foldingMaximumRegions": 65000,
"git.confirmSync": false,
"cSpell.ignorePaths": [
"vscode-extension",
".git/objects",
".vscode",
".vscode-insiders",
".build",
".*-build",
".swiftpm"
],
"yaml.maxItemsComputed": 1000000,
"yaml.format.enable": true,
"editor.rulers": [120],
"editor.minimap.enabled": false,
"editor.wordWrapColumn": 100,
"githubPullRequests.pullBranch": "never",
"errorLens.statusBarColorsEnabled": true,
"errorLens.statusBarIconsEnabled": true,
"errorLens.scrollbarHackEnabled": true,
"errorLens.delayMode": "debounce",
"errorLens.delay": 500,
"errorLens.editorHoverPartsEnabled": {
"messageEnabled": true,
"sourceCodeEnabled": true,
"buttonsEnabled": true
},
"editor.unicodeHighlight.invisibleCharacters": false,
"editor.unicodeHighlight.ambiguousCharacters": false,
"editor.largeFileOptimizations": false,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"files.insertFinalNewline": true,
"editor.indentSize": "tabSize",
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.formatOnType": true,
"[swift]": {
"editor.defaultFormatter": "sswg.swift-lang",
"editor.detectIndentation": false,
"editor.tabSize": 4,
"editor.insertSpaces": true
},
"terminal.integrated.scrollback": 10000,
"swift.buildArguments": ["--force-resolved-versions"],
"swift.additionalTestArguments": ["--disable-xctest"],
"[yaml]": {
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.defaultFormatter": "redhat.vscode-yaml"
},
"[shellscript]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
},
"[dotenv]": {
"editor.defaultFormatter": null
},
"[ignore]": {
"editor.defaultFormatter": null
},
"[dockerfile]": {
"editor.defaultFormatter": null
},
"[properties]": {
"editor.defaultFormatter": null
}
}
11 changes: 6 additions & 5 deletions Lambdas/AutoFaqs/AutoFaqsHandler.swift
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import AWSLambdaRuntime
import AWSLambdaEvents
import AWSLambdaRuntime
import AsyncHTTPClient
import LambdasShared
import Models
import Shared
import SotoCore

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
import SotoCore
import Models
import Shared
import LambdasShared

@main
struct AutoFaqsHandler: LambdaHandler {
Expand Down
Loading

0 comments on commit 2dc4291

Please sign in to comment.