We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents cc6923f + 1e112e6 commit 57054f7Copy full SHA for 57054f7
Sources/SwiftFormatCore/SyntaxLintRule.swift
@@ -38,9 +38,17 @@ extension Rule {
38
on node: Syntax?,
39
actions: ((inout Diagnostic.Builder) -> Void)? = nil
40
) {
41
+ // TODO: node?.startLocation should be returning the position ignoring leading trivia. It isn't
42
+ // working properly, so we are using this workaround until it is fixed.
43
+ let loc = node.map {
44
+ SourceLocation(
45
+ file: context.fileURL.path,
46
+ position: $0.positionAfterSkippingLeadingTrivia
47
+ )
48
+ }
49
context.diagnosticEngine?.diagnose(
50
message.withRule(self),
- location: node?.startLocation(in: context.fileURL),
51
+ location: loc,
52
actions: actions
53
)
54
}
0 commit comments