This commit is contained in:
David Wengier 2024-09-16 15:05:46 +10:00
Родитель b29a1c3f34
Коммит f217326ffd
2 изменённых файлов: 0 добавлений и 38 удалений

Просмотреть файл

@ -1,36 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT license. See License.txt in the project root for license information.
using System;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Razor.Workspaces;
namespace Microsoft.AspNetCore.Razor.LanguageServer;
internal sealed class LspWorkspaceProvider(IHostServicesProvider hostServicesProvider) : IWorkspaceProvider, IDisposable
{
private readonly AdhocWorkspaceProvider _workspaceFactory = new AdhocWorkspaceProvider(hostServicesProvider);
private bool _disposed;
void IDisposable.Dispose()
{
if (_disposed)
{
return;
}
_workspaceFactory.Dispose();
_disposed = true;
}
public Workspace GetWorkspace()
{
if (_disposed)
{
throw new ObjectDisposedException(nameof(LspWorkspaceProvider));
}
return _workspaceFactory.GetOrCreate();
}
}

Просмотреть файл

@ -119,8 +119,6 @@ internal partial class RazorLanguageServer : SystemTextJsonLanguageServer<RazorR
// Add the logger as a service in case anything in CLaSP pulls it out to do logging
services.AddSingleton<ILspLogger>(Logger);
services.AddSingleton<IWorkspaceProvider, LspWorkspaceProvider>();
services.AddSingleton<IFormattingCodeDocumentProvider, LspFormattingCodeDocumentProvider>();
var featureOptions = _featureOptions ?? new DefaultLanguageServerFeatureOptions();