Force shutdown when received from the client, #1
This commit is contained in:
Родитель
b2ff44ad88
Коммит
871d7580af
|
@ -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<TextDocumentHandler>()
|
||||
.WithHandler<FileChangeHandler>()
|
||||
.WithHandler<AvaloniaCodeCompletionHandler>())
|
||||
.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<TextDocumentHandler>()
|
||||
.WithHandler<FileChangeHandler>()
|
||||
.WithHandler<AvaloniaCodeCompletionHandler>()
|
||||
).ConfigureAwait(false);
|
||||
|
||||
server.Shutdown.Subscribe(x => {
|
||||
Log.Logger.Information("--> Shutdown...");
|
||||
Environment.Exit(0);
|
||||
});
|
||||
|
||||
await server
|
||||
.WaitForExit
|
||||
|
|
|
@ -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<void> | undefined
|
||||
{
|
||||
if (!client) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return client.stop();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче