diff --git a/Directory.Packages.props b/Directory.Packages.props index 6149f7ee..952953a0 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,5 +1,6 @@ + 4.5 + $(DefineConstants);CODE_STYLE $(NoWarn); - - + + diff --git a/MSBuildLanguageServer/Workspace.cs b/MSBuildLanguageServer/Workspace.cs deleted file mode 100644 index 51e559a1..00000000 --- a/MSBuildLanguageServer/Workspace.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System.Diagnostics.CodeAnalysis; - -namespace MonoDevelop.MSBuild.Editor.LanguageServer; - -/// -/// Tracks files of interest to the editor, including files that are open -/// and files that are imported by open files. -/// -public abstract partial class Workspace -{ - // Maps of files are keyed on document ID, which is a unique identifier for a document in the workspace. - // The document ID is generated on demand and is stable for the lifetime of the document, - // which reduces the need to propagate document renames through the system. - // The ID is not derived from the path of the document, but is internally a GUID. Although this - // means it is not deterministic, it also means we can track documents that don't have a name. - // We do not currently check for GUID collisions but could do so fairly easily if needed. - // TODO: need to ensure that the path is absolute and fully normalized, and take a account of case sensitivity - readonly object documentIdLock = new (); - readonly Dictionary filePathToDocumentId = new(); - - public bool TryGetDocumentId(string normalizedAbsoluteFilePath, [NotNullWhen(true)] out DocumentId? id) - => filePathToDocumentId.TryGetValue(normalizedAbsoluteFilePath, out id); - - protected DocumentId GetOrCreateDocumentId(string normalizedAbsoluteFilePath) - { - if (filePathToDocumentId.TryGetValue(normalizedAbsoluteFilePath, out var id)) - { - return id; - } - - lock (documentIdLock) - { - id = DocumentId.CreateNewId(); - if (!filePathToDocumentId.TryAdd(normalizedAbsoluteFilePath, id)) { - id = filePathToDocumentId[normalizedAbsoluteFilePath]; - } - } - - return id; - } -} diff --git a/MSBuildLanguageServer/WorkspaceServices.cs b/MSBuildLanguageServer/WorkspaceServices.cs deleted file mode 100644 index 12c94901..00000000 --- a/MSBuildLanguageServer/WorkspaceServices.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using Microsoft.CodeAnalysis.Host; - -namespace MonoDevelop.MSBuild.Editor.LanguageServer; - -public abstract class WorkspaceServices -{ - public abstract HostServices HostServices { get; } - - public abstract T? GetService() where T : IWorkspaceService; - - public T GetRequiredService() where T : IWorkspaceService - => GetService() ?? throw new InvalidOperationException($"Workspace does not provide service {typeof(T).FullName}."); -} \ No newline at end of file