-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Language server installation menu #1997
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
CodeEdit/Features/LSP/Registry/PackageManagers/CargoPackageManager.swift
Show resolved
Hide resolved
Will need to fix lint errors, but besides that it is ready for review. |
Fix those SwiftLint errors plz 😬 |
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’ve reviewed the Installation Queue and Package Managers so far. This PR is definitely too large for a single review, so I’ll go through the rest later. In the meantime, could you update your PR description as well?
CodeEdit/Features/LSP/Registry/PackageManagers/CargoPackageManager.swift
Outdated
Show resolved
Hide resolved
CodeEdit/Features/LSP/Registry/PackageManagers/CargoPackageManager.swift
Outdated
Show resolved
Hide resolved
CodeEdit/Features/LSP/Registry/PackageManagers/GithubPackageManager.swift
Outdated
Show resolved
Hide resolved
CodeEdit/Features/LSP/Registry/PackageManagers/GithubPackageManager.swift
Outdated
Show resolved
Hide resolved
CodeEdit/Features/LSP/Registry/PackageManagers/GolangPackageManager.swift
Outdated
Show resolved
Hide resolved
CodeEdit/Features/LSP/Registry/PackageManagers/NPMPackageManager.swift
Outdated
Show resolved
Hide resolved
CodeEdit/Features/LSP/Registry/PackageManagers/PipPackageManager.swift
Outdated
Show resolved
Hide resolved
CodeEdit/Features/LSP/Registry/PackageManagers/PipPackageManager.swift
Outdated
Show resolved
Hide resolved
CodeEdit/Features/LSP/Registry/PackageManagers/PipPackageManager.swift
Outdated
Show resolved
Hide resolved
CodeEdit/Features/LSP/Registry/PackageManagers/PipPackageManager.swift
Outdated
Show resolved
Hide resolved
|
||
extension PackageManagerProtocol { | ||
/// Creates the directory for the language server to be installed in | ||
internal func createDirectoryStructure(for packagePath: URL) 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.
internal func createDirectoryStructure(for packagePath: URL) throws { | |
func createDirectoryStructure(for packagePath: URL) throws { |
Internal is redundant
} | ||
|
||
/// Executes commands in the specified directory | ||
internal func executeInDirectory(in packagePath: String, _ args: [String]) async throws -> [String] { |
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.
internal func executeInDirectory(in packagePath: String, _ args: [String]) async throws -> [String] { | |
func executeInDirectory(in packagePath: String, _ args: [String]) async throws -> [String] { |
} | ||
|
||
/// Runs a shell command and returns output | ||
internal func runCommand(_ command: String) async throws -> [String] { |
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.
internal func runCommand(_ command: String) async throws -> [String] { | |
func runCommand(_ command: String) async throws -> [String] { |
} | ||
} | ||
|
||
enum PackageManagerError: Error { |
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.
All these enums should have their own file
} | ||
|
||
private func downloadBinary(_ source: PackageSource, _ url: URL) async throws { | ||
_ = try await URLSession.shared.data(from: url) |
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.
Is this not just throwing away the downloaded data? I think this should be saved to a file here
fail failed: Bool | ||
) { | ||
if failed { | ||
NotificationCenter.default.post( |
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 feel like this should be a notification instead of an activity view item. cc @austincondiff, you might have a stronger opinion on those semantics.
case .invalidResponse(let statusCode): | ||
print("Invalid response received: \(statusCode)") | ||
case let .downloadFailed(url, error): | ||
print("Download failed for \(url.absoluteString): \(error.localizedDescription)") | ||
case let .maxRetriesExceeded(url, error): | ||
print("Max retries exceeded for \(url.absoluteString): \(error.localizedDescription)") | ||
case let .writeFailed(error): | ||
print("Failed to write files to disk: \(error.localizedDescription)") |
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'd prefer error messages be in the localizedError
variable on the error, rather than in a method somewhere detached from the error type. That would simplify this method as well.
Also, lets use a Logger
here and elsewhere for logging errors and status. That'll make these logs easier to track down and we can attach severity to them.
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.
All the uses of internal
here are redundant. Methods and variables are internal
by default.
@@ -11,6 +11,7 @@ import Foundation | |||
import LanguageClient | |||
import LanguageServerProtocol | |||
import CodeEditLanguages | |||
import SwiftUICore |
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.
import SwiftUICore | |
import SwiftUI |
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 the addition of SwiftUI in this file, but after trying to solve it we may need to work out a better method for opening windows more generally. We'll keep this for now, and thanks for adding that TODO.
Description
A system to allow users to download and manage LSP servers from the settings menu. This utilizes the mason registry to track the language servers.
Related Issues
Checklist
Screenshots