Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 0 additions & 114 deletions .github/skills/run-vscode-local-testing/SKILL.md

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion eng/config/PublishData.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
"roslyn-language-server.win-arm64": "vs-impl",
"roslyn-language-server.win-x64": "vs-impl",
"Text.Analyzers": "arcade",
"Microsoft.VisualStudioCode.RazorExtension": "vs-impl",
"Microsoft.AspNetCore.Mvc.Razor.Extensions.Tooling.Internal": "arcade",
"Microsoft.AspNetCore.Razor.Test.Common": "arcade",
"Microsoft.AspNetCore.Razor.Utilities.Shared": "arcade",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public async Task CreatingDirectoryWatchRequestsDirectoryWatch()
// Get rid of the registration and it should be gone again
context.Dispose();
await WaitForFileWatcherAsync(testLspServer);
Assert.Empty(dynamicCapabilitiesRpcTarget.Registrations);
AssertNoFileWatcherRegistration(dynamicCapabilitiesRpcTarget);
}

[Fact]
Expand Down Expand Up @@ -99,21 +99,26 @@ public async Task CreatingFileWatchRequestsFileWatch()

// Get rid of the registration and it should be gone again
watchedFile.Dispose();
context.Dispose();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disposing this before the assert might be defeating the point this part of the test. Should line 90 just become a using context instead?

Copy link
Copy Markdown
Member Author

@davidwengier davidwengier May 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The missing dispose is something copilot noticed, but I did think the same thing. The test above already has the context.Dispose call, and it is before the wait and assert though, so I assumed it to be correct.

await WaitForFileWatcherAsync(testLspServer);
Assert.Empty(dynamicCapabilitiesRpcTarget.Registrations);
AssertNoFileWatcherRegistration(dynamicCapabilitiesRpcTarget);
}

private static Task WaitForFileWatcherAsync(TestLspServer testLspServer)
=> testLspServer.ExportProvider.GetExportedValue<AsynchronousOperationListenerProvider>().GetWaiter(FeatureAttribute.Workspace).ExpeditedWaitAsync();

private static FileSystemWatcher GetSingleFileWatcher(DynamicCapabilitiesRpcTarget dynamicCapabilities)
{
var registrationJson = Assert.IsType<JsonElement>(Assert.Single(dynamicCapabilities.Registrations).Value.RegisterOptions);
var registrationJson = Assert.IsType<JsonElement>(
Assert.Single(dynamicCapabilities.Registrations.Values, static registration => registration.Method == Methods.WorkspaceDidChangeWatchedFilesName).RegisterOptions);
var registration = JsonSerializer.Deserialize<DidChangeWatchedFilesRegistrationOptions>(registrationJson, ProtocolConversions.LspJsonSerializerOptions)!;

return Assert.Single(registration.Watchers);
}

private static void AssertNoFileWatcherRegistration(DynamicCapabilitiesRpcTarget dynamicCapabilities)
=> Assert.DoesNotContain(dynamicCapabilities.Registrations.Values, static registration => registration.Method == Methods.WorkspaceDidChangeWatchedFilesName);

private sealed class DynamicCapabilitiesRpcTarget
{
public readonly ConcurrentDictionary<string, Registration> Registrations = new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ internal sealed class LanguageServerTestComposition
SessionId: null,
ExtensionAssemblyPaths: extensionPaths ?? [],
DevKitDependencyPath: devKitDependencyPath,
RazorDesignTimePath: null,
CSharpDesignTimePath: null,
ExtensionLogDirectory: string.Empty,
ServerPipeName: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ namespace Microsoft.CodeAnalysis.LanguageServer.HostWorkspace;

internal abstract class LanguageServerProjectLoader
{
private static readonly string s_razorDesignTimePath = Path.Combine(AppContext.BaseDirectory, "Targets", "Microsoft.NET.Sdk.Razor.DesignTime.targets");

private readonly AsyncBatchingWorkQueue<ProjectToLoad> _projectsToReload;

protected readonly LanguageServerWorkspaceFactory _workspaceFactory;
Expand Down Expand Up @@ -126,10 +128,7 @@ private static ImmutableDictionary<string, string> BuildAdditionalProperties(Ser
return properties;
}

if (serverConfiguration.RazorDesignTimePath is { } razorDesignTimePath)
{
properties = properties.Add("RazorDesignTimeTargets", razorDesignTimePath);
}
properties = properties.Add("RazorDesignTimeTargets", s_razorDesignTimePath);

if (serverConfiguration.CSharpDesignTimePath is { } csharpDesignTimePath)
{
Expand Down
Loading
Loading