@@ -72,22 +72,6 @@ export default function ChatPage() {
72
72
const isInEditor = ! ! client || undefined
73
73
const useMacOSKeyboardEventHandler = useRef < boolean > ( )
74
74
75
- // server feature support check
76
- const [ supportsOnApplyInEditorV2 , setSupportsOnApplyInEditorV2 ] =
77
- useState ( false )
78
- const [ supportsOnLookupSymbol , setSupportsOnLookupSymbol ] = useState ( false )
79
- const [
80
- supportsReadWorkspaceGitRepoInfo ,
81
- setSupportsReadWorkspaceGitRepoInfo
82
- ] = useState ( false )
83
- const [
84
- supportsStoreAndFetchSessionState ,
85
- setSupportsStoreAndFetchSessionState
86
- ] = useState ( false )
87
- const [ supportsListFileInWorkspace , setSupportProvideFileAtInfo ] =
88
- useState ( false )
89
- const [ supportsReadFileContent , setSupportsReadFileContent ] = useState ( false )
90
-
91
75
const executeCommand = ( command : ChatCommand ) => {
92
76
if ( chatRef . current ) {
93
77
chatRef . current . executeCommand ( command )
@@ -244,34 +228,7 @@ export default function ChatPage() {
244
228
apiVersion : TABBY_CHAT_PANEL_API_VERSION
245
229
} )
246
230
247
- const checkCapabilities = async ( ) => {
248
- server
249
- ?. hasCapability ( 'onApplyInEditorV2' )
250
- . then ( setSupportsOnApplyInEditorV2 )
251
- server ?. hasCapability ( 'lookupSymbol' ) . then ( setSupportsOnLookupSymbol )
252
- server
253
- ?. hasCapability ( 'readWorkspaceGitRepositories' )
254
- . then ( setSupportsReadWorkspaceGitRepoInfo )
255
- server
256
- ?. hasCapability ( 'listFileInWorkspace' )
257
- . then ( setSupportProvideFileAtInfo )
258
- server
259
- ?. hasCapability ( 'readFileContent' )
260
- . then ( setSupportsReadFileContent )
261
-
262
- Promise . all ( [
263
- server ?. hasCapability ( 'fetchSessionState' ) ,
264
- server ?. hasCapability ( 'storeSessionState' )
265
- ] ) . then ( results => {
266
- setSupportsStoreAndFetchSessionState (
267
- results . every ( result => ! ! result )
268
- )
269
- } )
270
- }
271
-
272
- checkCapabilities ( ) . then ( ( ) => {
273
- setIsServerLoaded ( true )
274
- } )
231
+ setIsServerLoaded ( true )
275
232
}
276
233
} , [ server ] )
277
234
@@ -429,6 +386,9 @@ export default function ChatPage() {
429
386
)
430
387
}
431
388
389
+ const supportsStoreAndFetchSessionState =
390
+ server ?. storeSessionState && server ?. fetchSessionState
391
+
432
392
return (
433
393
< ErrorBoundary FallbackComponent = { ErrorBoundaryFallback } >
434
394
< Chat
@@ -441,39 +401,24 @@ export default function ChatPage() {
441
401
onCopyContent = { isInEditor && server ?. onCopy }
442
402
onApplyInEditor = {
443
403
isInEditor &&
444
- ( supportsOnApplyInEditorV2
404
+ ( server ?. onApplyInEditorV2
445
405
? server ?. onApplyInEditorV2
446
406
: server ?. onApplyInEditor )
447
407
}
448
- supportsOnApplyInEditorV2 = { supportsOnApplyInEditorV2 }
449
- onLookupSymbol = {
450
- isInEditor &&
451
- ( supportsOnLookupSymbol ? server ?. lookupSymbol : undefined )
452
- }
408
+ supportsOnApplyInEditorV2 = { ! ! server ?. onApplyInEditorV2 }
409
+ onLookupSymbol = { isInEditor && server ?. lookupSymbol }
453
410
openInEditor = { openInEditor }
454
411
openExternal = { openExternal }
455
- readWorkspaceGitRepositories = {
456
- supportsReadWorkspaceGitRepoInfo
457
- ? server ?. readWorkspaceGitRepositories
458
- : undefined
459
- }
412
+ readWorkspaceGitRepositories = { server ?. readWorkspaceGitRepositories }
460
413
getActiveEditorSelection = { getActiveEditorSelection }
461
414
fetchSessionState = {
462
415
supportsStoreAndFetchSessionState ? fetchSessionState : undefined
463
416
}
464
417
storeSessionState = {
465
418
supportsStoreAndFetchSessionState ? storeSessionState : undefined
466
419
}
467
- listFileInWorkspace = {
468
- isInEditor && supportsListFileInWorkspace
469
- ? server ?. listFileInWorkspace
470
- : undefined
471
- }
472
- readFileContent = {
473
- isInEditor && supportsReadFileContent
474
- ? server ?. readFileContent
475
- : undefined
476
- }
420
+ listFileInWorkspace = { isInEditor && server ?. listFileInWorkspace }
421
+ readFileContent = { isInEditor && server ?. readFileContent }
477
422
/>
478
423
</ ErrorBoundary >
479
424
)
0 commit comments