diff --git a/Avalonia.AXAML.LanguageServer/Avalonia.AXAML.LanguageServer/Program.cs b/Avalonia.AXAML.LanguageServer/Avalonia.AXAML.LanguageServer/Program.cs index 0a6457a..61f7baf 100644 --- a/Avalonia.AXAML.LanguageServer/Avalonia.AXAML.LanguageServer/Program.cs +++ b/Avalonia.AXAML.LanguageServer/Avalonia.AXAML.LanguageServer/Program.cs @@ -24,23 +24,26 @@ namespace Avalonia.axamlLanguageServer Log.Logger.Information("Starting log..."); - var server = await OmniSharp.Extensions.LanguageServer.Server.LanguageServer - .From( - options => - options - .WithInput(Console.OpenStandardInput()) - .WithOutput(Console.OpenStandardOutput()) - .ConfigureLogging( - x => x - .AddSerilog(Log.Logger) - .AddLanguageProtocolLogging() - .SetMinimumLevel(LogLevel.Debug) - ) - .WithServices(ConfigureServices) - .WithHandler() - .WithHandler() - .WithHandler()) - .ConfigureAwait(false); + var server = await LanguageServer.From( + options => options + .WithInput(Console.OpenStandardInput()) + .WithOutput(Console.OpenStandardOutput()) + .ConfigureLogging( + x => x + .AddSerilog(Log.Logger) + .AddLanguageProtocolLogging() + .SetMinimumLevel(LogLevel.Debug) + ) + .WithServices(ConfigureServices) + .WithHandler() + .WithHandler() + .WithHandler() + ).ConfigureAwait(false); + + server.Shutdown.Subscribe(x => { + Log.Logger.Information("--> Shutdown..."); + Environment.Exit(0); + }); await server .WaitForExit diff --git a/src/extension.ts b/src/extension.ts index 012682c..405a65b 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -4,8 +4,8 @@ import { workspace } from 'vscode'; import { LanguageClient, - LanguageClientOptions, ServerOptions, + LanguageClientOptions, TransportKind, } from "vscode-languageclient/node"; @@ -62,4 +62,11 @@ export function activate(context: vscode.ExtensionContext) { } -export function deactivate() {} +export function deactivate() : Thenable | undefined +{ + if (!client) { + return undefined; + } + + return client.stop(); +}