diff --git a/Sources/swift-format/Frontend/Frontend.swift b/Sources/swift-format/Frontend/Frontend.swift index 247d682d3..307335883 100644 --- a/Sources/swift-format/Frontend/Frontend.swift +++ b/Sources/swift-format/Frontend/Frontend.swift @@ -117,9 +117,11 @@ class Frontend { /// Processes source content from standard input. private func processStandardInput() { + let assumedUrl = lintFormatOptions.assumeFilename.map(URL.init(fileURLWithPath:)) + guard let configuration = configuration( fromPathOrString: lintFormatOptions.configuration, - orInferredFromSwiftFileAt: nil) + orInferredFromSwiftFileAt: assumedUrl) else { // Already diagnosed in the called method. return @@ -127,7 +129,7 @@ class Frontend { let fileToProcess = FileToProcess( fileHandle: FileHandle.standardInput, - url: URL(fileURLWithPath: lintFormatOptions.assumeFilename ?? ""), + url: assumedUrl ?? URL(fileURLWithPath: ""), configuration: configuration, selection: Selection(offsetRanges: lintFormatOptions.offsets)) processFile(fileToProcess)