- 
                Notifications
    You must be signed in to change notification settings 
- Fork 320
Adopt swift-tools-protocols #2324
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
base: main
Are you sure you want to change the base?
Conversation
| I expect I'll need to iterate on this a bit. swiftlang/swift#84882 needs to land before it's testable in CI | 
cecc4f7    to
    c77d687      
    Compare
  
    | @swift-ci test | 
c77d687    to
    6de2320      
    Compare
  
    | @swift-ci test | 
| @swift-ci test Windows | 
6de2320    to
    31793f4      
    Compare
  
    | @swift-ci test | 
31793f4    to
    84b1416      
    Compare
  
    | @swift-ci test | 
| @swift-ci test Windows | 
40a68e0    to
    8f0f529      
    Compare
  
    8f0f529    to
    83337ec      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
High-level comment: I’d like to investigate if we can reduce the dependency on ToolsProtocolsSwiftExtensions further but that can be a follow-up investigation.
| } | ||
|  | ||
| extension BuildTargetIdentifier: CustomLogStringConvertible { | ||
| @_spi(SourceKitLSP) extension BuildTargetIdentifier: @retroactive CustomLogStringConvertible { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, should this conformance be in swift-tools-protocols? Seems like most people would need to add it. Though I’m not quite sure which module that conformance would live in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could put it in LanguageServerProtocolTransport although it's a bit of a stretch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In SourceKit-LSP, I’d put this in SKUtilities but I don’t think it’s worth adding a module in swift-tools-protocols just for this conformance. Let’s leave it for now and try to remember that if we should introduce such a module in swift-tools-protocols, we could move this conformance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, hit submit to early
| @@ -234,18 +234,20 @@ struct SourceKitLSP: AsyncParsableCommand { | |||
| fatalError("failed to redirect stdout -> stderr: \(strerror(errno)!)") | |||
| } | |||
|  | |||
| LoggingScope.configureDefaultLoggingSubsystem("org.swift.sourcekit-lsp") | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this is a little tricky. We’d need to do the same in at least one other places (part from test execution), namely when launching a SourceKitLSP server in-processes using InProcessClient
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added the missing configure call to InProcessClient
| @@ -82,6 +83,10 @@ private func createBuildServerManager( | |||
| } | |||
|  | |||
| final class BuildServerManagerTests: XCTestCase { | |||
| override func setUp() async throws { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really dislike having this setUp function in every single test case. Should we instead have a custom class that inherits from XCTestCase and that all our test cases inherit from?
Also, could we make LoggingScope.subsystem not fatalError if no default logging subsystem was set? Instead, maybe just use org.swift or default and log a fault that no logging subsystem has been set? There’s no need to crash the process just because no logging subsystem has been configured.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can get behind not crashing, swiftlang/swift-tools-protocols#16
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also introduced an XCTestCase subclass for XCTests, and a suite trait for Swift Testing Tests
83337ec    to
    7c4b22b      
    Compare
  
    7c4b22b    to
    9490f8a      
    Compare
  
    9490f8a    to
    d2e4b06      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple small comments, otherwise LGTM.
| import SKTestSupport | ||
| import SourceKitD | ||
| import SwiftExtensions | ||
| import TSCBasic | ||
| @_spi(SourceKitLSP) import ToolsProtocolsSwiftExtensions | ||
| import XCTest | ||
|  | ||
| final class SourceKitDRegistryTests: XCTestCase { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn’t this also be SourceKitLSPTestCase? Are there any other lingering XCTestCase subclasses?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed this instance. There are a few unit tests of data structures and things which I left subclasses of SKTestCase to avoid adding an SKTestSupport dependency where it wasn't needed
d2e4b06    to
    a7977d6      
    Compare
  
    
Adopt the new package and remove duplicated code