Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions Sources/SourceKitLSP/ExperimentalFeatures.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,4 @@
public enum ExperimentalFeature: String, Codable, Sendable, CaseIterable {
/// Enable background indexing.
case backgroundIndexing = "background-indexing"

/// Show the files that are currently being indexed / the targets that are currently being prepared in the work done
/// progress.
///
/// This is an option because VS Code tries to render a multi-line work done progress into a single line text field in
/// the status bar, which looks broken. But at the same time, it is very useful to get a feeling about what's
/// currently happening indexing-wise.
case showActivePreparationTasksInProgress = "show-active-preparation-tasks-in-progress"
}
15 changes: 4 additions & 11 deletions Sources/SourceKitLSP/IndexProgressManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//
//===----------------------------------------------------------------------===//

import LSPLogging
import LanguageServerProtocol
import SKCore
import SKSupport
Expand Down Expand Up @@ -100,20 +101,12 @@ actor IndexProgressManager {
let finishedTasks = max(queuedIndexTasks - indexTasks.count, 0)
if indexTasks.isEmpty {
message = "Preparing targets"
if preparationTasks.isEmpty {
logger.fault("Indexer status is 'indexing' but there is no update indexstore or preparation task")
}
} else {
message = "\(finishedTasks) / \(queuedIndexTasks)"
}
if await sourceKitLSPServer.options.experimentalFeatures.contains(.showActivePreparationTasksInProgress) {
var inProgressTasks: [String] = []
inProgressTasks += preparationTasks.filter { $0.value == .executing }
.map { "- Preparing \($0.key.targetID)" }
.sorted()
inProgressTasks += indexTasks.filter { $0.value == .executing }
.map { "- Indexing \($0.key.fileURL?.lastPathComponent ?? $0.key.pseudoPath)" }
.sorted()

message += "\n\n" + inProgressTasks.joined(separator: "\n")
}
if queuedIndexTasks != 0 {
percentage = Int(Double(finishedTasks) / Double(queuedIndexTasks) * 100)
} else {
Expand Down