2 * Copyright (c) 2016, Facebook, Inc.
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the "hack" directory of this source tree.
16 type partial_result_token
= PartialResultToken
of string
18 module DocumentUri
= struct
20 type t
= Uri
of string [@@deriving eq
, ord
]
24 module Map
= WrappedMap.Make
(M
)
27 let uri_of_string (s
: string) : DocumentUri.t
= DocumentUri.Uri s
29 let string_of_uri (DocumentUri.Uri s
) : string = s
43 type textDocumentSaveReason
=
45 | AfterDelay
[@value 2]
49 module Location
= struct
57 module DefinitionLocation
= struct
65 | MarkedString
of string
66 | MarkedCode
of string * string
68 module Command
= struct
72 arguments
: Hh_json.json list
;
76 module TextEdit
= struct
83 module TextDocumentIdentifier
= struct
84 type t
= { uri
: DocumentUri.t
}
87 module VersionedTextDocumentIdentifier
= struct
94 module TextDocumentEdit
= struct
96 textDocument
: VersionedTextDocumentIdentifier.t
;
97 edits
: TextEdit.t list
;
101 module WorkspaceEdit
= struct
102 type t
= { changes
: TextEdit.t list
DocumentUri.Map.t
}
105 module TextDocumentItem
= struct
114 module CodeLens
= struct
118 data
: Hh_json.json
option;
122 module TextDocumentPositionParams
= struct
124 textDocument
: TextDocumentIdentifier.t
;
129 module DocumentFilter
= struct
131 language
: string option;
132 scheme
: string option;
133 pattern
: string option;
137 module DocumentSelector
= struct
138 type t
= DocumentFilter.t list
141 module SymbolInformation
= struct
145 | Namespace
[@value 3]
149 | Property
[@value 7]
151 | Constructor
[@value 9]
153 | Interface
[@value 11]
154 | Function
[@value 12]
155 | Variable
[@value 13]
156 | Constant
[@value 14]
159 | Boolean
[@value 17]
164 | EnumMember
[@value 22]
167 | Operator
[@value 25]
168 | TypeParameter
[@value 26]
174 location
: Location.t
;
175 detail
: string option;
176 containerName
: string option;
180 module CallHierarchyItem
= struct
183 kind
: SymbolInformation.symbolKind
;
184 detail
: string option;
187 selectionRange
: range
;
191 module CallHierarchyCallsRequestParam
= struct
192 type t
= { item
: CallHierarchyItem.t
}
195 module MessageType
= struct
197 | ErrorMessage
[@value 1]
198 | WarningMessage
[@value 2]
199 | InfoMessage
[@value 3]
200 | LogMessage
[@value 4]
201 [@@deriving eq
, enum
]
204 module CodeActionKind
= struct
205 (** CodeActionKind.t uses a pair to represent a non-empty list
206 and we provide utility functions for creation, membership, printing.*)
207 type t
= string * string list
209 let is_kind : t
-> t
-> bool =
210 let rec is_prefix_of ks xs
=
213 | (k
:: ks
, x
:: xs
) when String.equal k x
-> is_prefix_of ks xs
216 (fun (k
, ks
) (x
, xs
) -> String.equal k x
&& is_prefix_of ks xs
)
218 let contains_kind k ks
= List.exists ~f
:(is_kind k
) ks
220 let contains_kind_opt ~default k ks
=
222 | Some ks
-> contains_kind k ks
225 let kind_of_string : string -> t
=
227 match Stdlib.String.split_on_char '
.' s
with
228 | [] -> failwith
"split_on_char does not return an empty list"
231 let string_of_kind : t
-> string =
232 (fun (k
, ks
) -> String.concat ~sep
:"." (k
:: ks
))
234 let sub_kind : t
-> string -> t
=
235 let cons_to_end (ss
: string list
) (s
: string) =
236 Base.List.(fold_right ss ~f
:cons ~init
:[s
])
238 (fun (k
, ks
) s
-> (k
, cons_to_end ks s
))
240 let quickfix = kind_of_string "quickfix"
242 let refactor = kind_of_string "refactor"
244 let source = kind_of_string "source"
247 module CancelRequest
= struct
248 type params
= cancelParams
250 and cancelParams
= { id
: lsp_id
}
253 module SetTraceNotification
= struct
259 module Initialize
= struct
260 type textDocumentSyncKind
=
262 | FullSync
[@value 1]
263 | IncrementalSync
[@value 2]
266 module CodeActionOptions
= struct
267 type t
= { resolveProvider
: bool }
270 module CompletionOptions
= struct
272 resolveProvider
: bool;
273 completion_triggerCharacters
: string list
;
277 module ServerExperimentalCapabilities
= struct
279 snippetTextEdit
: bool;
284 module ClientExperimentalCapabilities
= struct
286 snippetTextEdit
: bool;
292 processId
: int option;
293 rootPath
: string option;
294 rootUri
: DocumentUri.t
option;
295 initializationOptions
: initializationOptions
;
296 client_capabilities
: client_capabilities
;
300 and result
= { server_capabilities
: server_capabilities
}
302 and errorData
= { retry
: bool }
309 and initializationOptions
= {
310 namingTableSavedStatePath
: string option;
311 namingTableSavedStateTestDelay
: float;
312 delayUntilDoneInit
: bool;
313 skipLspServerOnTypeFormatting
: bool;
316 and client_capabilities
= {
317 workspace
: workspaceClientCapabilities
;
318 textDocument
: textDocumentClientCapabilities
;
319 window
: windowClientCapabilities
;
320 telemetry
: telemetryClientCapabilities
;
321 client_experimental
: ClientExperimentalCapabilities.t
;
324 and workspaceClientCapabilities
= {
326 workspaceEdit
: workspaceEdit
;
327 didChangeWatchedFiles
: dynamicRegistration
;
330 and dynamicRegistration
= { dynamicRegistration
: bool }
332 and workspaceEdit
= { documentChanges
: bool }
334 and textDocumentClientCapabilities
= {
335 synchronization
: synchronization
;
336 completion
: completion
;
337 codeAction
: codeAction
;
338 definition
: definition
;
339 typeDefinition
: typeDefinition
;
340 declaration
: declaration
;
341 implementation
: implementation
;
344 and synchronization
= {
346 can_willSaveWaitUntil
: bool;
350 and completion
= { completionItem
: completionItem
}
352 and completionItem
= { snippetSupport
: bool }
355 codeAction_dynamicRegistration
: bool;
356 codeActionLiteralSupport
: codeActionliteralSupport
option;
359 and definition
= { definitionLinkSupport
: bool }
361 and typeDefinition
= { typeDefinitionLinkSupport
: bool }
363 and declaration
= { declarationLinkSupport
: bool }
365 and implementation
= { implementationLinkSupport
: bool }
367 and codeActionliteralSupport
= { codeAction_valueSet
: CodeActionKind.t list
}
369 and windowClientCapabilities
= { status
: bool }
371 and telemetryClientCapabilities
= { connectionStatus
: bool }
373 and server_capabilities
= {
374 textDocumentSync
: textDocumentSyncOptions
;
376 completionProvider
: CompletionOptions.t
option;
377 signatureHelpProvider
: signatureHelpOptions
option;
378 definitionProvider
: bool;
379 typeDefinitionProvider
: bool;
380 referencesProvider
: bool;
381 callHierarchyProvider
: bool;
382 documentHighlightProvider
: bool;
383 documentSymbolProvider
: bool;
384 workspaceSymbolProvider
: bool;
385 codeActionProvider
: CodeActionOptions.t
option;
386 codeLensProvider
: codeLensOptions
option;
387 documentFormattingProvider
: bool;
388 documentRangeFormattingProvider
: bool;
389 documentOnTypeFormattingProvider
: documentOnTypeFormattingOptions
option;
390 renameProvider
: bool;
391 documentLinkProvider
: documentLinkOptions
option;
392 executeCommandProvider
: executeCommandOptions
option;
393 implementationProvider
: bool;
394 rageProviderFB
: bool; (** Nuclide-specific feature *)
395 server_experimental
: ServerExperimentalCapabilities.t
option;
398 and signatureHelpOptions
= { sighelp_triggerCharacters
: string list
}
400 and codeLensOptions
= { codelens_resolveProvider
: bool }
402 and documentOnTypeFormattingOptions
= {
403 firstTriggerCharacter
: string;
404 moreTriggerCharacter
: string list
;
407 and documentLinkOptions
= { doclink_resolveProvider
: bool }
409 and executeCommandOptions
= { commands
: string list
}
411 and textDocumentSyncOptions
= {
412 want_openClose
: bool;
413 want_change
: textDocumentSyncKind
;
415 want_willSaveWaitUntil
: bool;
416 want_didSave
: saveOptions
option;
419 and saveOptions
= { includeText
: bool }
422 module Error
= struct
424 | ParseError
[@value -32700]
425 | InvalidRequest
[@value -32600]
426 | MethodNotFound
[@value -32601]
427 | InvalidParams
[@value -32602]
428 | InternalError
[@value -32603]
429 | ServerErrorStart
[@value -32099]
430 | ServerErrorEnd
[@value -32000]
431 | ServerNotInitialized
[@value -32002]
432 | UnknownErrorCode
[@value -32001]
433 | RequestCancelled
[@value -32800]
434 | ContentModified
[@value -32801]
435 [@@deriving show
{ with_path
= false }, enum
]
440 data
: Hh_json.json
option;
443 exception LspException
of t
446 module RageFB
= struct
447 type result
= rageItem list
450 title
: string option;
455 module CodeLensResolve
= struct
456 type params
= CodeLens.t
458 and result
= CodeLens.t
461 module Hover
= struct
462 type params
= TextDocumentPositionParams.t
464 and result
= hoverResult
option
467 contents
: markedString list
;
472 module PublishDiagnostics
= struct
473 type diagnosticSeverity
=
476 | Information
[@value 3]
478 [@@deriving eq
, enum
]
480 type params
= publishDiagnosticsParams
482 and publishDiagnosticsParams
= {
484 diagnostics
: diagnostic list
;
490 severity
: diagnosticSeverity
option;
491 code
: diagnosticCode
;
492 source: string option;
494 relatedInformation
: diagnosticRelatedInformation list
;
495 relatedLocations
: relatedLocation list
;
501 | StringCode
of string
505 and diagnosticRelatedInformation
= {
506 relatedLocation
: Location.t
;
507 relatedMessage
: string;
511 and relatedLocation
= diagnosticRelatedInformation
514 module DidOpen
= struct
515 type params
= didOpenTextDocumentParams
517 and didOpenTextDocumentParams
= { textDocument
: TextDocumentItem.t
}
520 module DidClose
= struct
521 type params
= didCloseTextDocumentParams
523 and didCloseTextDocumentParams
= { textDocument
: TextDocumentIdentifier.t
}
526 module DidSave
= struct
527 type params
= didSaveTextDocumentParams
529 and didSaveTextDocumentParams
= {
530 textDocument
: TextDocumentIdentifier.t
;
535 module DidChange
= struct
536 type params
= didChangeTextDocumentParams
538 and didChangeTextDocumentParams
= {
539 textDocument
: VersionedTextDocumentIdentifier.t
;
540 contentChanges
: textDocumentContentChangeEvent list
;
543 and textDocumentContentChangeEvent
= {
545 rangeLength
: int option;
550 module WillSaveWaitUntil
= struct
551 type params
= willSaveWaitUntilTextDocumentParams
553 and willSaveWaitUntilTextDocumentParams
= {
554 textDocument
: TextDocumentIdentifier.t
;
555 reason
: textDocumentSaveReason
;
558 and result
= TextEdit.t list
561 module DidChangeWatchedFiles
= struct
562 type registerOptions
= { watchers
: fileSystemWatcher list
}
564 and fileSystemWatcher
= { globPattern
: string }
566 type fileChangeType
=
572 type params
= { changes
: fileEvent list
}
576 type_
: fileChangeType
;
580 module Definition
= struct
581 type params
= TextDocumentPositionParams.t
583 and result
= DefinitionLocation.t list
586 module TypeDefinition
= struct
587 type params
= TextDocumentPositionParams.t
589 and result
= DefinitionLocation.t list
592 module Implementation
= struct
593 type params
= TextDocumentPositionParams.t
595 and result
= Location.t list
598 (* textDocument/codeAction and codeAction/resolve *)
599 module CodeAction
= struct
602 kind
: CodeActionKind.t
;
603 diagnostics
: PublishDiagnostics.diagnostic list
;
604 action
: 'a edit_and_or_command
;
607 and 'a edit_and_or_command
=
608 | EditOnly
of WorkspaceEdit.t
609 | CommandOnly
of Command.t
610 | BothEditThenCommand
of (WorkspaceEdit.t
* Command.t
)
611 | UnresolvedEdit
of 'a
612 (** UnresolvedEdit is for this flow:
613 client --textDocument/codeAction --> server --response_with_unresolved_fields-->
614 client --codeAction/resolve --> server --response_with_all_fields--> client
617 type 'a command_or_action_
=
618 | Command
of Command.t
621 type resolved_marker
= |
623 type resolved_command_or_action
= resolved_marker command_or_action_
625 type command_or_action
= unit command_or_action_
627 type result
= command_or_action list
630 module CodeActionRequest
= struct
632 textDocument
: TextDocumentIdentifier.t
;
634 context
: codeActionContext
;
637 and codeActionContext
= {
638 diagnostics
: PublishDiagnostics.diagnostic list
;
639 only
: CodeActionKind.t list
option;
643 module CodeActionResolve
= struct
644 type result
= (CodeAction.resolved_command_or_action
, Error.t
) Result.t
647 (** method="codeAction/resolve" *)
648 module CodeActionResolveRequest
= struct
650 data
: CodeActionRequest.params
;
655 (* Completion request, method="textDocument/completion" *)
656 module Completion
= struct
657 type completionItemKind
=
660 | Function
[@value 3]
661 | Constructor
[@value 4]
663 | Variable
[@value 6]
665 | Interface
[@value 8]
667 | Property
[@value 10]
671 | Keyword
[@value 14]
672 | Snippet
[@value 15]
675 | Reference
[@value 18]
677 | MemberOf
[@value 20]
678 | Constant
[@value 21]
681 | Operator
[@value 24]
682 | TypeParameter
[@value 25]
685 type insertTextFormat
=
686 | PlainText
[@value 1]
687 | SnippetFormat
[@value 2]
690 type completionTriggerKind
=
692 | TriggerCharacter
[@value 2]
693 | TriggerForIncompleteCompletions
[@value 3]
696 let is_invoked = function
699 | TriggerForIncompleteCompletions
->
702 type params
= completionParams
704 and completionParams
= {
705 loc
: TextDocumentPositionParams.t
;
706 context
: completionContext
option;
709 and completionContext
= {
710 triggerKind
: completionTriggerKind
;
711 triggerCharacter
: string option;
714 and result
= completionList
716 and completionList
= {
718 items
: completionItem list
;
721 and completionDocumentation
=
722 | MarkedStringsDocumentation
of markedString list
723 | UnparsedDocumentation
of Hh_json.json
725 and completionItem
= {
727 kind
: completionItemKind
option;
728 detail
: string option;
729 documentation
: completionDocumentation
option;
730 sortText
: string option;
731 filterText
: string option;
732 insertText
: string option;
733 insertTextFormat
: insertTextFormat
option;
734 textEdit
: TextEdit.t
option;
735 additionalTextEdits
: TextEdit.t list
;
736 command
: Command.t
option;
737 data
: Hh_json.json
option;
741 module CompletionItemResolve
= struct
742 type params
= Completion.completionItem
744 and result
= Completion.completionItem
747 module WorkspaceSymbol
= struct
748 type params
= workspaceSymbolParams
750 and result
= SymbolInformation.t list
752 and workspaceSymbolParams
= { query
: string (** a non-empty query string *) }
755 module DocumentSymbol
= struct
756 type params
= documentSymbolParams
758 and result
= SymbolInformation.t list
760 and documentSymbolParams
= { textDocument
: TextDocumentIdentifier.t
}
763 module FindReferences
= struct
764 type params
= referenceParams
766 and result
= Location.t list
768 and referenceParams
= {
769 loc
: TextDocumentPositionParams.t
;
770 context
: referenceContext
;
771 partialResultToken
: partial_result_token
option;
774 and referenceContext
= {
775 includeDeclaration
: bool;
776 includeIndirectReferences
: bool;
780 module PrepareCallHierarchy
= struct
781 type params
= TextDocumentPositionParams.t
783 type result
= CallHierarchyItem.t list
option
786 module CallHierarchyIncomingCalls
= struct
787 type params
= CallHierarchyCallsRequestParam.t
789 type result
= callHierarchyIncomingCall list
option
791 and callHierarchyIncomingCall
= {
792 from
: CallHierarchyItem.t
;
793 fromRanges
: range list
;
797 module CallHierarchyOutgoingCalls
= struct
798 type params
= CallHierarchyCallsRequestParam.t
800 type result
= callHierarchyOutgoingCall list
option
802 and callHierarchyOutgoingCall
= {
803 call_to
: CallHierarchyItem.t
;
804 fromRanges
: range list
;
808 module DocumentHighlight
= struct
809 type params
= TextDocumentPositionParams.t
811 type documentHighlightKind
=
817 type result
= documentHighlight list
819 and documentHighlight
= {
821 kind
: documentHighlightKind
option;
825 module DocumentFormatting
= struct
826 type params
= documentFormattingParams
828 and result
= TextEdit.t list
830 and documentFormattingParams
= {
831 textDocument
: TextDocumentIdentifier.t
;
832 options
: formattingOptions
;
835 and formattingOptions
= {
841 module DocumentRangeFormatting
= struct
842 type params
= documentRangeFormattingParams
844 and result
= TextEdit.t list
846 and documentRangeFormattingParams
= {
847 textDocument
: TextDocumentIdentifier.t
;
849 options
: DocumentFormatting.formattingOptions
;
853 (** Document On Type Formatting req., method="textDocument/onTypeFormatting" *)
854 module DocumentOnTypeFormatting
= struct
855 type params
= documentOnTypeFormattingParams
857 and result
= TextEdit.t list
859 and documentOnTypeFormattingParams
= {
860 textDocument
: TextDocumentIdentifier.t
;
863 options
: DocumentFormatting.formattingOptions
;
867 module SignatureHelp
= struct
868 type params
= TextDocumentPositionParams.t
870 and result
= t
option
873 signatures
: signature_information list
;
874 activeSignature
: int;
875 activeParameter
: int;
878 and signature_information
= {
879 siginfo_label
: string;
880 siginfo_documentation
: string option;
881 parameters
: parameter_information list
;
884 and parameter_information
= {
885 parinfo_label
: string;
886 parinfo_documentation
: string option;
890 (** Auto close tag request, method="flow/autoCloseJsx"
891 This is a non-standard LSP extension. *)
892 module AutoCloseJsx
= struct
893 type params
= TextDocumentPositionParams.t
895 and result
= string option
898 (* Workspace Rename request, method="textDocument/rename" *)
899 module Rename
= struct
900 type params
= renameParams
902 and result
= WorkspaceEdit.t
905 textDocument
: TextDocumentIdentifier.t
;
911 (** Code Lens request, method="textDocument/codeLens" *)
912 module DocumentCodeLens
= struct
913 type params
= codelensParams
915 and result
= CodeLens.t list
917 and codelensParams
= { textDocument
: TextDocumentIdentifier.t
}
920 module LogMessage
= struct
921 type params
= logMessageParams
923 and logMessageParams
= {
924 type_
: MessageType.t
;
929 module ShowMessage
= struct
930 type params
= showMessageParams
932 and showMessageParams
= {
933 type_
: MessageType.t
;
938 module ShowMessageRequest
= struct
940 | Present
of { id
: lsp_id
}
943 and params
= showMessageRequestParams
945 and result
= messageActionItem
option
947 and showMessageRequestParams
= {
948 type_
: MessageType.t
;
950 actions
: messageActionItem list
;
953 and messageActionItem
= { title
: string }
956 module ShowStatusFB
= struct
957 type params
= showStatusParams
961 (** the showStatus LSP request will be handled by our VSCode extension.
962 It's a facebook-specific extension to the LSP spec. How it's rendered
963 is currently [shortMessage] in the status-bar, and "[progress]/[total] [message]"
964 in the tooltip. The [telemetry] field isn't displayed to the user, but might
965 be useful to someone debugging an LSP transcript. *)
966 and showStatusParams
= {
967 request
: showStatusRequestParams
;
968 progress
: int option;
970 shortMessage
: string option;
971 telemetry
: Hh_json.json
option;
974 and showStatusRequestParams
= {
975 type_
: MessageType.t
;
980 module ConnectionStatusFB
= struct
981 type params
= connectionStatusParams
983 and connectionStatusParams
= { isConnected
: bool }
986 type lsp_registration_options
=
987 | DidChangeWatchedFilesRegistrationOptions
of
988 DidChangeWatchedFiles.registerOptions
990 module RegisterCapability
= struct
991 type params
= { registrations
: registration list
}
996 registerOptions
: lsp_registration_options
;
999 let make_registration (registerOptions
: lsp_registration_options
) :
1002 match registerOptions
with
1003 | DidChangeWatchedFilesRegistrationOptions _
->
1004 ("did-change-watched-files", "workspace/didChangeWatchedFiles")
1006 { id
; method_
; registerOptions
}
1010 * Here are gathered-up ADTs for all the messages we handle
1014 | InitializeRequest
of Initialize.params
1015 | RegisterCapabilityRequest
of RegisterCapability.params
1017 | CodeLensResolveRequest
of CodeLensResolve.params
1018 | HoverRequest
of Hover.params
1019 | DefinitionRequest
of Definition.params
1020 | TypeDefinitionRequest
of TypeDefinition.params
1021 | ImplementationRequest
of Implementation.params
1022 | CodeActionRequest
of CodeActionRequest.params
1023 | CodeActionResolveRequest
of CodeActionResolveRequest.params
1024 | CompletionRequest
of Completion.params
1025 | CompletionItemResolveRequest
of CompletionItemResolve.params
1026 | WorkspaceSymbolRequest
of WorkspaceSymbol.params
1027 | DocumentSymbolRequest
of DocumentSymbol.params
1028 | FindReferencesRequest
of FindReferences.params
1029 | PrepareCallHierarchyRequest
of PrepareCallHierarchy.params
1030 | CallHierarchyIncomingCallsRequest
of CallHierarchyIncomingCalls.params
1031 | CallHierarchyOutgoingCallsRequest
of CallHierarchyOutgoingCalls.params
1032 | DocumentHighlightRequest
of DocumentHighlight.params
1033 | DocumentFormattingRequest
of DocumentFormatting.params
1034 | DocumentRangeFormattingRequest
of DocumentRangeFormatting.params
1035 | DocumentOnTypeFormattingRequest
of DocumentOnTypeFormatting.params
1036 | ShowMessageRequestRequest
of ShowMessageRequest.params
1037 | ShowStatusRequestFB
of ShowStatusFB.params
1039 | RenameRequest
of Rename.params
1040 | DocumentCodeLensRequest
of DocumentCodeLens.params
1041 | SignatureHelpRequest
of SignatureHelp.params
1042 | AutoCloseRequest
of AutoCloseJsx.params
1043 | HackTestStartServerRequestFB
1044 | HackTestStopServerRequestFB
1045 | HackTestShutdownServerlessRequestFB
1046 | WillSaveWaitUntilRequest
of WillSaveWaitUntil.params
1047 | UnknownRequest
of string * Hh_json.json
option
1050 | InitializeResult
of Initialize.result
1052 | CodeLensResolveResult
of CodeLensResolve.result
1053 | HoverResult
of Hover.result
1054 | DefinitionResult
of Definition.result
1055 | TypeDefinitionResult
of TypeDefinition.result
1056 | ImplementationResult
of Implementation.result
1057 | CodeActionResult
of CodeAction.result
* CodeActionRequest.params
1058 | CodeActionResolveResult
of CodeActionResolve.result
1059 | CompletionResult
of Completion.result
1060 | CompletionItemResolveResult
of CompletionItemResolve.result
1061 | WorkspaceSymbolResult
of WorkspaceSymbol.result
1062 | DocumentSymbolResult
of DocumentSymbol.result
1063 | FindReferencesResult
of FindReferences.result
1064 | PrepareCallHierarchyResult
of PrepareCallHierarchy.result
1065 | CallHierarchyIncomingCallsResult
of CallHierarchyIncomingCalls.result
1066 | CallHierarchyOutgoingCallsResult
of CallHierarchyOutgoingCalls.result
1067 | DocumentHighlightResult
of DocumentHighlight.result
1068 | DocumentFormattingResult
of DocumentFormatting.result
1069 | DocumentRangeFormattingResult
of DocumentRangeFormatting.result
1070 | DocumentOnTypeFormattingResult
of DocumentOnTypeFormatting.result
1071 | ShowMessageRequestResult
of ShowMessageRequest.result
1072 | ShowStatusResultFB
of ShowStatusFB.result
1073 | RageResultFB
of RageFB.result
1074 | RenameResult
of Rename.result
1075 | DocumentCodeLensResult
of DocumentCodeLens.result
1076 | SignatureHelpResult
of SignatureHelp.result
1077 | AutoCloseResult
of AutoCloseJsx.result
1078 | HackTestStartServerResultFB
1079 | HackTestStopServerResultFB
1080 | HackTestShutdownServerlessResultFB
1081 | RegisterCapabilityRequestResult
1082 | WillSaveWaitUntilResult
of WillSaveWaitUntil.result
1083 | ErrorResult
of Error.t
1085 type lsp_notification
=
1087 | CancelRequestNotification
of CancelRequest.params
1088 | PublishDiagnosticsNotification
of PublishDiagnostics.params
1089 | DidOpenNotification
of DidOpen.params
1090 | DidCloseNotification
of DidClose.params
1091 | DidSaveNotification
of DidSave.params
1092 | DidChangeNotification
of DidChange.params
1093 | DidChangeWatchedFilesNotification
of DidChangeWatchedFiles.params
1094 | LogMessageNotification
of LogMessage.params
1095 | TelemetryNotification
of LogMessage.params
* (string * Hh_json.json
) list
1096 | ShowMessageNotification
of ShowMessage.params
1097 | ConnectionStatusNotificationFB
of ConnectionStatusFB.params
1098 | InitializedNotification
1099 | FindReferencesPartialResultNotification
of
1100 partial_result_token
* FindReferences.result
1101 | SetTraceNotification
of SetTraceNotification.params
1102 | LogTraceNotification
1103 | UnknownNotification
of string * Hh_json.json
option
1106 | RequestMessage
of lsp_id
* lsp_request
1107 | ResponseMessage
of lsp_id
* lsp_result
1108 | NotificationMessage
of lsp_notification
1110 type 'a lsp_handler
= 'a lsp_result_handler
* 'a lsp_error_handler
1112 and 'a lsp_error_handler
= Error.t
* string -> 'a
-> 'a
1114 and 'a lsp_result_handler
=
1115 | ShowMessageHandler
of (ShowMessageRequest.result
-> 'a
-> 'a
)
1116 | ShowStatusHandler
of (ShowStatusFB.result
-> 'a
-> 'a
)
1118 module IdKey
= struct
1121 let compare (x
: t
) (y
: t
) =
1123 | (NumberId x
, NumberId y
) -> x
- y
1124 | (NumberId _
, StringId _
) -> -1
1125 | (StringId x
, StringId y
) -> String.compare x y
1126 | (StringId _
, NumberId _
) -> 1
1129 module IdSet
= Stdlib.Set.Make
(IdKey
)
1130 module IdMap
= WrappedMap.Make
(IdKey
)
1132 module UriKey
= struct
1133 type t
= DocumentUri.t
1135 let compare (DocumentUri.Uri x
) (DocumentUri.Uri y
) = String.compare x y
1138 module UriSet
= Stdlib.Set.Make
(UriKey
)
1139 module UriMap
= WrappedMap.Make
(UriKey
)
1141 let lsp_result_to_log_string = function
1142 | InitializeResult _
-> "InitializeResult"
1143 | ShutdownResult
-> "ShutdownResult"
1144 | CodeLensResolveResult _
-> "CodeLensResolveResult"
1145 | HoverResult _
-> "HoverResult"
1146 | DefinitionResult _
-> "DefinitionResult"
1147 | TypeDefinitionResult _
-> "TypeDefinitionResult"
1148 | ImplementationResult _
-> "ImplementationResult"
1149 | CodeActionResult _
-> "CodeActionResult"
1150 | CodeActionResolveResult _
-> "CodeActionResolveResult"
1151 | CompletionResult _
-> "CompletionResult"
1152 | CompletionItemResolveResult _
-> "CompletionItemResolveResult"
1153 | WorkspaceSymbolResult _
-> "WorkspaceSymbolResult"
1154 | DocumentSymbolResult _
-> "DocumentSymbolResult"
1155 | FindReferencesResult _
-> "FindReferencesResult"
1156 | PrepareCallHierarchyResult _
-> "PrepareCallHierarchyResult"
1157 | CallHierarchyIncomingCallsResult _
-> "CallHierarchyIncomingCallsResult"
1158 | CallHierarchyOutgoingCallsResult _
-> "CallHierarchyOutgoingCallsResult"
1159 | DocumentHighlightResult _
-> "DocumentHighlightResult"
1160 | DocumentFormattingResult _
-> "DocumentFormattingResult"
1161 | DocumentRangeFormattingResult _
-> "DocumentRangeFormattingResult"
1162 | DocumentOnTypeFormattingResult _
-> "DocumentOnTypeFormattingResult"
1163 | ShowMessageRequestResult _
-> "ShowMessageRequestResult"
1164 | ShowStatusResultFB _
-> "ShowStatusResultFB"
1165 | RageResultFB _
-> "RageResultFB"
1166 | RenameResult _
-> "RenameResult"
1167 | DocumentCodeLensResult _
-> "DocumentCodeLensResult"
1168 | SignatureHelpResult _
-> "SignatureHelpResult"
1169 | HackTestStartServerResultFB
-> "HackTestStartServerResultFB"
1170 | HackTestStopServerResultFB
-> "HackTestStopServerResultFB"
1171 | HackTestShutdownServerlessResultFB
-> "HackTestShutdownServerlessResultFB"
1172 | RegisterCapabilityRequestResult
-> "RegisterCapabilityRequestResult"
1173 | WillSaveWaitUntilResult _
-> "WillSaveWaitUntilResult"
1174 | ErrorResult _
-> "ErrorResult"
1175 | AutoCloseResult _
-> "AutoCloseResult"