Skip to content

Remove a couple underscored properties/methods #1187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 19, 2024
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
24 changes: 7 additions & 17 deletions Sources/SKCore/BuildSystemManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ public actor BuildSystemManager {
let fallbackBuildSystem: FallbackBuildSystem?

/// Provider of file to main file mappings.
var _mainFilesProvider: MainFilesProvider?
var mainFilesProvider: MainFilesProvider?

/// Build system delegate that will receive notifications about setting changes, etc.
var _delegate: BuildSystemDelegate?
var delegate: BuildSystemDelegate?

/// The root of the project that this build system manages. For example, for SwiftPM packages, this is the folder
/// containing Package.swift. For compilation databases it is the root folder based on which the compilation database
Expand All @@ -71,7 +71,7 @@ public actor BuildSystemManager {
precondition(!buildSystemHasDelegate)
self.buildSystem = buildSystem
self.fallbackBuildSystem = fallbackBuildSystem
self._mainFilesProvider = mainFilesProvider
self.mainFilesProvider = mainFilesProvider
self.fallbackSettingsTimeout = fallbackSettingsTimeout
await self.buildSystem?.setDelegate(self)
}
Expand All @@ -82,21 +82,11 @@ public actor BuildSystemManager {
}

extension BuildSystemManager {
public var delegate: BuildSystemDelegate? {
get { _delegate }
set { _delegate = newValue }
}

/// - Note: Needed so we can set the delegate from a different isolation context.
public func setDelegate(_ delegate: BuildSystemDelegate?) {
self.delegate = delegate
}

public var mainFilesProvider: MainFilesProvider? {
get { _mainFilesProvider }
set { _mainFilesProvider = newValue }
}

/// - Note: Needed so we can set the delegate from a different isolation context.
public func setMainFilesProvider(_ mainFilesProvider: MainFilesProvider?) {
self.mainFilesProvider = mainFilesProvider
Expand Down Expand Up @@ -204,15 +194,15 @@ extension BuildSystemManager: BuildSystemDelegate {
public func fileBuildSettingsChanged(_ changedFiles: Set<DocumentURI>) async {
let changedWatchedFiles = watchedFilesReferencing(mainFiles: changedFiles)

if !changedWatchedFiles.isEmpty, let delegate = self._delegate {
if !changedWatchedFiles.isEmpty, let delegate = self.delegate {
await delegate.fileBuildSettingsChanged(changedWatchedFiles)
}
}

public func filesDependenciesUpdated(_ changedFiles: Set<DocumentURI>) async {
// Empty changes --> assume everything has changed.
guard !changedFiles.isEmpty else {
if let delegate = self._delegate {
if let delegate = self.delegate {
await delegate.filesDependenciesUpdated(changedFiles)
}
return
Expand All @@ -226,13 +216,13 @@ extension BuildSystemManager: BuildSystemDelegate {
}

public func buildTargetsChanged(_ changes: [BuildTargetEvent]) async {
if let delegate = self._delegate {
if let delegate = self.delegate {
await delegate.buildTargetsChanged(changes)
}
}

public func fileHandlingCapabilityChanged() async {
if let delegate = self._delegate {
if let delegate = self.delegate {
await delegate.fileHandlingCapabilityChanged()
}
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/SourceKitLSP/SourceKitIndexDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ public actor SourceKitIndexDelegate: IndexDelegate {
private func processCompleted(_ count: Int) {
pendingUnitCount -= count
if pendingUnitCount == 0 {
_indexChanged()
indexChanged()
}

if pendingUnitCount < 0 {
assertionFailure("pendingUnitCount = \(pendingUnitCount) < 0")
pendingUnitCount = 0
_indexChanged()
indexChanged()
}
}

func _indexChanged() {
private func indexChanged() {
for callback in mainFilesChangedCallbacks {
queue.async {
await callback()
Expand Down