-
Notifications
You must be signed in to change notification settings - Fork 1k
/
protocol.ts
1180 lines (1086 loc) · 36.1 KB
/
protocol.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* eslint-disable @typescript-eslint/no-namespace */
import {
ProtocolRequestType0,
ProtocolRequestType,
ProtocolNotificationType,
RegistrationType,
MessageDirection,
LSPAny,
URI,
Range,
Location,
Command as LspCommand,
InitializeRequest as LspInitializeRequest,
InitializeParams as LspInitializeParams,
InitializeResult as LspInitializeResult,
InitializeError,
ClientCapabilities as LspClientCapabilities,
TextDocumentClientCapabilities,
CompletionClientCapabilities,
InlineCompletionClientCapabilities,
ServerCapabilities as LspServerCapabilities,
ConfigurationRequest as LspConfigurationRequest,
DidChangeConfigurationNotification as LspDidChangeConfigurationNotification,
DidChangeConfigurationParams as LspDidChangeConfigurationParams,
CodeLensRequest as LspCodeLensRequest,
CodeLensParams,
CodeLens as LspCodeLens,
CompletionRequest as LspCompletionRequest,
CompletionParams,
CompletionList as LspCompletionList,
CompletionItem as LspCompletionItem,
InlineCompletionRequest as LspInlineCompletionRequest,
InlineCompletionParams,
InlineCompletionList as LspInlineCompletionList,
InlineCompletionItem as LspInlineCompletionItem,
DeclarationParams,
Declaration,
LocationLink,
SemanticTokensRangeParams,
SemanticTokens,
SemanticTokensLegend,
WorkspaceEdit,
} from "vscode-languageserver-protocol";
/**
* Extends LSP method Initialize Request(↩️)
*
* - method: `initialize`
* - params: {@link InitializeParams}
* - result: {@link InitializeResult}
*/
export namespace InitializeRequest {
export const method = LspInitializeRequest.method;
export const messageDirection = LspInitializeRequest.messageDirection;
export const type = new ProtocolRequestType<InitializeParams, InitializeResult, InitializeError, void, void>(method);
}
export type InitializeParams = LspInitializeParams & {
clientInfo?: ClientInfo;
capabilities: ClientCapabilities;
initializationOptions?: InitializationOptions;
};
export type InitializationOptions = {
config?: ClientProvidedConfig;
/**
* ClientInfo also can be provided in InitializationOptions, will be merged with the one in InitializeParams.
* This is useful for the clients that don't support changing the ClientInfo in InitializeParams.
*/
clientInfo?: ClientInfo;
/**
* ClientCapabilities also can be provided in InitializationOptions, will be merged with the one in InitializeParams.
* This is useful for the clients that don't support changing the ClientCapabilities in InitializeParams.
*/
clientCapabilities?: ClientCapabilities;
/**
* The data store records that should be initialized when the server starts. This is useful for the clients that
* provides the dataStore capability.
*/
dataStoreRecords?: DataStoreRecords;
};
export type InitializeResult = LspInitializeResult & {
capabilities: ServerCapabilities;
};
/**
* [Tabby] Defines the name and version information of the IDE and the tabby plugin.
*/
export type ClientInfo = {
name: string;
version?: string;
tabbyPlugin?: {
name: string;
version?: string;
};
};
export type ClientCapabilities = LspClientCapabilities & {
textDocument?: TextDocumentClientCapabilities & {
completion?: boolean | CompletionClientCapabilities;
inlineCompletion?: boolean | InlineCompletionClientCapabilities;
};
tabby?: {
/**
* @deprecated Use configListener and statusListener instead.
* The client supports:
* - `tabby/agent/didUpdateServerInfo`
* - `tabby/agent/didChangeStatus`
* - `tabby/agent/didUpdateIssues`
* This capability indicates that client support receiving agent notifications.
*/
agent?: boolean;
/**
* The client supports:
* - `tabby/config/didChange`
* This capability indicates that client support receiving notifications for configuration changes.
*/
configDidChangeListener?: boolean;
/**
* The client supports:
* - `tabby/status/didChange`
* This capability indicates that client support receiving notifications for status sync to display a status bar.
*/
statusDidChangeListener?: boolean;
/**
* The client supports:
* - `tabby/workspaceFileSystem/readFile`
* This capability improves the workspace code snippets context (RAG).
* When not provided, the server will try to fallback to NodeJS provided `fs` module,
* which is not available in the browser.
*/
workspaceFileSystem?: boolean;
/**
* The client provides a initial data store records for initialization and supports methods:
* - `tabby/dataStore/didUpdate`
* - `tabby/dataStore/update`
* When not provided, the server will try to fallback to the default data store,
* a file-based data store (~/.tabby-client/agent/data.json), which is not available in the browser.
*/
dataStore?: boolean;
/**
* The client supports:
* - `tabby/languageSupport/textDocument/declaration`
* - `tabby/languageSupport/textDocument/semanticTokens/range`
* This capability improves the workspace code snippets context (RAG).
*/
languageSupport?: boolean;
/**
* The client supports:
* - `tabby/git/repository`
* - `tabby/git/diff`
* This capability improves the workspace git repository context (RAG).
* When not provided, the server will try to fallback to the default git provider,
* which running system `git` command, not available if cannot execute `git` command,
* not available in the browser.
*/
gitProvider?: boolean;
/**
* The client supports:
* - `tabby/editorOptions`
* This capability improves the completion formatting.
*/
editorOptions?: boolean;
};
};
export type ServerCapabilities = LspServerCapabilities & {
tabby?: {
/**
* @deprecated The feature availability will be updated by dynamic registration.
* See {@link ChatFeatureRegistration}
*
* The server supports:
* - `tabby/chat/edit`
* - `tabby/chat/generateCommitMessage`
* See {@link ChatFeatureRegistration}
*/
chat?: boolean;
};
};
export namespace ChatFeatures {
export const type = new RegistrationType<void>("tabby/chat");
}
/**
* Extends LSP method Configuration Request(↪️)
*
* - method: `workspace/configuration`
* - params: any, not used
* - result: [{@link ClientProvidedConfig}] (the array should contains only one ClientProvidedConfig item)
*/
export namespace ConfigurationRequest {
export const method = LspConfigurationRequest.method;
export const messageDirection = LspConfigurationRequest.messageDirection;
export const type = new ProtocolRequestType<LSPAny, [ClientProvidedConfig], never, void, void>(method);
}
/**
* [Tabby] Defines the config supported to be changed on the client side (IDE).
*/
export type ClientProvidedConfig = {
/**
* Specifies the endpoint and token for connecting to the Tabby server.
*/
server?: {
endpoint?: string;
token?: string;
};
/**
* Specifies the proxy for http/https requests.
*/
proxy?: {
url?: string;
authorization?: string;
};
/**
* Trigger mode should be implemented on the client side.
* Sending this config to the server is for telemetry purposes.
*/
inlineCompletion?: {
triggerMode?: InlineCompletionTriggerMode;
};
/**
* Keybindings should be implemented on the client side.
* Sending this config to the server is for telemetry purposes.
*/
keybindings?: "default" | "tabby-style" | "customize";
/**
* Controls whether the telemetry is enabled or not.
*/
anonymousUsageTracking?: {
disable?: boolean;
};
};
export type InlineCompletionTriggerMode = "auto" | "manual";
/**
* Extends LSP method DidChangeConfiguration Notification(➡️)
* - method: `workspace/didChangeConfiguration`
* - params: {@link DidChangeConfigurationParams}
* - result: void
*/
export namespace DidChangeConfigurationNotification {
export const method = LspDidChangeConfigurationNotification.method;
export const messageDirection = LspDidChangeConfigurationNotification.messageDirection;
export const type = new ProtocolNotificationType<DidChangeConfigurationParams, void>(method);
}
export type DidChangeConfigurationParams = LspDidChangeConfigurationParams & {
settings?: ClientProvidedConfig;
};
/**
* Extends LSP method Code Lens Request(↩️)
*
* Tabby provides this method for preview changes applied in the Chat Edit feature,
* the client should render codelens and decorations to improve the readability of the pending changes.
* - method: `textDocument/codeLens`
* - params: {@link CodeLensParams}
* - result: {@link CodeLens}[] | null
* - partialResult: {@link CodeLens}[]
*/
export namespace CodeLensRequest {
export const method = LspCodeLensRequest.method;
export const messageDirection = LspCodeLensRequest.messageDirection;
export const type = new ProtocolRequestType<CodeLensParams, CodeLens[] | null, CodeLens[], void, void>(method);
}
export type CodeLens = LspCodeLens & {
command?: ChatEditResolveCommand | LspCommand;
data?: {
type: CodeLensType;
line?: ChangesPreviewLineType;
};
};
export type CodeLensType = "previewChanges";
export type ChangesPreviewLineType =
| "header"
| "footer"
| "commentsFirstLine"
| "comments"
| "waiting"
| "inProgress"
| "unchanged"
| "inserted"
| "deleted";
/**
* Extends LSP method Completion Request(↩️)
*
* Note: Tabby provides this method capability when the client has `textDocument/completion` capability.
* - method: `textDocument/completion`
* - params: {@link CompletionParams}
* - result: {@link CompletionList} | null
*/
export namespace CompletionRequest {
export const method = LspCompletionRequest.method;
export const messageDirection = LspCompletionRequest.messageDirection;
export const type = new ProtocolRequestType<CompletionParams, CompletionList | null, never, void, void>(method);
}
export type CompletionList = LspCompletionList & {
items: CompletionItem[];
};
export type CompletionItem = LspCompletionItem & {
data?: {
/**
* The eventId is for telemetry purposes, should be used in `tabby/telemetry/event`.
*/
eventId?: CompletionEventId;
};
};
export type CompletionEventId = {
completionId: string;
choiceIndex: number;
};
/**
* Extends LSP method Inline Completion Request(↩️)
*
* Note: Tabby provides this method capability when the client has `textDocument/inlineCompletion` capability.
* - method: `textDocument/inlineCompletion`
* - params: {@link InlineCompletionParams}
* - result: {@link InlineCompletionList} | null
*/
export namespace InlineCompletionRequest {
export const method = LspInlineCompletionRequest.method;
export const messageDirection = LspInlineCompletionRequest.messageDirection;
export const type = new ProtocolRequestType<InlineCompletionParams, InlineCompletionList | null, never, void, void>(
method,
);
}
export type InlineCompletionList = LspInlineCompletionList & {
isIncomplete: boolean;
items: InlineCompletionItem[];
};
export type InlineCompletionItem = LspInlineCompletionItem & {
data?: {
/**
* The eventId is for telemetry purposes, should be used in `tabby/telemetry/event`.
*/
eventId?: CompletionEventId;
};
};
/**
* [Tabby] Chat Edit Suggestion Command Request(↩️)
*
* This method is sent from the client to the server to get suggestion commands for the current context.
* - method: `tabby/chat/edit/command`
* - params: {@link ChatEditCommandParams}
* - result: {@link ChatEditCommand}[] | null
* - partialResult: {@link ChatEditCommand}[]
*/
export namespace ChatEditCommandRequest {
export const method = "tabby/chat/edit/command";
export const messageDirection = MessageDirection.clientToServer;
export const type = new ProtocolRequestType<
ChatEditCommandParams,
ChatEditCommand[] | null,
ChatEditCommand[],
void,
void
>(method);
}
export type ChatEditCommandParams = {
/**
* The document location to get suggestion commands for.
*/
location: Location;
};
export type ChatEditCommand = {
/**
* The display label of the command.
*/
label: string;
/**
* A string value for the command.
* If the command is a `preset` command, it always starts with `/`.
*/
command: string;
/**
* The source of the command.
*/
source: "preset";
};
/**
* [Tabby] Chat Edit Request(↩️)
*
* This method is sent from the client to the server to edit the document content by user's command.
* The server will edit the document content using ApplyEdit(`workspace/applyEdit`) request,
* which requires the client to have this capability.
* - method: `tabby/chat/edit`
* - params: {@link ChatEditRequest}
* - result: {@link ChatEditToken}
* - error: {@link ChatFeatureNotAvailableError}
* | {@link ChatEditDocumentTooLongError}
* | {@link ChatEditCommandTooLongError}
* | {@link ChatEditMutexError}
*/
export namespace ChatEditRequest {
export const method = "tabby/chat/edit";
export const messageDirection = MessageDirection.clientToServer;
export const type = new ProtocolRequestType<
ChatEditParams,
ChatEditToken,
void,
ChatFeatureNotAvailableError | ChatEditDocumentTooLongError | ChatEditCommandTooLongError | ChatEditMutexError,
void
>(method);
}
export type ChatEditParams = {
/**
* The document location to edit.
*/
location: Location;
/**
* The command for this edit.
* If the command is a `preset` command, it should always start with "/".
* See {@link ChatEditCommand}
*/
command: string;
/**
* Select a edit format.
* - "previewChanges": The document will be edit to preview changes,
* use {@link ChatEditResolveRequest} to resolve it later.
*/
format: "previewChanges";
};
export type ChatEditToken = string;
export type ChatFeatureNotAvailableError = {
name: "ChatFeatureNotAvailableError";
};
export type ChatEditDocumentTooLongError = {
name: "ChatEditDocumentTooLongError";
};
export type ChatEditCommandTooLongError = {
name: "ChatEditCommandTooLongError";
};
export type ChatEditMutexError = {
name: "ChatEditMutexError";
};
/**
* [Tabby] Chat Edit Resolve Request(↩️)
*
* This method is sent from the client to the server to accept or discard the changes in preview.
* - method: `tabby/chat/edit/resolve`
* - params: {@link ChatEditResolveParams}
* - result: boolean
*/
export namespace ChatEditResolveRequest {
export const method = "tabby/chat/edit/resolve";
export const messageDirection = MessageDirection.clientToServer;
export const type = new ProtocolRequestType<ChatEditResolveParams, boolean, never, void, void>(method);
}
export type ChatEditResolveParams = {
/**
* The document location to resolve the changes, should locate at the header line of the changes preview.
*/
location: Location;
/**
* The action to take for this edit.
*/
action: "accept" | "discard" | "cancel";
};
/**
* [Tabby] Apply workspace edit request(↪️)
*
* This method is sent from the server to client to apply edit in workspace with options.
* - method: `tabby/workspace/applyEdit`
* - params: {@link ApplyWorkspaceEditParams}
* - result: boolean
*/
export namespace ApplyWorkspaceEditRequest {
export const method = "tabby/workspace/applyEdit";
export const messageDirection = MessageDirection.serverToClient;
export const type = new ProtocolRequestType<ApplyWorkspaceEditParams, boolean, never, void, void>(method);
}
export interface ApplyWorkspaceEditParams {
/**
* An optional label of the workspace edit. This label is
* presented in the user interface for example on an undo
* stack to undo the workspace edit.
*/
label?: string;
/**
* The edits to apply.
*/
edit: WorkspaceEdit;
options?: {
/**
* Add undo stop before making the edits.
*/
readonly undoStopBefore: boolean;
/**
* Add undo stop after making the edits.
*/
readonly undoStopAfter: boolean;
};
}
export type ChatEditResolveCommand = LspCommand & {
title: string;
tooltip?: string;
command: "tabby/chat/edit/resolve";
arguments: [ChatEditResolveParams];
};
/**
* [Tabby] Smart Apply Request(↩️)
*
* This method is sent from the client to the server to smart apply the text to the target location.
* The server will edit the document content using ApplyEdit(`workspace/applyEdit`) request,
* which requires the client to have this capability.
* - method: `tabby/chat/smartApply`
* - params: {@link SmartApplyParams}
* - result: boolean
* - error: {@link ChatFeatureNotAvailableError}
* | {@link ChatEditDocumentTooLongError}
* | {@link ChatEditMutexError}
*/
export namespace SmartApplyRequest {
export const method = "tabby/chat/smartApply";
export const messageDirection = MessageDirection.clientToServer;
export const type = new ProtocolRequestType<
SmartApplyParams,
boolean,
void,
ChatFeatureNotAvailableError | ChatEditDocumentTooLongError | ChatEditMutexError,
void
>(method);
}
export type SmartApplyParams = {
location: Location;
text: string;
};
/**
* [Tabby] Did Change Active Editor Notification(➡️)
*
* This method is sent from the client to server when the active editor changed.
*
*
* - method: `tabby/editors/didChangeActiveEditor`
* - params: {@link OpenedFileParams}
* - result: void
*/
export namespace DidChangeActiveEditorNotification {
export const method = "tabby/editors/didChangeActiveEditor";
export const messageDirection = MessageDirection.clientToServer;
export const type = new ProtocolNotificationType<DidChangeActiveEditorParams, void>(method);
}
export type DidChangeActiveEditorParams = {
activeEditor: Location;
visibleEditors: Location[] | undefined;
};
/**
* [Tabby] GenerateCommitMessage Request(↩️)
*
* This method is sent from the client to the server to generate a commit message for a git repository.
* - method: `tabby/chat/generateCommitMessage`
* - params: {@link GenerateCommitMessageParams}
* - result: {@link GenerateCommitMessageResult} | null
* - error: {@link ChatFeatureNotAvailableError}
*/
export namespace GenerateCommitMessageRequest {
export const method = "tabby/chat/generateCommitMessage";
export const messageDirection = MessageDirection.clientToServer;
export const type = new ProtocolRequestType<
GenerateCommitMessageParams,
GenerateCommitMessageResult | null,
void,
ChatFeatureNotAvailableError,
void
>(method);
}
export type GenerateCommitMessageParams = {
/**
* The root URI of the git repository.
*/
repository: URI;
};
export type GenerateCommitMessageResult = {
commitMessage: string;
};
/**
* [Tabby] Telemetry Event Notification(➡️)
*
* This method is sent from the client to the server for telemetry purposes.
* - method: `tabby/telemetry/event`
* - params: {@link EventParams}
* - result: void
*/
export namespace TelemetryEventNotification {
export const method = "tabby/telemetry/event";
export const messageDirection = MessageDirection.clientToServer;
export const type = new ProtocolNotificationType<EventParams, void>(method);
}
export type EventParams = {
type: "view" | "select" | "dismiss";
selectKind?: "line";
eventId: CompletionEventId;
viewId?: string;
elapsed?: number;
};
/**
* @deprecated See {@link StatusDidChangeNotification} {@link ConfigDidChangeNotification}
* [Tabby] DidUpdateServerInfo Notification(⬅️)
*
* This method is sent from the server to the client to notify the current Tabby server info has changed.
* - method: `tabby/agent/didUpdateServerInfo`
* - params: {@link DidUpdateServerInfoParams}
* - result: void
*/
export namespace AgentServerInfoSync {
export const method = "tabby/agent/didUpdateServerInfo";
export const messageDirection = MessageDirection.serverToClient;
export const type = new ProtocolNotificationType<DidUpdateServerInfoParams, void>(method);
}
/** @deprecated */
export type DidUpdateServerInfoParams = {
serverInfo: ServerInfo;
};
/** @deprecated */
export type ServerInfo = {
config: {
endpoint: string;
token: string | null;
requestHeaders: Record<string, string | number | boolean | null | undefined> | null;
};
health: Record<string, unknown> | null;
};
/**
* @deprecated See {@link StatusRequest} {@link ConfigRequest}
* [Tabby] Server Info Request(↩️)
*
* This method is sent from the client to the server to check the current Tabby server info.
* - method: `tabby/agent/serverInfo`
* - params: none
* - result: {@link ServerInfo}
*/
export namespace AgentServerInfoRequest {
export const method = "tabby/agent/serverInfo";
export const messageDirection = MessageDirection.clientToServer;
export const type = new ProtocolRequestType0<ServerInfo, never, void, void>(method);
}
/**
* @deprecated See {@link StatusDidChangeNotification}
* [Tabby] DidChangeStatus Notification(⬅️)
*
* This method is sent from the server to the client to notify the client about the status of the server.
* - method: `tabby/agent/didChangeStatus`
* - params: {@link DidChangeStatusParams}
* - result: void
*/
export namespace AgentStatusSync {
export const method = "tabby/agent/didChangeStatus";
export const messageDirection = MessageDirection.serverToClient;
export const type = new ProtocolNotificationType<DidChangeStatusParams, void>(method);
}
/** @deprecated */
export type DidChangeStatusParams = {
status: Status;
};
/** @deprecated */
export type Status = "notInitialized" | "ready" | "disconnected" | "unauthorized" | "finalized";
/**
* @deprecated See {@link StatusRequest}
* [Tabby] Status Request(↩️)
*
* This method is sent from the client to the server to check the current status of the server.
* - method: `tabby/agent/status`
* - params: none
* - result: {@link Status}
*/
export namespace AgentStatusRequest {
export const method = "tabby/agent/status";
export const messageDirection = MessageDirection.clientToServer;
export const type = new ProtocolRequestType0<Status, never, void, void>(method);
}
/**
* @deprecated See {@link StatusDidChangeNotification}
* [Tabby] DidUpdateIssue Notification(⬅️)
*
* This method is sent from the server to the client to notify the client about the current issues.
* - method: `tabby/agent/didUpdateIssues`
* - params: {@link DidUpdateIssueParams}
* - result: void
*/
export namespace AgentIssuesSync {
export const method = "tabby/agent/didUpdateIssues";
export const messageDirection = MessageDirection.serverToClient;
export const type = new ProtocolNotificationType<DidUpdateIssueParams, void>(method);
}
/** @deprecated */
export type DidUpdateIssueParams = IssueList;
/** @deprecated */
export type IssueList = {
issues: IssueName[];
};
/** @deprecated */
export type IssueName = "slowCompletionResponseTime" | "highCompletionTimeoutRate" | "connectionFailed";
/**
* @deprecated See {@link StatusRequest}
* [Tabby] Issues Request(↩️)
*
* This method is sent from the client to the server to check if there is any issue.
* - method: `tabby/agent/issues`
* - params: none
* - result: {@link IssueList}
*/
export namespace AgentIssuesRequest {
export const method = "tabby/agent/issues";
export const messageDirection = MessageDirection.clientToServer;
export const type = new ProtocolRequestType0<IssueList, never, void, void>(method);
}
/**
* @deprecated See {@link StatusShowHelpMessageRequest}
* [Tabby] Issue Detail Request(↩️)
*
* This method is sent from the client to the server to check the detail of an issue.
* - method: `tabby/agent/issue/detail`
* - params: {@link IssueDetailParams}
* - result: {@link IssueDetailResult} | null
*/
export namespace AgentIssueDetailRequest {
export const method = "tabby/agent/issue/detail";
export const messageDirection = MessageDirection.clientToServer;
export const type = new ProtocolRequestType<IssueDetailParams, IssueDetailResult | null, never, void, void>(method);
}
/** @deprecated */
export type IssueDetailParams = {
name: IssueName;
helpMessageFormat?: "plaintext" | "markdown" | "html";
};
/** @deprecated */
export type IssueDetailResult = {
name: IssueName;
helpMessage?: string;
};
/**
* [Tabby] Config Request(↩️)
*
* This method is sent from the client to the server to get the current configuration.
* - method: `tabby/config`
* - params: any, not used
* - result: {@link Config}
*/
export namespace ConfigRequest {
export const method = "tabby/config";
export const messageDirection = MessageDirection.clientToServer;
export const type = new ProtocolRequestType<LSPAny, Config, never, void, void>(method);
}
export type Config = {
server: {
endpoint: string;
token: string;
requestHeaders: Record<string, string | number | boolean | null | undefined>;
};
};
/**
* [Tabby] Config DidChange Notification(⬅️)
*
* This method is sent from the server to the client to notify the client of the configuration changes.
* - method: `tabby/config/didChange`
* - params: {@link Config}
* - result: void
*/
export namespace ConfigDidChangeNotification {
export const method = "tabby/config/didChange";
export const messageDirection = MessageDirection.serverToClient;
export const type = new ProtocolNotificationType<Config, void>(method);
}
/**
* [Tabby] Status Request(↩️)
*
* This method is sent from the client to the server to check the current status of the server.
* - method: `tabby/status`
* - params: {@link StatusRequestParams}
* - result: {@link StatusInfo}
*/
export namespace StatusRequest {
export const method = "tabby/status";
export const messageDirection = MessageDirection.clientToServer;
export const type = new ProtocolRequestType<StatusRequestParams, StatusInfo, never, void, void>(method);
}
export type StatusRequestParams = {
/**
* Forces a recheck of the connection to the Tabby server, and waiting for result.
*/
recheckConnection?: boolean;
};
/**
* [Tabby] StatusInfo is used to display the status bar in the editor.
*/
export type StatusInfo = {
status:
| "connecting"
| "unauthorized"
| "disconnected"
| "ready"
| "readyForAutoTrigger"
| "readyForManualTrigger"
| "fetching"
| "completionResponseSlow";
tooltip?: string;
/**
* The health information of the server if available.
*/
serverHealth?: Record<string, unknown>;
/**
* The action to take for this status.
* - `disconnected` or `completionResponseSlow` -> StatusShowHelpMessageCommand
* - others -> undefined
*/
command?: StatusShowHelpMessageCommand | LspCommand;
/**
* The help message if available.
* Only available when this status info is returned from {@link StatusRequest}, not provided in {@link StatusDidChangeNotification}.
* Only available when the status is `disconnected` or `completionResponseSlow`.
*/
helpMessage?: string;
};
/**
* [Tabby] Status DidChange Notification(⬅️)
*
* This method is sent from the server to the client to notify the client of the status changes.
* - method: `tabby/status/didChange`
* - params: {@link StatusInfo}
* - result: void
*/
export namespace StatusDidChangeNotification {
export const method = "tabby/status/didChange";
export const messageDirection = MessageDirection.serverToClient;
export const type = new ProtocolNotificationType<StatusInfo, void>(method);
}
/**
* [Tabby] Status Show Help Message Request(↩️)
*
* This method is sent from the client to the server to request to show the help message for the current status.
* The server will callback client to show request using ShowMessageRequest (`window/showMessageRequest`).
* - method: `tabby/status/showHelpMessage`
* - params: any, not used
* - result: boolean
*/
export namespace StatusShowHelpMessageRequest {
export const method = "tabby/status/showHelpMessage";
export const messageDirection = MessageDirection.clientToServer;
export const type = new ProtocolRequestType<LSPAny, boolean, never, void, void>(method);
}
export type StatusShowHelpMessageCommand = LspCommand & {
title: string;
command: "tabby/status/showHelpMessage";
arguments: [LSPAny];
};
/**
* [Tabby] Status Ignored Issues Edit Request(↩️)
*
* This method is sent from the client to the server to add or remove the issues that marked as ignored.
* - method: `tabby/status/ignoredIssues/edit`
* - params: {@link StatusIgnoredIssuesEditParams}
* - result: boolean
*/
export namespace StatusIgnoredIssuesEditRequest {
export const method = "tabby/status/ignoredIssues/edit";
export const messageDirection = MessageDirection.clientToServer;
export const type = new ProtocolRequestType<StatusIgnoredIssuesEditParams, boolean, never, void, void>(method);
}
export type StatusIssuesName = "completionResponseSlow";
export type StatusIgnoredIssuesEditParams = {
operation: "add" | "remove" | "removeAll";
issues: StatusIssuesName | StatusIssuesName[];
};
/**
* [Tabby] Read File Request(↪️)
*
* This method is sent from the server to the client to read the file contents.
* - method: `tabby/workspaceFileSystem/readFile`
* - params: {@link ReadFileParams}
* - result: {@link ReadFileResult} | null
*/
export namespace ReadFileRequest {
export const method = "tabby/workspaceFileSystem/readFile";
export const messageDirection = MessageDirection.serverToClient;
export const type = new ProtocolRequestType<ReadFileParams, ReadFileResult | null, never, void, void>(method);
}
export type ReadFileParams = {
uri: URI;
/**
* If `text` is select, the result should try to decode the file contents to string,
* otherwise, the result should be a raw binary array.
*/
format: "text";
/**
* When omitted, read the whole file.
*/
range?: Range;
};
export type ReadFileResult = {
/**
* If `text` is select, the result should be a string.
*/
text?: string;
};
/**
* @deprecated see {@link InitializationOptions} and {@link DataStoreDidUpdateNotification}
* [Tabby] DataStore Get Request(↪️)
*
* This method is sent from the server to the client to get the value of the given key.
* - method: `tabby/dataStore/get`
* - params: {@link DataStoreGetParams}
* - result: any
*/
export namespace DataStoreGetRequest {
export const method = "tabby/dataStore/get";
export const messageDirection = MessageDirection.serverToClient;
export const type = new ProtocolRequestType<DataStoreGetParams, any, never, void, void>(method);
}
/** @deprecated */
export type DataStoreGetParams = {
key: string;
};
/**
* @deprecated see {@link DataStoreUpdateRequest}
* [Tabby] DataStore Set Request(↪️)
*
* This method is sent from the server to the client to set the value of the given key.
* - method: `tabby/dataStore/set`
* - params: {@link DataStoreSetParams}
* - result: boolean
*/
export namespace DataStoreSetRequest {
export const method = "tabby/dataStore/set";
export const messageDirection = MessageDirection.serverToClient;
export const type = new ProtocolRequestType<DataStoreSetParams, boolean, never, void, void>(method);
}
/** @deprecated */
export type DataStoreSetParams = {
key: string;
value: any;