Skip to content

Commit

Permalink
Adopt new config API
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed May 12, 2023
1 parent 598b782 commit 83fb442
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 30 deletions.
34 changes: 8 additions & 26 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
{
"pins" : [
{
"identity" : "anycodable",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Flight-School/AnyCodable",
"state" : {
"revision" : "b1a7a8a6186f2fcb28f7bda67cfc545de48b3c80",
"version" : "0.6.2"
}
},
{
"identity" : "chimekit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ChimeHQ/ChimeKit",
"state" : {
"revision" : "f19916df7e16f131d069a0b375381bafa404a46a",
"version" : "0.1.1"
"revision" : "ef60392c0700a7d312e54d01aa58f57cd61a4bf9",
"version" : "0.2.0"
}
},
{
Expand Down Expand Up @@ -59,35 +50,26 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/ChimeHQ/JSONRPC",
"state" : {
"revision" : "55071da13d109e61584750f39c0941d49711b962",
"version" : "0.5.0"
"revision" : "afc20d00e38674774f84edc325424a32ae3b9e01",
"version" : "0.7.0"
}
},
{
"identity" : "languageclient",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ChimeHQ/LanguageClient",
"state" : {
"revision" : "289a24fdd1cc2ca91202c72181d495444c7b4e43",
"version" : "0.2.7"
"revision" : "92beeecd0bb783da52227839ba6c55e43fc866ec",
"version" : "0.5.1"
}
},
{
"identity" : "languageserverprotocol",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ChimeHQ/LanguageServerProtocol",
"state" : {
"revision" : "abf80b752f5db0aa3f293b30f2ffeebc0f7decdf",
"version" : "0.7.9"
}
},
{
"identity" : "operationplus",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ChimeHQ/OperationPlus",
"state" : {
"revision" : "1340f95dce3e93d742497d88db18f8676f4badf4",
"version" : "1.6.0"
"revision" : "192bcfdcf7a013da49c6fa1b95de66254ce7c614",
"version" : "0.9.1"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let package = Package(
.library(name: "ChimeRust", targets: ["ChimeRust"]),
],
dependencies: [
.package(url: "https://github.com/ChimeHQ/ChimeKit", from: "0.1.1"),
.package(url: "https://github.com/ChimeHQ/ChimeKit", from: "0.2.0"),
],
targets: [
.target(name: "ChimeRust", dependencies: ["ChimeKit"]),
Expand Down
10 changes: 7 additions & 3 deletions Sources/ChimeRust/RustExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,21 @@ public final class RustExtension {
private let lspService: LSPService

public init(host: any HostProtocol, processHostServiceName: String) {
let filter = LSPService.contextFilter(for: [.rustSource], projectFiles: ["Cargo.toml"])

self.lspService = LSPService(host: host,
contextFilter: filter,
executableName: "rust-analyzer",
processHostServiceName: processHostServiceName,
logMessages: true)
}
}

extension RustExtension: ExtensionProtocol {
public var configuration: ExtensionConfiguration {
get async throws {
return ExtensionConfiguration(documentFilter: [.uti(.rustSource)],
directoryContentFilter: [.uti(.rustSource), .fileName("Cargo.toml")])
}
}

public func didOpenProject(with context: ProjectContext) async throws {
try await lspService.didOpenProject(with: context)
}
Expand Down

0 comments on commit 83fb442

Please sign in to comment.