@@ -844,22 +844,35 @@ let do_initialize params : Initialize.result =
844
844
server_info = { name = " Flow" ; version = Flow_version. version };
845
845
}
846
846
847
+ let message_with_flow_and_root_name_prefix flowconfig msg =
848
+ match FlowConfig. root_name flowconfig with
849
+ | None -> " Flow: " ^ msg
850
+ | Some root -> " Flow (" ^ root ^ " ): " ^ msg
851
+
847
852
let show_connected_status (cenv : connected_env ) : connected_env =
853
+ let message_with_prefix = message_with_flow_and_root_name_prefix cenv.c_ienv.i_flowconfig in
848
854
let (type_, message, shortMessage, progress, total) =
849
855
if cenv.c_is_rechecking then
850
856
let (server_status, _) = cenv.c_server_status in
851
857
if not (ServerStatus. is_free server_status) then
852
858
let (shortMessage, progress, total) = ServerStatus. get_progress server_status in
853
- let message = " Flow: " ^ ServerStatus. string_of_status ~use_emoji: false server_status in
854
- (MessageType. WarningMessage , message, shortMessage, progress, total)
859
+ let message =
860
+ message_with_prefix @@ ServerStatus. string_of_status ~use_emoji: false server_status
861
+ in
862
+ ( MessageType. WarningMessage ,
863
+ message,
864
+ Base.Option. map ~f: message_with_prefix shortMessage,
865
+ progress,
866
+ total
867
+ )
855
868
else
856
- (MessageType. WarningMessage , " Flow: Server is rechecking..." , None , None , None )
869
+ (MessageType. WarningMessage , message_with_prefix " Server is rechecking..." , None , None , None )
857
870
else
858
871
let (_, watcher_status) = cenv.c_server_status in
859
872
match watcher_status with
860
873
| Some (_ , FileWatcherStatus. Deferred { reason } ) ->
861
874
let message = Printf. sprintf " Waiting for %s to finish" reason in
862
- let short_message = Some " Flow: blocked" in
875
+ let short_message = Some (message_with_prefix " blocked" ) in
863
876
(MessageType. WarningMessage , message, short_message, None , None )
864
877
| Some (_, FileWatcherStatus. Initializing )
865
878
| Some (_, FileWatcherStatus. Ready )
@@ -875,7 +888,7 @@ let show_connected_status (cenv : connected_env) : connected_env =
875
888
" https://flow.org/en/docs/lang/lazy-modes/"
876
889
| _ -> " Flow is ready."
877
890
in
878
- let short_message = Some " Flow: ready" in
891
+ let short_message = Some (message_with_prefix " ready" ) in
879
892
(MessageType. InfoMessage , message, short_message, None , None )
880
893
in
881
894
let c_ienv = show_status ~type_ ~message ~short Message ~progress ~total cenv.c_ienv in
@@ -900,26 +913,30 @@ let show_connecting (reason : CommandConnectSimple.error) (env : disconnected_en
900
913
Lsp_writers. log_info to_stdout " Starting Flow server" ;
901
914
902
915
let (message, shortMessage, progress, total) =
916
+ let message_with_prefix = message_with_flow_and_root_name_prefix env.d_ienv.i_flowconfig in
903
917
match (reason, env.d_server_status) with
904
- | (CommandConnectSimple. Server_missing, _ ) -> (" Flow: Server starting" , None , None , None )
905
- | (CommandConnectSimple. Server_socket_missing, _ ) -> (" Flow: Server starting?" , None , None , None )
918
+ | (CommandConnectSimple. Server_missing, _ ) ->
919
+ (message_with_prefix " Server starting" , None , None , None )
920
+ | (CommandConnectSimple. Server_socket_missing, _ ) ->
921
+ (message_with_prefix " Server starting?" , None , None , None )
906
922
| (CommandConnectSimple. (Build_id_mismatch Server_exited), _ ) ->
907
- (" Flow: Server was wrong version and exited" , None , None , None )
923
+ (message_with_prefix " Server was wrong version and exited" , None , None , None )
908
924
| (CommandConnectSimple. (Build_id_mismatch (Client_should_error _ )), _ ) ->
909
- (" Flow: Server is wrong version" , None , None , None )
925
+ (message_with_prefix " Server is wrong version" , None , None , None )
910
926
| (CommandConnectSimple. Server_busy CommandConnectSimple. Too_many_clients, _ ) ->
911
- (" Flow: Server busy" , None , None , None )
912
- | (CommandConnectSimple. Server_busy _ , None) -> (" Flow: Server busy" , None , None , None )
927
+ (message_with_prefix " Server busy" , None , None , None )
928
+ | (CommandConnectSimple. Server_busy _ , None) ->
929
+ (message_with_prefix " Server busy" , None , None , None )
913
930
| (CommandConnectSimple. Server_busy _ , Some (server_status , watcher_status )) ->
914
931
if not (ServerStatus. is_free server_status) then
915
932
let (shortMessage, progress, total) = ServerStatus. get_progress server_status in
916
- ( " Flow: " ^ ServerStatus. string_of_status ~use_emoji: false server_status,
933
+ ( message_with_prefix @@ ServerStatus. string_of_status ~use_emoji: false server_status,
917
934
shortMessage,
918
935
progress,
919
936
total
920
937
)
921
938
else
922
- (" Flow: " ^ FileWatcherStatus. string_of_status watcher_status, None , None , None )
939
+ (message_with_prefix @@ FileWatcherStatus. string_of_status watcher_status, None , None , None )
923
940
in
924
941
let d_ienv =
925
942
show_status ~type_: MessageType. WarningMessage ~message ~short Message ~progress ~total env.d_ienv
@@ -937,8 +954,9 @@ let show_disconnected (code : FlowExit.t option) (message : string option) (env
937
954
false
938
955
in
939
956
let env = { env with d_ienv = { env.d_ienv with i_isConnected } } in
957
+ let message_with_prefix = message_with_flow_and_root_name_prefix env.d_ienv.i_flowconfig in
940
958
(* show red status *)
941
- let message = Base.Option. value message ~default: " Flow: server is stopped" in
959
+ let message = Base.Option. value message ~default: (message_with_prefix " server is stopped" ) in
942
960
let message =
943
961
match code with
944
962
| Some code -> Printf. sprintf " %s [%s]" message (FlowExit. to_string code)
@@ -1864,7 +1882,11 @@ let try_connect ~version_mismatch_strategy flowconfig_name (env : disconnected_e
1864
1882
else
1865
1883
(* We shouldn't hit this case. When `env.d_autostart` is `false`, we ask the server NOT to
1866
1884
* die on a version mismatch. *)
1867
- let msg = " Flow: the server was the wrong version" in
1885
+ let msg =
1886
+ message_with_flow_and_root_name_prefix
1887
+ env.d_ienv.i_flowconfig
1888
+ " the server was the wrong version"
1889
+ in
1868
1890
show_disconnected None (Some msg) { env with d_server_status = None }
1869
1891
(* The server and the lsp are different binaries and can't talk to each other. The server is not
1870
1892
stopping (either because we asked it not to stop or because it is newer than this client). In
0 commit comments