This commit is contained in:
Ryan Brandenburg 2022-12-06 17:04:44 -08:00
Родитель 78e384ea09
Коммит f23e23a45e
23 изменённых файлов: 45 добавлений и 54 удалений

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

@ -77,10 +77,10 @@ stages:
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
name: NetCore-Public
demands: ImageOverride -equals windows.vs2022preview.amd64.open
demands: ImageOverride -equals windows.vs2022preview.scout.amd64.open
${{ if ne(variables['System.TeamProject'], 'public') }}:
name: NetCore1ESPool-Internal
demands: ImageOverride -equals windows.vs2022preview.amd64
demands: ImageOverride -equals windows.vs2022preview.scout.amd64
steps:
- task: NodeTool@0
displayName: Install Node 10.x

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

@ -75,10 +75,10 @@
<Tooling_HtmlEditorPackageVersion>17.5.101-preview-0002</Tooling_HtmlEditorPackageVersion>
<!-- Several packages share the MS.CA.Testing version -->
<Tooling_MicrosoftCodeAnalysisTestingVersion>1.1.2-beta1.22512.1</Tooling_MicrosoftCodeAnalysisTestingVersion>
<MicrosoftVisualStudioShellPackagesVersion>17.4.0-preview-2-32826-307</MicrosoftVisualStudioShellPackagesVersion>
<MicrosoftVisualStudioPackagesVersion>17.5.42-preview</MicrosoftVisualStudioPackagesVersion>
<RoslynPackageVersion>4.5.0-2.22527.10</RoslynPackageVersion>
<VisualStudioLanguageServerProtocolVersion>17.4.1008-preview</VisualStudioLanguageServerProtocolVersion>
<MicrosoftVisualStudioShellPackagesVersion>17.5.0-preview-2-33111-355</MicrosoftVisualStudioShellPackagesVersion>
<MicrosoftVisualStudioPackagesVersion>17.5.143-preview</MicrosoftVisualStudioPackagesVersion>
<RoslynPackageVersion>4.5.0-2.22580.13</RoslynPackageVersion>
<VisualStudioLanguageServerProtocolVersion>17.5.20-preview</VisualStudioLanguageServerProtocolVersion>
<MicrosoftNetCompilersToolsetVersion>4.4.0</MicrosoftNetCompilersToolsetVersion>
<MicrosoftCommonLanguageServerProtocolFrameworkPackageVersion>$(RoslynPackageVersion)</MicrosoftCommonLanguageServerProtocolFrameworkPackageVersion>
<!-- dotnet/runtime packages -->
@ -111,14 +111,14 @@
<MicrosoftVisualStudioShell150PackageVersion>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioShell150PackageVersion>
<MicrosoftVisualStudioInteropPackageVersion>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioInteropPackageVersion>
<MicrosoftInternalVisualStudioInteropPackageVersion>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftInternalVisualStudioInteropPackageVersion>
<MicrosoftVisualStudioRpcContractsPackageVersion>17.4.5-alpha</MicrosoftVisualStudioRpcContractsPackageVersion>
<MicrosoftVisualStudioRpcContractsPackageVersion>17.5.14-alpha</MicrosoftVisualStudioRpcContractsPackageVersion>
<MicrosoftVisualStudioTelemetryVersion>16.5.2</MicrosoftVisualStudioTelemetryVersion>
<MicrosoftVisualStudioTextDataPackageVersion>$(MicrosoftVisualStudioPackagesVersion)</MicrosoftVisualStudioTextDataPackageVersion>
<MicrosoftVisualStudioTextImplementationPackageVersion>$(MicrosoftVisualStudioPackagesVersion)</MicrosoftVisualStudioTextImplementationPackageVersion>
<MicrosoftVisualStudioTextLogicPackageVersion>$(MicrosoftVisualStudioPackagesVersion)</MicrosoftVisualStudioTextLogicPackageVersion>
<MicrosoftVisualStudioThreadingPackageVersion>17.4.27</MicrosoftVisualStudioThreadingPackageVersion>
<MicrosoftVisualStudioThreadingPackageVersion>17.5.10-alpha</MicrosoftVisualStudioThreadingPackageVersion>
<MicrosoftVisualStudioWebPackageVersion>16.10.0-preview-1-31008-014</MicrosoftVisualStudioWebPackageVersion>
<MicrosoftVisualStudioValidationPackageVersion>17.0.64</MicrosoftVisualStudioValidationPackageVersion>
<MicrosoftVisualStudioValidationPackageVersion>17.0.71</MicrosoftVisualStudioValidationPackageVersion>
<MicrosoftWebToolsLanguagesHtmlPackageVersion>$(Tooling_HtmlEditorPackageVersion)</MicrosoftWebToolsLanguagesHtmlPackageVersion>
<MicrosoftWebToolsLanguagesLanguageServerServerPackageVersion>$(Tooling_HtmlEditorPackageVersion)</MicrosoftWebToolsLanguagesLanguageServerServerPackageVersion>
<MicrosoftWebToolsLanguagesSharedPackageVersion>$(Tooling_HtmlEditorPackageVersion)</MicrosoftWebToolsLanguagesSharedPackageVersion>
@ -128,12 +128,12 @@
<MonoDevelopSdkPackageVersion>1.0.15</MonoDevelopSdkPackageVersion>
<MoqPackageVersion>4.16.0</MoqPackageVersion>
<NewtonsoftJsonPackageVersion>13.0.1</NewtonsoftJsonPackageVersion>
<NerdbankStreamsPackageVersion>2.9.87-alpha</NerdbankStreamsPackageVersion>
<NerdbankStreamsPackageVersion>2.9.112</NerdbankStreamsPackageVersion>
<NuGetSolutionRestoreManagerInteropVersion>4.8.0</NuGetSolutionRestoreManagerInteropVersion>
<OmniSharpExtensionsLanguageServerPackageVersion>0.19.5</OmniSharpExtensionsLanguageServerPackageVersion>
<OmniSharpExtensionsLanguageProtocolPackageVersion>$(OmniSharpExtensionsLanguageServerPackageVersion)</OmniSharpExtensionsLanguageProtocolPackageVersion>
<OmniSharpMSBuildPackageVersion>1.39.1</OmniSharpMSBuildPackageVersion>
<StreamJsonRpcPackageVersion>2.13.21-alpha</StreamJsonRpcPackageVersion>
<StreamJsonRpcPackageVersion>2.14.17-alpha</StreamJsonRpcPackageVersion>
<SystemRuntimeInteropServicesRuntimePackageVersion>4.3.0</SystemRuntimeInteropServicesRuntimePackageVersion>
<Tooling_MicrosoftCodeAnalysisAnalyzersPackageVersion>3.3.3</Tooling_MicrosoftCodeAnalysisAnalyzersPackageVersion>
<Tooling_MicrosoftCodeAnalysisNetAnalyzersPackageVersion>7.0.0-preview1.22116.1</Tooling_MicrosoftCodeAnalysisNetAnalyzersPackageVersion>
@ -157,7 +157,7 @@
<XunitExtensibilityExecutionPackageVersion>$(XunitVersion)</XunitExtensibilityExecutionPackageVersion>
<!-- Temporary hack to workaround package restrictions for dev17 -->
<MicrosoftInternalVisualStudioShellFrameworkPackageVersion>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftInternalVisualStudioShellFrameworkPackageVersion>
<MicrosoftIORedistPackageVersion>4.7.1</MicrosoftIORedistPackageVersion>
<MicrosoftIORedistPackageVersion>6.0.0</MicrosoftIORedistPackageVersion>
<!-- Compiler Deps -->
<BenchmarkDotNetVersion>0.13.0.1555</BenchmarkDotNetVersion>
<DiffPlexVersion>1.5.0</DiffPlexVersion>

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

