Skip to content

Commit 641babb

Browse files
feat: add optional manager options
1 parent 4fc6767 commit 641babb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/LanguageClient.tsx

+5-3
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, Infrastructure, LanguageClientOptions } from '@codingame/monaco-languageclient-wrapper'
2+
import { createLanguageClientManager, LanguageClientId, StatusChangeEvent as WrapperStatusChangeEvent, LanguageClientManager, WillShutdownParams, Infrastructure, LanguageClientOptions, LanguageClientManagerOptions } from '@codingame/monaco-languageclient-wrapper'
33
import useIsUserActive from './hooks/useIsUserActive'
44
import useShouldShutdownLanguageClient from './hooks/useShouldShutdownLanguageClient'
55
import { useLastVersion } from './hooks/useLastVersion'
@@ -12,6 +12,7 @@ export interface LanguageClientProps {
1212
id: LanguageClientId
1313
infrastructure: Infrastructure
1414
clientOptions?: LanguageClientOptions
15+
clientManagerOptions?: LanguageClientManagerOptions
1516
onError?: (error: Error) => void
1617
onDidChangeStatus?: (status: StatusChangeEvent) => void
1718
/** The language client will be shutdown by the server */
@@ -28,6 +29,7 @@ function LanguageClient ({
2829
id,
2930
infrastructure,
3031
clientOptions,
32+
clientManagerOptions,
3133
onError: _onError,
3234
onDidChangeStatus: _onDidChangeStatus,
3335
onWillShutdown: _onWillShutdown,
@@ -66,7 +68,7 @@ function LanguageClient ({
6668
}
6769

6870
console.info(`Starting language server for language ${id}`)
69-
const languageClient = createLanguageClientManager(id, infrastructure, clientOptions)
71+
const languageClient = createLanguageClientManager(id, infrastructure, clientOptions, clientManagerOptions)
7072
languageClientRef.current = languageClient
7173
const errorDisposable = languageClient.onError(onError)
7274
const statusChangeDisposable = languageClient.onDidChangeStatus(onDidChangeStatus)
@@ -88,7 +90,7 @@ function LanguageClient ({
8890
console.error('Unable to dispose language client', err)
8991
})
9092
}
91-
}, [id, counter, shouldShutdownLanguageClientForInactivity, onError, onDidChangeStatus, onWillShutdown, infrastructure, clientOptions])
93+
}, [id, counter, shouldShutdownLanguageClientForInactivity, onError, onDidChangeStatus, onWillShutdown, infrastructure, clientOptions, clientManagerOptions])
9294

9395
return null
9496
}

0 commit comments

Comments
 (0)