Skip to content

Move debug subcommands of sourcekit-lsp to a debug subcommand and unhide them #1399

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
Jun 2, 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
1 change: 1 addition & 0 deletions Sources/Diagnose/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
add_library(Diagnose STATIC
CommandConfiguration+Sendable.swift
CommandLineArgumentsReducer.swift
DebugCommand.swift
DiagnoseCommand.swift
IndexCommand.swift
MergeSwiftFiles.swift
Expand Down
28 changes: 28 additions & 0 deletions Sources/Diagnose/DebugCommand.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2024 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 ArgumentParser

public struct DebugCommand: ParsableCommand {
public static let configuration = CommandConfiguration(
commandName: "debug",
abstract: "Commands to debug sourcekit-lsp. Intended for developers of sourcekit-lsp",
subcommands: [
IndexCommand.self,
ReduceCommand.self,
ReduceFrontendCommand.self,
RunSourceKitdRequestCommand.self,
]
)

public init() {}
}
3 changes: 1 addition & 2 deletions Sources/Diagnose/IndexCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ private actor IndexLogMessageHandler: MessageHandler {
public struct IndexCommand: AsyncParsableCommand {
public static let configuration: CommandConfiguration = CommandConfiguration(
commandName: "index",
abstract: "Index a project and print all the processes executed for it as well as their outputs",
shouldDisplay: false
abstract: "Index a project and print all the processes executed for it as well as their outputs"
)

@Option(
Expand Down
3 changes: 1 addition & 2 deletions Sources/Diagnose/ReduceCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ import class TSCUtility.PercentProgressAnimation
public struct ReduceCommand: AsyncParsableCommand {
public static let configuration: CommandConfiguration = CommandConfiguration(
commandName: "reduce",
abstract: "Reduce a single sourcekitd crash",
shouldDisplay: false
abstract: "Reduce a single sourcekitd crash"
)

@Option(name: .customLong("request-file"), help: "Path to a sourcekitd request to reduce.")
Expand Down
3 changes: 1 addition & 2 deletions Sources/Diagnose/ReduceFrontendCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ import class TSCUtility.PercentProgressAnimation
public struct ReduceFrontendCommand: AsyncParsableCommand {
public static let configuration: CommandConfiguration = CommandConfiguration(
commandName: "reduce-frontend",
abstract: "Reduce a single swift-frontend crash",
shouldDisplay: false
abstract: "Reduce a single swift-frontend crash"
)

#if canImport(Darwin)
Expand Down
3 changes: 1 addition & 2 deletions Sources/Diagnose/RunSourcekitdRequestCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ import struct TSCBasic.AbsolutePath
public struct RunSourceKitdRequestCommand: AsyncParsableCommand {
public static let configuration = CommandConfiguration(
commandName: "run-sourcekitd-request",
abstract: "Run a sourcekitd request and print its result",
shouldDisplay: false
abstract: "Run a sourcekitd request and print its result"
)

@Option(
Expand Down
1 change: 1 addition & 0 deletions Sources/Diagnose/SourceKitDRequestExecutor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public class OutOfProcessSourceKitRequestExecutor: SourceKitRequestExecutor {
let process = Process(
arguments: [
ProcessInfo.processInfo.arguments[0],
"debug",
"run-sourcekitd-request",
"--sourcekitd",
sourcekitd.path,
Expand Down
5 changes: 1 addition & 4 deletions Sources/sourcekit-lsp/SourceKitLSP.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,7 @@ struct SourceKitLSP: AsyncParsableCommand {
abstract: "Language Server Protocol implementation for Swift and C-based languages",
subcommands: [
DiagnoseCommand.self,
IndexCommand.self,
ReduceCommand.self,
ReduceFrontendCommand.self,
RunSourceKitdRequestCommand.self,
DebugCommand.self,
]
)

Expand Down