1
1
import { ReactElement , useEffect , useRef , useState } from 'react'
2
- import { createLanguageClientManager , LanguageClientId , StatusChangeEvent as WrapperStatusChangeEvent , LanguageClientManager , WillShutdownParams , Infrastructure } from '@codingame/monaco-languageclient-wrapper'
2
+ import { createLanguageClientManager , LanguageClientId , StatusChangeEvent as WrapperStatusChangeEvent , LanguageClientManager , WillShutdownParams , Infrastructure , LanguageClientOptions } from '@codingame/monaco-languageclient-wrapper'
3
3
import useIsUserActive from './hooks/useIsUserActive'
4
4
import useShouldShutdownLanguageClient from './hooks/useShouldShutdownLanguageClient'
5
5
import { useLastVersion } from './hooks/useLastVersion'
@@ -11,6 +11,7 @@ export interface StatusChangeEvent {
11
11
export interface LanguageClientProps {
12
12
id : LanguageClientId
13
13
infrastructure : Infrastructure
14
+ clientOptions ?: LanguageClientOptions
14
15
onError ?: ( error : Error ) => void
15
16
onDidChangeStatus ?: ( status : StatusChangeEvent ) => void
16
17
/** The language client will be shutdown by the server */
@@ -26,6 +27,7 @@ const noop = () => null
26
27
function LanguageClient ( {
27
28
id,
28
29
infrastructure,
30
+ clientOptions,
29
31
onError : _onError ,
30
32
onDidChangeStatus : _onDidChangeStatus ,
31
33
onWillShutdown : _onWillShutdown ,
@@ -64,7 +66,7 @@ function LanguageClient ({
64
66
}
65
67
66
68
console . info ( `Starting language server for language ${ id } ` )
67
- const languageClient = createLanguageClientManager ( id , infrastructure )
69
+ const languageClient = createLanguageClientManager ( id , infrastructure , clientOptions )
68
70
languageClientRef . current = languageClient
69
71
const errorDisposable = languageClient . onError ( onError )
70
72
const statusChangeDisposable = languageClient . onDidChangeStatus ( onDidChangeStatus )
@@ -86,7 +88,7 @@ function LanguageClient ({
86
88
console . error ( 'Unable to dispose language client' , err )
87
89
} )
88
90
}
89
- } , [ id , counter , shouldShutdownLanguageClientForInactivity , onError , onDidChangeStatus , onWillShutdown , infrastructure ] )
91
+ } , [ id , counter , shouldShutdownLanguageClientForInactivity , onError , onDidChangeStatus , onWillShutdown , infrastructure , clientOptions ] )
90
92
91
93
return null
92
94
}
0 commit comments