Skip to content

Commit 0e0594b

Browse files
authored
Merge pull request #1399 from ahoppen/debug-subcommand
Move debug subcommands of sourcekit-lsp to a `debug` subcommand and unhide them
2 parents 175e85e + ef8b4f5 commit 0e0594b

File tree

8 files changed

+35
-12
lines changed

8 files changed

+35
-12
lines changed

Sources/Diagnose/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
add_library(Diagnose STATIC
22
CommandConfiguration+Sendable.swift
33
CommandLineArgumentsReducer.swift
4+
DebugCommand.swift
45
DiagnoseCommand.swift
56
IndexCommand.swift
67
MergeSwiftFiles.swift

Sources/Diagnose/DebugCommand.swift

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2024 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
import ArgumentParser
14+
15+
public struct DebugCommand: ParsableCommand {
16+
public static let configuration = CommandConfiguration(
17+
commandName: "debug",
18+
abstract: "Commands to debug sourcekit-lsp. Intended for developers of sourcekit-lsp",
19+
subcommands: [
20+
IndexCommand.self,
21+
ReduceCommand.self,
22+
ReduceFrontendCommand.self,
23+
RunSourceKitdRequestCommand.self,
24+
]
25+
)
26+
27+
public init() {}
28+
}

Sources/Diagnose/IndexCommand.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ private actor IndexLogMessageHandler: MessageHandler {
5555
public struct IndexCommand: AsyncParsableCommand {
5656
public static let configuration: CommandConfiguration = CommandConfiguration(
5757
commandName: "index",
58-
abstract: "Index a project and print all the processes executed for it as well as their outputs",
59-
shouldDisplay: false
58+
abstract: "Index a project and print all the processes executed for it as well as their outputs"
6059
)
6160

6261
@Option(

Sources/Diagnose/ReduceCommand.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ import class TSCUtility.PercentProgressAnimation
2222
public struct ReduceCommand: AsyncParsableCommand {
2323
public static let configuration: CommandConfiguration = CommandConfiguration(
2424
commandName: "reduce",
25-
abstract: "Reduce a single sourcekitd crash",
26-
shouldDisplay: false
25+
abstract: "Reduce a single sourcekitd crash"
2726
)
2827

2928
@Option(name: .customLong("request-file"), help: "Path to a sourcekitd request to reduce.")

Sources/Diagnose/ReduceFrontendCommand.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ import class TSCUtility.PercentProgressAnimation
2222
public struct ReduceFrontendCommand: AsyncParsableCommand {
2323
public static let configuration: CommandConfiguration = CommandConfiguration(
2424
commandName: "reduce-frontend",
25-
abstract: "Reduce a single swift-frontend crash",
26-
shouldDisplay: false
25+
abstract: "Reduce a single swift-frontend crash"
2726
)
2827

2928
#if canImport(Darwin)

Sources/Diagnose/RunSourcekitdRequestCommand.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ import struct TSCBasic.AbsolutePath
2121
public struct RunSourceKitdRequestCommand: AsyncParsableCommand {
2222
public static let configuration = CommandConfiguration(
2323
commandName: "run-sourcekitd-request",
24-
abstract: "Run a sourcekitd request and print its result",
25-
shouldDisplay: false
24+
abstract: "Run a sourcekitd request and print its result"
2625
)
2726

2827
@Option(

Sources/Diagnose/SourceKitDRequestExecutor.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ public class OutOfProcessSourceKitRequestExecutor: SourceKitRequestExecutor {
161161
let process = Process(
162162
arguments: [
163163
ProcessInfo.processInfo.arguments[0],
164+
"debug",
164165
"run-sourcekitd-request",
165166
"--sourcekitd",
166167
sourcekitd.path,

Sources/sourcekit-lsp/SourceKitLSP.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,7 @@ struct SourceKitLSP: AsyncParsableCommand {
105105
abstract: "Language Server Protocol implementation for Swift and C-based languages",
106106
subcommands: [
107107
DiagnoseCommand.self,
108-
IndexCommand.self,
109-
ReduceCommand.self,
110-
ReduceFrontendCommand.self,
111-
RunSourceKitdRequestCommand.self,
108+
DebugCommand.self,
112109
]
113110
)
114111

0 commit comments

Comments
 (0)