Skip to content

Commit ac3eb32

Browse files
committed
Format sources with swift-format
1 parent 9988930 commit ac3eb32

23 files changed

+161
-129
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ let package = Package(
199199
dependencies: [
200200
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),
201201
"LanguageServerProtocol",
202-
"LSPLogging"
202+
"LSPLogging",
203203
],
204204
exclude: ["CMakeLists.txt"]
205205
),

Sources/LSPLogging/NonDarwinLogging.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ public enum LogConfig {
1818
/// The globally set log level
1919
fileprivate static let logLevel: NonDarwinLogLevel = {
2020
if let envVar = ProcessInfo.processInfo.environment["SOURCEKITLSP_LOG_LEVEL"],
21-
let logLevel = NonDarwinLogLevel(envVar) {
21+
let logLevel = NonDarwinLogLevel(envVar)
22+
{
2223
return logLevel
2324
}
2425
#if DEBUG

Sources/LanguageServerProtocol/SupportTypes/WorkspaceSettings.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ public struct ClangWorkspaceSettings: Codable, Hashable {
5959

6060
var isValid: Bool {
6161
switch (compilationDatabasePath, compilationDatabaseChanges) {
62-
case (nil, .some), (.some, nil): return true
63-
default: return false
62+
case (nil, .some), (.some, nil): return true
63+
default: return false
6464
}
6565
}
6666
}

Sources/SKCore/CompilationDatabaseBuildSystem.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ public actor CompilationDatabaseBuildSystem {
7373
return nil
7474
}
7575

76-
public init?(projectRoot: AbsolutePath? = nil, searchPaths: [RelativePath], fileSystem: FileSystem = localFileSystem) {
76+
public init?(
77+
projectRoot: AbsolutePath? = nil,
78+
searchPaths: [RelativePath],
79+
fileSystem: FileSystem = localFileSystem
80+
) {
7781
self.fileSystem = fileSystem
7882
self.projectRoot = projectRoot
7983
self.searchPaths = searchPaths

Sources/SKCore/FileBuildSettings.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ public extension FileBuildSettings {
7878
arguments.insert("-xobjective-c++", at: 0)
7979
}
8080
}
81-
return FileBuildSettings(compilerArguments: arguments, workingDirectory: self.workingDirectory, isFallback: self.isFallback)
81+
return FileBuildSettings(
82+
compilerArguments: arguments,
83+
workingDirectory: self.workingDirectory,
84+
isFallback: self.isFallback
85+
)
8286
}
8387
}

Sources/SKSupport/AsyncUtils.swift

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,20 @@ public func withCancellableCheckedThrowingContinuation<Handle, Result>(
4848
}
4949
}
5050

51-
return try await withTaskCancellationHandler(operation: {
52-
try Task.checkCancellation()
53-
return try await withCheckedThrowingContinuation { continuation in
54-
handleWrapper.value = operation(continuation)
51+
return try await withTaskCancellationHandler(
52+
operation: {
53+
try Task.checkCancellation()
54+
return try await withCheckedThrowingContinuation { continuation in
55+
handleWrapper.value = operation(continuation)
5556

56-
// Check if the task was cancelled. This ensures we send a
57-
// CancelNotification even if the task gets cancelled after we register
58-
// the cancellation handler but before we set the `requestID`.
59-
if Task.isCancelled {
60-
callCancel()
57+
// Check if the task was cancelled. This ensures we send a
58+
// CancelNotification even if the task gets cancelled after we register
59+
// the cancellation handler but before we set the `requestID`.
60+
if Task.isCancelled {
61+
callCancel()
62+
}
6163
}
62-
}
63-
}, onCancel: callCancel)
64+
},
65+
onCancel: callCancel
66+
)
6467
}

Sources/SKTestSupport/IndexedSingleSwiftFileWorkspace.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public struct IndexedSingleSwiftFileWorkspace {
5757
var compilerArguments: [String] = [
5858
testFileURL.path,
5959
"-index-store-path", indexURL.path,
60-
"-typecheck"
60+
"-typecheck",
6161
]
6262
if !indexSystemModules {
6363
compilerArguments.append("-index-ignore-system-modules")

Sources/SKTestSupport/SwiftPMTestWorkspace.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public class SwiftPMTestWorkspace: MultiFileTestWorkspace {
7979
"-Xcc", "-index-ignore-system-symbols",
8080
]
8181
var environment = ProcessEnv.vars
82-
// FIXME: SwiftPM does not index-while-building on non-Darwin platforms for C-family files (rdar://117744039).
82+
// FIXME: SwiftPM does not index-while-building on non-Darwin platforms for C-family files (rdar://117744039).
8383
// Force-enable index-while-building with the environment variable.
8484
environment["SWIFTPM_ENABLE_CLANG_INDEX_STORE"] = "1"
8585
try await Process.checkNonZeroExit(arguments: arguments, environment: environment)

Sources/SourceKitD/sourcekitd_uids.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,12 @@ public struct sourcekitd_values {
345345
ref_function_accessor_didset = api.uid_get_from_cstr("source.lang.swift.ref.function.accessor.didset")!
346346
decl_function_accessor_address = api.uid_get_from_cstr("source.lang.swift.decl.function.accessor.address")!
347347
ref_function_accessor_address = api.uid_get_from_cstr("source.lang.swift.ref.function.accessor.address")!
348-
decl_function_accessor_mutableaddress = api.uid_get_from_cstr("source.lang.swift.decl.function.accessor.mutableaddress")!
349-
ref_function_accessor_mutableaddress = api.uid_get_from_cstr("source.lang.swift.ref.function.accessor.mutableaddress")!
348+
decl_function_accessor_mutableaddress = api.uid_get_from_cstr(
349+
"source.lang.swift.decl.function.accessor.mutableaddress"
350+
)!
351+
ref_function_accessor_mutableaddress = api.uid_get_from_cstr(
352+
"source.lang.swift.ref.function.accessor.mutableaddress"
353+
)!
350354
decl_function_accessor_read = api.uid_get_from_cstr("source.lang.swift.decl.function.accessor.read")!
351355
ref_function_accessor_read = api.uid_get_from_cstr("source.lang.swift.ref.function.accessor.read")!
352356
decl_function_accessor_modify = api.uid_get_from_cstr("source.lang.swift.decl.function.accessor.modify")!
@@ -412,7 +416,9 @@ public struct sourcekitd_values {
412416
syntaxtype_operator = api.uid_get_from_cstr("source.lang.swift.syntaxtype.operator")!
413417
syntaxtype_number = api.uid_get_from_cstr("source.lang.swift.syntaxtype.number")!
414418
syntaxtype_string = api.uid_get_from_cstr("source.lang.swift.syntaxtype.string")!
415-
syntaxtype_string_interpolation_anchor = api.uid_get_from_cstr("source.lang.swift.syntaxtype.string_interpolation_anchor")!
419+
syntaxtype_string_interpolation_anchor = api.uid_get_from_cstr(
420+
"source.lang.swift.syntaxtype.string_interpolation_anchor"
421+
)!
416422
syntaxtype_type_identifier = api.uid_get_from_cstr("source.lang.swift.syntaxtype.typeidentifier")!
417423
syntaxtype_identifier = api.uid_get_from_cstr("source.lang.swift.syntaxtype.identifier")!
418424
expr_object_literal = api.uid_get_from_cstr("source.lang.swift.expr.object_literal")!

Sources/SourceKitLSP/Clang/ClangLanguageServer.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ fileprivate class ClangdStderrLogForwarder {
4040
self.buffer += newData
4141
while let newlineIndex = self.buffer.firstIndex(of: UInt8(ascii: "\n")) {
4242
// Output a separate log message for every line in clangd's stderr.
43-
// The reason why we don't output multiple lines in a single log message is that
43+
// The reason why we don't output multiple lines in a single log message is that
4444
// a) os_log truncates log messages at about 1000 bytes. The assumption is that a single line is usually less
4545
// than 1000 bytes long but if we merge multiple lines into one message, we might easily exceed this limit.
46-
// b) It might be confusing why sometimes a single log message contains one line while sometimes it contains
46+
// b) It might be confusing why sometimes a single log message contains one line while sometimes it contains
4747
// multiple.
4848
let logger = Logger(subsystem: subsystem, category: "clangd-stderr")
4949
logger.info("\(String(data: self.buffer[...newlineIndex], encoding: .utf8) ?? "<invalid UTF-8>")")

0 commit comments

Comments
 (0)