@@ -43,11 +43,6 @@ import {
4343 createPromptNotificationType ,
4444 listConversationsRequestType ,
4545 conversationClickRequestType ,
46- GetSerializedChatParams ,
47- GetSerializedChatResult ,
48- RequestHandler ,
49- TabBarActionParams ,
50- TabBarActionResult ,
5146 getSerializedChatRequestType ,
5247 tabBarActionRequestType ,
5348} from '../protocol'
@@ -118,10 +113,11 @@ export const baseRuntime = (connections: { reader: MessageReader; writer: Messag
118113 // Set up the workspace to use the LSP Text Documents component
119114 const defaultHomeDir = '/home/user'
120115 const workspace : Workspace = {
121- getTextDocument : async uri => documents . get ( uri ) ,
122- getAllTextDocuments : async ( ) => documents . all ( ) ,
123- getWorkspaceFolder : _uri =>
124- lspRouter . clientInitializeParams ! . workspaceFolders && lspRouter . clientInitializeParams ! . workspaceFolders [ 0 ] ,
116+ getTextDocument : uri => Promise . resolve ( documents . get ( uri ) ) ,
117+ getAllTextDocuments : ( ) => Promise . resolve ( documents . all ( ) ) ,
118+ getWorkspaceFolder : _ =>
119+ lspRouter . clientInitializeParams ?. workspaceFolders &&
120+ lspRouter . clientInitializeParams . workspaceFolders ?. [ 0 ] ,
125121 fs : {
126122 copyFile : ( _src , _dest , _options ?) => Promise . resolve ( ) ,
127123 exists : _path => Promise . resolve ( false ) ,
@@ -161,9 +157,10 @@ export const baseRuntime = (connections: { reader: MessageReader; writer: Messag
161157 onSourceLinkClick : handler => lspConnection . onNotification ( sourceLinkClickNotificationType . method , handler ) ,
162158 onFollowUpClicked : handler => lspConnection . onNotification ( followUpClickNotificationType . method , handler ) ,
163159 openTab : params => lspConnection . sendRequest ( openTabRequestType . method , params ) ,
164- sendChatUpdate : params => lspConnection . sendNotification ( chatUpdateNotificationType . method , params ) ,
160+ sendChatUpdate : params => ( ) => lspConnection . sendNotification ( chatUpdateNotificationType . method , params ) ,
165161 onFileClicked : handler => lspConnection . onNotification ( fileClickNotificationType . method , handler ) ,
166- sendContextCommands : params => lspConnection . sendNotification ( contextCommandsNotificationType . method , params ) ,
162+ sendContextCommands : params => ( ) =>
163+ lspConnection . sendNotification ( contextCommandsNotificationType . method , params ) ,
167164 onCreatePrompt : handler => lspConnection . onNotification ( createPromptNotificationType . method , handler ) ,
168165 onListConversations : handler => lspConnection . onRequest ( listConversationsRequestType . method , handler ) ,
169166 onConversationClick : handler => lspConnection . onRequest ( conversationClickRequestType . method , handler ) ,
@@ -176,7 +173,7 @@ export const baseRuntime = (connections: { reader: MessageReader; writer: Messag
176173 onUpdateProfile : handler => lspConnection . onRequest ( updateProfileRequestType , handler ) ,
177174 onGetSsoToken : handler => lspConnection . onRequest ( getSsoTokenRequestType , handler ) ,
178175 onInvalidateSsoToken : handler => lspConnection . onRequest ( invalidateSsoTokenRequestType , handler ) ,
179- sendSsoTokenChanged : params => lspConnection . sendNotification ( ssoTokenChangedRequestType , params ) ,
176+ sendSsoTokenChanged : params => ( ) => lspConnection . sendNotification ( ssoTokenChangedRequestType , params ) ,
180177 }
181178
182179 // Set up auth without encryption
@@ -188,7 +185,7 @@ export const baseRuntime = (connections: { reader: MessageReader; writer: Messag
188185 version : props . version ,
189186 } ,
190187 platform : 'browser' ,
191- getConfiguration ( key : string ) {
188+ getConfiguration ( _key : string ) {
192189 return undefined
193190 } ,
194191 }
@@ -229,8 +226,10 @@ export const baseRuntime = (connections: { reader: MessageReader; writer: Messag
229226 onDidDeleteFiles : params => lspConnection . workspace . onDidDeleteFiles ( params ) ,
230227 onDidRenameFiles : params => lspConnection . workspace . onDidRenameFiles ( params ) ,
231228 onUpdateConfiguration : lspServer . setUpdateConfigurationHandler ,
232- selectWorkspaceItem : params => lspConnection . sendRequest ( selectWorkspaceItemRequestType . method , params ) ,
233- openFileDiff : params => lspConnection . sendNotification ( openFileDiffNotificationType . method , params ) ,
229+ selectWorkspaceItem : params => ( ) =>
230+ lspConnection . sendRequest ( selectWorkspaceItemRequestType . method , params ) ,
231+ openFileDiff : params => ( ) =>
232+ lspConnection . sendNotification ( openFileDiffNotificationType . method , params ) ,
234233 } ,
235234 window : {
236235 showMessage : params => lspConnection . sendNotification ( ShowMessageNotification . method , params ) ,
@@ -289,7 +288,9 @@ export const baseRuntime = (connections: { reader: MessageReader; writer: Messag
289288
290289 // Free up any resources or threads used by Servers
291290 lspConnection . onExit ( ( ) => {
292- disposables . forEach ( d => d ( ) )
291+ for ( const d of disposables ) {
292+ d ( )
293+ }
293294 } )
294295
295296 // Initialize the documents listener and start the LSP connection
0 commit comments