@ -37,7 +37,7 @@ public class DefaultRemoteTextLoaderFactory : RemoteTextLoaderFactory
_filePath = filePath;
}
public override Task<TextAndVersion> LoadTextAndVersionAsync(Workspace? workspace, DocumentId? documentId, CancellationToken cancellationToken)
public override Task<TextAndVersion> LoadTextAndVersionAsync(LoadTextOptions options, CancellationToken cancellationToken)
{
TextAndVersion textAndVersion;

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

@ -23,7 +23,7 @@ internal class DocumentSnapshotTextLoader : TextLoader
_documentSnapshot = documentSnapshot;
}
public override async Task<TextAndVersion> LoadTextAndVersionAsync(Workspace? workspace, DocumentId? documentId, CancellationToken cancellationToken)
public override async Task<TextAndVersion> LoadTextAndVersionAsync(LoadTextOptions options, CancellationToken cancellationToken)
{
var sourceText = await _documentSnapshot.GetTextAsync();
var textAndVersion = TextAndVersion.Create(sourceText, VersionStamp.Default);

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

@ -1,13 +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 Microsoft.VisualStudio.LanguageServer.Protocol;
namespace Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts;
internal interface ITextDocumentPositionParams
{
public TextDocumentIdentifier TextDocument { get; set; }
public Position Position { get; set; }
}

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

@ -489,8 +489,7 @@ internal class DefaultRazorProjectService : RazorProjectService
_fromDocument = fromDocument ?? throw new ArgumentNullException(nameof(fromDocument));
}
public override async Task<TextAndVersion> LoadTextAndVersionAsync(
Workspace? workspace,
DocumentId? documentId,
LoadTextOptions options,
CancellationToken cancellationToken)
{
var sourceText = await _fromDocument.GetTextAsync();

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

@ -286,7 +286,7 @@ internal class BackgroundDocumentProcessedPublisher : OmniSharpDocumentProcessed
_document = document;
}
public async override Task<TextAndVersion> LoadTextAndVersionAsync(Workspace workspace, DocumentId documentId, CancellationToken cancellationToken)
public async override Task<TextAndVersion> LoadTextAndVersionAsync(LoadTextOptions options, CancellationToken cancellationToken)
{
var sourceText = await _document.GetTextAsync(cancellationToken);
var textVersion = await _document.GetTextVersionAsync(cancellationToken);

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

@ -22,10 +22,10 @@ internal class EmptyTextLoader : TextLoader
_version = VersionStamp.Create(); // Version will never change so this can be reused.
}
public override Task<TextAndVersion> LoadTextAndVersionAsync(Workspace workspace, DocumentId documentId, CancellationToken cancellationToken)
public override Task<TextAndVersion> LoadTextAndVersionAsync(LoadTextOptions options, CancellationToken cancellationToken)
{
// Providing an encoding here is important for debuggability. Without this edit-and-continue
// won't work for projects with Razor files.
return Task.FromResult(TextAndVersion.Create(SourceText.From(string.Empty, Encoding.UTF8), _version, _filePath));
}
}
}

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

