@@ -44,16 +44,10 @@ import {
4444 inlineChatResultNotificationType ,
4545 listConversationsRequestType ,
4646 conversationClickRequestType ,
47- GetSerializedChatParams ,
48- GetSerializedChatResult ,
49- RequestHandler ,
50- TabBarActionParams ,
51- TabBarActionResult ,
5247 getSerializedChatRequestType ,
5348 tabBarActionRequestType ,
5449 chatOptionsUpdateType ,
5550 promptInputOptionChangeNotificationType ,
56- buttonClickRequestType ,
5751} from '../protocol'
5852import { createConnection } from 'vscode-languageserver/browser'
5953import {
@@ -122,10 +116,11 @@ export const baseRuntime = (connections: { reader: MessageReader; writer: Messag
122116 // Set up the workspace to use the LSP Text Documents component
123117 const defaultHomeDir = '/home/user'
124118 const workspace : Workspace = {
125- getTextDocument : async uri => documents . get ( uri ) ,
126- getAllTextDocuments : async ( ) => documents . all ( ) ,
127- getWorkspaceFolder : _uri =>
128- lspRouter . clientInitializeParams ! . workspaceFolders && lspRouter . clientInitializeParams ! . workspaceFolders [ 0 ] ,
119+ getTextDocument : uri => Promise . resolve ( documents . get ( uri ) ) ,
120+ getAllTextDocuments : ( ) => Promise . resolve ( documents . all ( ) ) ,
121+ getWorkspaceFolder : _ =>
122+ lspRouter . clientInitializeParams ?. workspaceFolders &&
123+ lspRouter . clientInitializeParams . workspaceFolders ?. [ 0 ] ,
129124 fs : {
130125 copyFile : ( _src , _dest , _options ?) => Promise . resolve ( ) ,
131126 exists : _path => Promise . resolve ( false ) ,
@@ -166,10 +161,10 @@ export const baseRuntime = (connections: { reader: MessageReader; writer: Messag
166161 onFollowUpClicked : handler => lspConnection . onNotification ( followUpClickNotificationType . method , handler ) ,
167162 chatOptionsUpdate : params => lspConnection . sendNotification ( chatOptionsUpdateType . method , params ) ,
168163 openTab : params => lspConnection . sendRequest ( openTabRequestType . method , params ) ,
169- onButtonClick : params => lspConnection . onRequest ( buttonClickRequestType . method , params ) ,
170- sendChatUpdate : params => lspConnection . sendNotification ( chatUpdateNotificationType . method , params ) ,
164+ sendChatUpdate : params => ( ) => lspConnection . sendNotification ( chatUpdateNotificationType . method , params ) ,
171165 onFileClicked : handler => lspConnection . onNotification ( fileClickNotificationType . method , handler ) ,
172- sendContextCommands : params => lspConnection . sendNotification ( contextCommandsNotificationType . method , params ) ,
166+ sendContextCommands : params => ( ) =>
167+ lspConnection . sendNotification ( contextCommandsNotificationType . method , params ) ,
173168 onCreatePrompt : handler => lspConnection . onNotification ( createPromptNotificationType . method , handler ) ,
174169 onInlineChatResult : handler => lspConnection . onNotification ( inlineChatResultNotificationType . method , handler ) ,
175170 onListConversations : handler => lspConnection . onRequest ( listConversationsRequestType . method , handler ) ,
@@ -185,7 +180,7 @@ export const baseRuntime = (connections: { reader: MessageReader; writer: Messag
185180 onUpdateProfile : handler => lspConnection . onRequest ( updateProfileRequestType , handler ) ,
186181 onGetSsoToken : handler => lspConnection . onRequest ( getSsoTokenRequestType , handler ) ,
187182 onInvalidateSsoToken : handler => lspConnection . onRequest ( invalidateSsoTokenRequestType , handler ) ,
188- sendSsoTokenChanged : params => lspConnection . sendNotification ( ssoTokenChangedRequestType , params ) ,
183+ sendSsoTokenChanged : params => ( ) => lspConnection . sendNotification ( ssoTokenChangedRequestType , params ) ,
189184 }
190185
191186 // Set up auth without encryption
@@ -197,7 +192,7 @@ export const baseRuntime = (connections: { reader: MessageReader; writer: Messag
197192 version : props . version ,
198193 } ,
199194 platform : 'browser' ,
200- getConfiguration ( key : string ) {
195+ getConfiguration ( _key : string ) {
201196 return undefined
202197 } ,
203198 }
@@ -238,8 +233,10 @@ export const baseRuntime = (connections: { reader: MessageReader; writer: Messag
238233 onDidDeleteFiles : params => lspConnection . workspace . onDidDeleteFiles ( params ) ,
239234 onDidRenameFiles : params => lspConnection . workspace . onDidRenameFiles ( params ) ,
240235 onUpdateConfiguration : lspServer . setUpdateConfigurationHandler ,
241- selectWorkspaceItem : params => lspConnection . sendRequest ( selectWorkspaceItemRequestType . method , params ) ,
242- openFileDiff : params => lspConnection . sendNotification ( openFileDiffNotificationType . method , params ) ,
236+ selectWorkspaceItem : params => ( ) =>
237+ lspConnection . sendRequest ( selectWorkspaceItemRequestType . method , params ) ,
238+ openFileDiff : params => ( ) =>
239+ lspConnection . sendNotification ( openFileDiffNotificationType . method , params ) ,
243240 } ,
244241 window : {
245242 showMessage : params => lspConnection . sendNotification ( ShowMessageNotification . method , params ) ,
@@ -298,7 +295,9 @@ export const baseRuntime = (connections: { reader: MessageReader; writer: Messag
298295
299296 // Free up any resources or threads used by Servers
300297 lspConnection . onExit ( ( ) => {
301- disposables . forEach ( d => d ( ) )
298+ for ( const d of disposables ) {
299+ d ( )
300+ }
302301 } )
303302
304303 // Initialize the documents listener and start the LSP connection
0 commit comments