Skip to content

Commit

Permalink
Update refactoring of removed param label (#13)
Browse files Browse the repository at this point in the history
* Remove refactored LSPClient target

* Update refactoring of removed param label

* Update to LanguageServerProtocol 0.13.0

---------

Co-authored-by: Matt <[email protected]>
  • Loading branch information
koliyo and mattmassicotte authored Jan 20, 2024
1 parent 253b8a0 commit d9eab54
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/ChimeHQ/LanguageServerProtocol",
"state" : {
"revision" : "9ae95d89b1a3f2c5da98adea29637c519a7e3c6c",
"version" : "0.12.0"
"revision" : "f5a53e0386b34a0e06333ec9376f5972f7d20c28",
"version" : "0.13.0"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let package = Package(
targets: ["LanguageClient"]),
],
dependencies: [
.package(url: "https://github.com/ChimeHQ/LanguageServerProtocol", from: "0.12.0"),
.package(url: "https://github.com/ChimeHQ/LanguageServerProtocol", from: "0.13.0"),
.package(url: "https://github.com/Frizlab/FSEventsWrapper", from: "2.1.0"),
.package(url: "https://github.com/ChimeHQ/GlobPattern", from: "0.1.1"),
.package(url: "https://github.com/ChimeHQ/JSONRPC", from: "0.9.0"),
Expand Down
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ let channel = try DataChannel.localProcessChannel(
terminationHandler: { print("terminated") }
)

// finally, make a server you can interact with
// finally, make a server you can interact with
let server = JSONRPCServerConnection(dataChannel: channel)
```

Expand All @@ -67,7 +67,6 @@ let server = JSONRPCServerConnection(dataChannel: channel)
```swift
import LanguageClient
import LanguageServerProtocol
import LSPClient
import Foundation

let executionParams = Process.ExecutionParameters(
Expand All @@ -93,7 +92,7 @@ let provider: InitializingServer.InitializeParamsProvider = {
window: nil,
general: nil,
experimental: nil)

// pay careful attention to rootPath/rootURI/workspaceFolders, as different servers will
// have different expectations/requirements here
return InitializeParams(processId: Int(ProcessInfo.processInfo.processIdentifier),
Expand All @@ -110,18 +109,18 @@ let server = InitializingServer(server: localServer, initializeParamsProvider: p

Task {
let docContent = try String(contentsOf: docURL)

let doc = TextDocumentItem(
uri: docURL.absoluteString,
languageId: .swift,
version: 1,
text: docContent
)

let docParams = DidOpenTextDocumentParams(textDocument: doc)

try await server.textDocumentDidOpen(params: docParams)

// make sure to pick a reasonable position within your test document
let pos = Position(line: 5, character: 25)
let completionParams = CompletionParams(
Expand All @@ -130,9 +129,9 @@ Task {
triggerKind: .invoked,
triggerCharacter: nil
)

let completions = try await server.completion(params: completionParams)

print("completions: ", completions)
}
```
Expand Down
4 changes: 2 additions & 2 deletions Sources/LanguageClient/InitializingServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ extension InitializingServer {

let params = try await initializeParamsProvider()

let initResponse = try await channel.initialize(params: params)
let initResponse = try await channel.initialize(params)
let caps = initResponse.capabilities

try await channel.initialized(params: InitializedParams())
try await channel.initialized(InitializedParams())

self.state = .initialized(caps)

Expand Down
2 changes: 1 addition & 1 deletion Sources/LanguageClient/RestartingServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public actor RestartingServer<WrappedServer: ServerConnection & Sendable> {

let params = DidOpenTextDocumentParams(textDocument: item)

try await server.textDocumentDidOpen(params: params)
try await server.textDocumentDidOpen(params)
} catch {
#if canImport(OSLog)
logger.error("Failed to reopen document \(uri, privacy: .public): \(error, privacy: .public)")
Expand Down
2 changes: 1 addition & 1 deletion Tests/LanguageClientTests/ServerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ final class ServerTests: XCTestCase {

let params = TextDocumentPositionParams(uri: "abc", position: .init((0, 0)))

let response = try await server.hover(params: params)
let response = try await server.hover(params)

let messages = await mockChannel.finishSession()

Expand Down

0 comments on commit d9eab54

Please sign in to comment.