Skip to content

Commit c375dc5

Browse files
committed
fix sort and map execute order
1 parent 8ecd8f6 commit c375dc5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/SourceKitLSP/Workspace.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ package final class Workspace: Sendable, BuildSystemManagerDelegate {
306306
indexDelegate = SourceKitIndexDelegate()
307307
let prefixMappings =
308308
(indexOptions.indexPrefixMap ?? [:])
309+
.map { PathMapping(original: $0.key, replacement: $0.value) }
309310
.sorted {
310311
// Fixes an issue where remapPath might match the shortest path first when multiple common prefixes exist
311312
// Sort by path length descending to prioritize more specific paths;
@@ -316,7 +317,6 @@ package final class Workspace: Sendable, BuildSystemManagerDelegate {
316317
return $0.original < $1.original // Alphabetical sort when lengths are equal, ensures stable ordering
317318
}
318319
}
319-
.map { PathMapping(original: $0.key, replacement: $0.value) }
320320
if let indexInjector = hooks.indexHooks.indexInjector {
321321
let indexStoreDB = try await indexInjector.createIndex(
322322
storePath: indexStorePath,

0 commit comments

Comments
 (0)