From fe4e9f98c0cb688ce858f0f1874407bebfff3e12 Mon Sep 17 00:00:00 2001 From: Hendrik Mennen Date: Thu, 29 Feb 2024 14:45:24 +0100 Subject: [PATCH] fix double ls activation --- .../LanguageService/LanguageServiceLsp.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/OneWare.Essentials/LanguageService/LanguageServiceLsp.cs b/src/OneWare.Essentials/LanguageService/LanguageServiceLsp.cs index b16152d..5fdc055 100644 --- a/src/OneWare.Essentials/LanguageService/LanguageServiceLsp.cs +++ b/src/OneWare.Essentials/LanguageService/LanguageServiceLsp.cs @@ -36,7 +36,8 @@ public override async Task ActivateAsync() { //return; if (IsActivated) return; - + IsActivated = true; + if (ExecutablePath == null) { ContainerLocator.Container.Resolve().Warning($"Tried to activate Language Server {Name} without executable!", new NotSupportedException(), false); @@ -58,12 +59,13 @@ public override async Task ActivateAsync() await websocket.ConnectAsync(new Uri(ExecutablePath), _cancellation.Token); await InitAsync(websocket.UsePipeReader().AsStream(), websocket.UsePipeWriter().AsStream()); - IsActivated = true; return; } catch (Exception e) { ContainerLocator.Container.Resolve()?.Error(e.Message, e); + + IsActivated = false; return; } } @@ -103,11 +105,11 @@ public override async Task ActivateAsync() }, _cancellation.Token); await InitAsync(_process.StandardOutput, _process.StandardInput); - IsActivated = true; } catch (Exception e) { ContainerLocator.Container.Resolve()?.Error(e.Message, e); + IsActivated = false; } } }