@ -418,7 +418,7 @@ internal class DefaultRazorDynamicFileInfoProvider : RazorDynamicFileInfoProvide
_version = VersionStamp.Default; // Version will never change so this can be reused.
}
public override Task<TextAndVersion> LoadTextAndVersionAsync(Workspace workspace, DocumentId documentId, CancellationToken cancellationToken)
public override Task<TextAndVersion> LoadTextAndVersionAsync(LoadTextOptions options, CancellationToken cancellationToken)
{
// Providing an encoding here is important for debuggability. Without this edit-and-continue
// won't work for projects with Razor files.

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

@ -30,6 +30,7 @@ internal class DefaultProjectSnapshotManager : ProjectSnapshotManagerBase
// created lazily.
private readonly Dictionary<string, Entry> _projects;
private readonly HashSet<string> _openDocuments;
private readonly LoadTextOptions LoadTextOptions = new LoadTextOptions(SourceHashAlgorithm.Sha256);
// We have a queue for changes because if one change results in another change aka, add -> open we want to make sure the "add" finishes running first before "open" is notified.
private readonly Queue<ProjectChangeEventArgs> _notificationWork;
@ -193,7 +194,7 @@ internal class DefaultProjectSnapshotManager : ProjectSnapshotManagerBase
{
var loader = textLoader is null
? DocumentState.EmptyLoader
: (() => textLoader.LoadTextAndVersionAsync(Workspace, documentId: null, CancellationToken.None));
: (() => textLoader.LoadTextAndVersionAsync(LoadTextOptions, CancellationToken.None));
var state = entry.State.WithAddedHostDocument(document, loader);
// Document updates can no-op.
@ -343,7 +344,7 @@ internal class DefaultProjectSnapshotManager : ProjectSnapshotManagerBase
{
var state = entry.State.WithChangedHostDocument(
older.HostDocument,
async () => await textLoader.LoadTextAndVersionAsync(Workspace, documentId: null, cancellationToken: default));
async () => await textLoader.LoadTextAndVersionAsync(LoadTextOptions, cancellationToken: default));
_openDocuments.Remove(documentFilePath);
@ -455,7 +456,7 @@ internal class DefaultProjectSnapshotManager : ProjectSnapshotManagerBase
{
var state = entry.State.WithChangedHostDocument(
older.HostDocument,
async () => await textLoader.LoadTextAndVersionAsync(Workspace, documentId: default, cancellationToken: default));
async () => await textLoader.LoadTextAndVersionAsync(LoadTextOptions, cancellationToken: default));
// Document updates can no-op.
if (!ReferenceEquals(state, entry.State))

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

@ -21,10 +21,10 @@ internal class EmptyTextLoader : TextLoader
_version = VersionStamp.Create(); // Version will never change so this can be reused.
}
public override Task<TextAndVersion> LoadTextAndVersionAsync(Workspace workspace, DocumentId documentId, CancellationToken cancellationToken)
public override Task<TextAndVersion> LoadTextAndVersionAsync(LoadTextOptions options, CancellationToken cancellationToken)
{
// Providing an encoding here is important for debuggability. Without this edit-and-continue
// won't work for projects with Razor files.
return Task.FromResult(TextAndVersion.Create(SourceText.From("", Encoding.UTF8), _version, _filePath));
}
}
}

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

