From 645ca075b507abea3a28a72dd45c8ead4b868b28 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Fri, 15 Jan 2021 17:43:01 -0800 Subject: [PATCH] fix(extension/#2640): Elm - Fix diagnostic display (#2999) __Issue:__ Diagnostics weren't displaying in the elm extension __Defect:__ Diagnostics are computed on save, but we weren't sending the appropriate event to the extension host to let it know when a save occurred. __Fix:__ Notify extension host on save With that, we get diagnostics: ![image](https://user-images.githubusercontent.com/13532591/104788805-02225b80-5748-11eb-819b-2f5dc06b2b6d.png) Fixes #2640 Related #1058 --- CHANGES_CURRENT.md | 1 + src/Service/Exthost/Service_Exthost.re | 7 +++++++ src/Service/Exthost/Service_Exthost.rei | 4 ++++ src/Store/Features.re | 8 +++++++- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGES_CURRENT.md b/CHANGES_CURRENT.md index 7395ec1ec5..393464f977 100644 --- a/CHANGES_CURRENT.md +++ b/CHANGES_CURRENT.md @@ -59,6 +59,7 @@ - #2993 - CodeLens: Handle null command id & label icons - #2997 - Syntax: Fix regression in syntax highlighting for PHP (fixes #2985) - #2995 - Extensions: Fix bug with 3-param http/https request (fixes #2981) +- #2999 - Extensions: Elm - fix bug with diagnostics not displaying (fixes #2640) ### Performance diff --git a/src/Service/Exthost/Service_Exthost.re b/src/Service/Exthost/Service_Exthost.re index f8af55dd45..b9f0a26e29 100644 --- a/src/Service/Exthost/Service_Exthost.re +++ b/src/Service/Exthost/Service_Exthost.re @@ -70,6 +70,13 @@ module Effects = { dispatch(toMsg()); }) ); + + let modelSaved = (~uri, client, toMsg) => { + Isolinear.Effect.createWithDispatch(~name="exthost.modelSaved", dispatch => { + Exthost.Request.Documents.acceptModelSaved(~uri, client); + dispatch(toMsg()); + }); + }; }; module FileSystemEventService = { let onFileEvent = (~events, extHostClient) => diff --git a/src/Service/Exthost/Service_Exthost.rei b/src/Service/Exthost/Service_Exthost.rei index 4edfa03580..9d7e0526e1 100644 --- a/src/Service/Exthost/Service_Exthost.rei +++ b/src/Service/Exthost/Service_Exthost.rei @@ -33,6 +33,10 @@ module Effects: { unit => 'msg ) => Isolinear.Effect.t('msg); + + let modelSaved: + (~uri: Oni_Core.Uri.t, Exthost.Client.t, unit => 'msg) => + Isolinear.Effect.t('msg); }; module FileSystemEventService: { diff --git a/src/Store/Features.re b/src/Store/Features.re index 0d3b075343..55ff448c53 100644 --- a/src/Store/Features.re +++ b/src/Store/Features.re @@ -1115,7 +1115,13 @@ let update = }, extHostClient, ); - (state, eff); + + let modelSavedEff = + Service_Exthost.Effects.Documents.modelSaved( + ~uri=Buffer.getUri(buffer), extHostClient, () => + Noop + ); + (state, Isolinear.Effect.batch([eff, modelSavedEff])); | BufferUpdated({update, newBuffer, oldBuffer, triggerKey}) => let fileType =