Skip to content

Commit

Permalink
Update example code in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
koliyo committed Nov 24, 2023
1 parent 684228a commit 7e23c49
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ let server = JSONRPCServer(dataChannel: channel)
```swift
import LanguageClient
import LanguageServerProtocol
import LSPClient
import Foundation

let executionParams = Process.ExecutionParameters(path: "/usr/bin/sourcekit-lsp", environment: ProcessInfo.processInfo.userEnvironment)

let channel = DataChannel.localProcessChannel(parameters: executionParams, terminationHandler: { print("terminated") })
let localServer = JSONRPCServer(dataChannel: channel)
let localServer = JSONRPCServerConnection(dataChannel: channel)

let provider: InitializingServer.InitializeParamsProvider = {
// you may need to fill in more of the textDocument field for completions
Expand All @@ -52,7 +54,7 @@ let provider: InitializingServer.InitializeParamsProvider = {
return InitializeParams(processId: Int(ProcessInfo.processInfo.processIdentifier),
locale: nil,
rootPath: nil,
rootURI: projectURL.absoluteString,
rootUri: projectURL.absoluteString,
initializationOptions: nil,
capabilities: capabilities,
trace: nil,
Expand All @@ -70,7 +72,7 @@ Task {
languageId: .swift,
version: 1,
text: docContent)
let docParams = textDocumentDidOpenParams(textDocument: doc)
let docParams = DidOpenTextDocumentParams(textDocument: doc)

try await server.textDocumentDidOpen(params: docParams)

Expand Down

0 comments on commit 7e23c49

Please sign in to comment.