Files
sourcekit-lsp/Sources/InProcessClient/LanguageServiceRegistry+staticallyKnownServices.swift
Alex Hoppen 22fae21153 Handle documentation requests for Swift files in DocumentationLanguageService
This cleanly separates the responsibilities for handling documentation from those of handling Swift files. It also simplifies providing docc support for clang because we just need to implement the two `symbolGraph` methods in `ClangLanguageService` and can re-use the remaining infrastructure from `DoccLanguageService`.
2025-08-20 00:20:27 +02:00

34 lines
1.2 KiB
Swift

//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
import ClangLanguageService
import LanguageServerProtocol
package import SourceKitLSP
import SwiftLanguageService
#if canImport(DocumentationLanguageService)
import DocumentationLanguageService
#endif
extension LanguageServiceRegistry {
/// All types conforming to `LanguageService` that are known at compile time.
package static let staticallyKnownServices = {
var registry = LanguageServiceRegistry()
registry.register(ClangLanguageService.self, for: [.c, .cpp, .objective_c, .objective_cpp])
registry.register(SwiftLanguageService.self, for: [.swift])
#if canImport(DocumentationLanguageService)
registry.register(DocumentationLanguageService.self, for: [.markdown, .tutorial, .swift])
#endif
return registry
}()
}