Skip to content

Commit 97ff446

Browse files
committed
fix: Adapt code to new infrastructure parameter
1 parent 73c47af commit 97ff446

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

src/LanguageClient.tsx

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ReactElement, useEffect, useRef, useState } from 'react'
2-
import { createLanguageClientManager, LanguageClientId, StatusChangeEvent as WrapperStatusChangeEvent, LanguageClientManager, WillShutdownParams } from '@codingame/monaco-languageclient-wrapper'
2+
import { createLanguageClientManager, LanguageClientId, StatusChangeEvent as WrapperStatusChangeEvent, LanguageClientManager, WillShutdownParams, Infrastructure } from '@codingame/monaco-languageclient-wrapper'
33
import useIsUserActive from './hooks/useIsUserActive'
44
import useShouldShutdownLanguageClient from './hooks/useShouldShutdownLanguageClient'
55
import { useLastVersion } from './hooks/useLastVersion'
@@ -10,11 +10,7 @@ export interface StatusChangeEvent {
1010

1111
export interface LanguageClientProps {
1212
id: LanguageClientId
13-
sessionId?: string
14-
languageServerUrl: string
15-
useMutualizedProxy?: boolean
16-
getSecurityToken: () => Promise<string>
17-
libraryUrls?: string[]
13+
infrastructure: Infrastructure
1814
onError?: (error: Error) => void
1915
onDidChangeStatus?: (status: StatusChangeEvent) => void
2016
/** The language client will be shutdown by the server */
@@ -25,24 +21,17 @@ export interface LanguageClientProps {
2521
userInactivityShutdownDelay?: number
2622
}
2723

28-
const defaultLibraryUrls: string[] = []
29-
3024
const noop = () => null
3125

3226
function LanguageClient ({
3327
id,
34-
sessionId,
35-
languageServerUrl,
36-
useMutualizedProxy,
37-
getSecurityToken: _getSecurityToken,
38-
libraryUrls = defaultLibraryUrls,
28+
infrastructure,
3929
onError: _onError,
4030
onDidChangeStatus: _onDidChangeStatus,
4131
onWillShutdown: _onWillShutdown,
4232
userInactivityDelay = 30 * 1000,
4333
userInactivityShutdownDelay = 60 * 1000
4434
}: LanguageClientProps): ReactElement | null {
45-
const getSecurityToken = useLastVersion(_getSecurityToken)
4635
const onError = useLastVersion(_onError ?? noop)
4736
const onDidChangeStatus = useLastVersion(_onDidChangeStatus ?? noop)
4837
const onWillShutdown = useLastVersion(_onWillShutdown ?? noop)
@@ -75,7 +64,7 @@ function LanguageClient ({
7564
}
7665

7766
console.info(`Starting language server for language ${id}`)
78-
const languageClient = createLanguageClientManager(id, sessionId, languageServerUrl, getSecurityToken, libraryUrls, useMutualizedProxy)
67+
const languageClient = createLanguageClientManager(id, infrastructure)
7968
languageClientRef.current = languageClient
8069
const errorDisposable = languageClient.onError(onError)
8170
const statusChangeDisposable = languageClient.onDidChangeStatus(onDidChangeStatus)
@@ -97,7 +86,7 @@ function LanguageClient ({
9786
console.error('Unable to dispose language client', err)
9887
})
9988
}
100-
}, [getSecurityToken, id, languageServerUrl, libraryUrls, sessionId, counter, useMutualizedProxy, shouldShutdownLanguageClientForInactivity, onError, onDidChangeStatus, onWillShutdown])
89+
}, [id, counter, shouldShutdownLanguageClientForInactivity, onError, onDidChangeStatus, onWillShutdown, infrastructure])
10190

10291
return null
10392
}

src/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
import { LanguageClientId, loadExtensionConfigurations, registerLanguageClient } from '@codingame/monaco-languageclient-wrapper'
1+
import { CodinGameInfrastructure, Infrastructure, LanguageClientId, loadExtensionConfigurations, registerLanguageClient, WorkspaceFolder } from '@codingame/monaco-languageclient-wrapper'
22
import LanguageClient, { LanguageClientProps, StatusChangeEvent } from './LanguageClient'
33

44
export default LanguageClient
55
export {
66
loadExtensionConfigurations,
7-
registerLanguageClient
7+
registerLanguageClient,
8+
CodinGameInfrastructure
89
}
910
export type {
1011
LanguageClientProps,
1112
LanguageClientId,
12-
StatusChangeEvent
13+
StatusChangeEvent,
14+
Infrastructure,
15+
WorkspaceFolder
1316
}

0 commit comments

Comments
 (0)