@ -30,7 +30,7 @@ internal class GeneratedDocumentTextLoader : TextLoader
_version = VersionStamp.Create();
}
public override async Task<TextAndVersion> LoadTextAndVersionAsync(Workspace workspace, DocumentId documentId, CancellationToken cancellationToken)
public override async Task<TextAndVersion> LoadTextAndVersionAsync(LoadTextOptions options, CancellationToken cancellationToken)
{
var output = await _document.GetGeneratedOutputAsync().ConfigureAwait(false);

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

@ -158,7 +158,7 @@ internal class CSharpVirtualDocumentPublisher : LSPDocumentChangeListener
_filePath = filePath;
}
public override Task<TextAndVersion> LoadTextAndVersionAsync(CodeAnalysisWorkspace? workspace, DocumentId? documentId, CancellationToken cancellationToken)
public override Task<TextAndVersion> LoadTextAndVersionAsync(LoadTextOptions options, CancellationToken cancellationToken)
{
return Task.FromResult(TextAndVersion.Create(_sourceText, VersionStamp.Default, _filePath));
}

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

@ -87,6 +87,12 @@ using Microsoft.VisualStudio.Shell;
OldVersionLowerBound = "4.4.0.0",
OldVersionUpperBound = "4.5.0.0",
NewVersion = "4.5.0.0")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.VisualStudio.Threading",
GenerateCodeBase = true,
OldVersionLowerBound = "17.4.0.0",
OldVersionUpperBound = "17.5.0.0",
NewVersion = "17.5.0.0")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.VisualStudio.LanguageServices",
GenerateCodeBase = true,
@ -98,3 +104,4 @@ using Microsoft.VisualStudio.Shell;
[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.VisualStudio.LanguageServer.Protocol.dll")]
[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.VisualStudio.LanguageServer.Protocol.Internal.dll")]
[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.VisualStudio.LanguageServer.Protocol.Extensions.dll")]
[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.VisualStudio.Threading.dll")]

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

@ -72,6 +72,7 @@
<VSIXSourceItem Include="$(OutputPath)Microsoft.CodeAnalysis.Remote.Workspaces.dll" />
<VSIXSourceItem Include="$(OutputPath)Microsoft.CodeAnalysis.Workspaces.dll" />
<VSIXSourceItem Include="$(OutputPath)Microsoft.VisualStudio.LanguageServices.dll" />
<VSIXSourceItem Include="$(OutputPath)Microsoft.VisualStudio.Threading.dll" />
<VSIXSourceItem Include="$(OutputPath)Microsoft.VisualStudio.LanguageServer.Protocol.dll" />
<VSIXSourceItem Include="$(OutputPath)Microsoft.VisualStudio.LanguageServer.Protocol.Extensions.dll" />
<VSIXSourceItem Include="$(OutputPath)Microsoft.VisualStudio.LanguageServer.Protocol.Internal.dll" />

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

@ -79,7 +79,8 @@ public sealed class CSharpTestLspServer : IAsyncDisposable
registrationService.Register(workspace);
var languageServerFactory = exportProvider.GetExportedValue<IRazorLanguageServerFactoryWrapper>();
var languageServer = languageServerFactory.CreateLanguageServer(serverRpc, capabilitiesProvider);
var hostServices = workspace.Services.HostServices;
var languageServer = languageServerFactory.CreateLanguageServer(serverRpc, capabilitiesProvider, hostServices);
serverRpc.StartListening();
return languageServer;

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

@ -193,7 +193,7 @@ public class CodeDocumentReferenceHolderTest : LanguageServerTestBase
}
public override Task<TextAndVersion> LoadTextAndVersionAsync(
Workspace? workspace, DocumentId? documentId, CancellationToken cancellationToken)
LoadTextOptions options, CancellationToken cancellationToken)
{
return Task.FromResult(TextAndVersion.Create(_sourceText, VersionStamp.Default, _filePath));
}

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

@ -30,7 +30,7 @@ public class DocumentSnapshotTextLoaderTest : TestBase
var textLoader = new DocumentSnapshotTextLoader(snapshot);
// Act
var actual = await textLoader.LoadTextAndVersionAsync(default, default, default);
var actual = await textLoader.LoadTextAndVersionAsync(default, default);
// Assert
Assert.Same(expectedSourceText, actual.Text);

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

@ -26,7 +26,7 @@ public class EmptyTextLoaderTest : TestBase
var loader = new EmptyTextLoader("file.cshtml");
// Act
var textAndVersion = await loader.LoadTextAndVersionAsync(default, default, default);
var textAndVersion = await loader.LoadTextAndVersionAsync(default, default);
// Assert
Assert.True(textAndVersion.Text.CanBeEmbedded);

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

@ -37,7 +37,7 @@ public class GeneratedDocumentTextLoaderTest : WorkspaceTestBase
var loader = new GeneratedDocumentTextLoader(document, "file.cshtml");
// Act
var textAndVersion = await loader.LoadTextAndVersionAsync(default, default, default);
var textAndVersion = await loader.LoadTextAndVersionAsync(default, default);
// Assert
Assert.True(textAndVersion.Text.CanBeEmbedded);

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

@ -56,7 +56,7 @@ public class BackgroundDocumentGeneratorTest : ProjectSnapshotManagerDispatcherW
// We utilize a task completion source here so we can "fake" a document parse taking a significant amount of time
var tcs = new TaskCompletionSource<TextAndVersion>();
var textLoader = new Mock<TextLoader>(MockBehavior.Strict);
textLoader.Setup(loader => loader.LoadTextAndVersionAsync(It.IsAny<Workspace>(), It.IsAny<DocumentId>(), It.IsAny<CancellationToken>()))
textLoader.Setup(loader => loader.LoadTextAndVersionAsync(It.IsAny<LoadTextOptions>(), It.IsAny<CancellationToken>()))
.Returns(tcs.Task);
var hostDocument = _documents[0];
@ -100,7 +100,7 @@ public class BackgroundDocumentGeneratorTest : ProjectSnapshotManagerDispatcherW
projectManager.ProjectAdded(_hostProject1);
var textLoader = new Mock<TextLoader>(MockBehavior.Strict);
textLoader.Setup(loader => loader.LoadTextAndVersionAsync(It.IsAny<Workspace>(), It.IsAny<DocumentId>(), It.IsAny<CancellationToken>()))
textLoader.Setup(loader => loader.LoadTextAndVersionAsync(It.IsAny<LoadTextOptions>(), It.IsAny<CancellationToken>()))
.Throws<FileNotFoundException>();
projectManager.DocumentAdded(_hostProject1, _documents[0], textLoader.Object);
@ -131,7 +131,7 @@ public class BackgroundDocumentGeneratorTest : ProjectSnapshotManagerDispatcherW
projectManager.ProjectAdded(_hostProject1);
var textLoader = new Mock<TextLoader>(MockBehavior.Strict);
textLoader.Setup(loader => loader.LoadTextAndVersionAsync(It.IsAny<Workspace>(), It.IsAny<DocumentId>(), It.IsAny<CancellationToken>()))
textLoader.Setup(loader => loader.LoadTextAndVersionAsync(It.IsAny<LoadTextOptions>(), It.IsAny<CancellationToken>()))
.Throws<UnauthorizedAccessException>();
projectManager.DocumentAdded(_hostProject1, _documents[0], textLoader.Object);

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

@ -36,9 +36,4 @@
<ItemGroup>
<PackageReference Include="Moq" Version="$(MoqPackageVersion)" />
</ItemGroup>
<ItemGroup>
<!-- Package changes to enable dev17 builds that have incoherent versions -->
<PackageReference Include="Microsoft.IO.Redist" Version="4.7.1" />
</ItemGroup>
</Project>

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

@ -646,7 +646,7 @@ public class DefaultProjectSnapshotManagerTest : ProjectSnapshotManagerDispatche
// Assert
Assert.Equal(ProjectChangeKind.DocumentAdded, _projectManager.ListenersNotifiedOf);
textLoader.Verify(d => d.LoadTextAndVersionAsync(It.IsAny<Workspace>(), It.IsAny<DocumentId>(), It.IsAny<CancellationToken>()), Times.Never());
textLoader.Verify(d => d.LoadTextAndVersionAsync(It.IsAny<LoadTextOptions>(), It.IsAny<CancellationToken>()), Times.Never());
}
private class TestProjectSnapshotManager : DefaultProjectSnapshotManager