Skip to content

Commit 06bdf92

Browse files
Move ICssHotReloadService from webtool to project system (#9781)
* add ICssHotReloadService * Add missing using directive for HotReload in IProjectHotReloadSessionWebAssemblyCallback * Refactor VisualStudioBrowserRefreshServerAccessor to internal and update Public API for ICssHotReloadService * Refactor AbstractBrowserRefreshServerAccessor to implement IDisposable and remove IBrowserRefreshServerAccessor interface * Update Public API to replace AbstractBrowserRefreshServerAccessor references and adjust method signatures * Update VisualStudioBrowserRefreshServerAccessor to public and adjust Public API references * Refactor ICssHotReloadService to improve code clarity and maintainability
1 parent 78b7013 commit 06bdf92

File tree

7 files changed

+56
-25
lines changed

7 files changed

+56
-25
lines changed

src/Microsoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/Web/VisualStudioBrowserRefreshServerAccessor.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using Microsoft.DotNet.HotReload;
44
using Microsoft.Extensions.Logging;
55
using Microsoft.VisualStudio.ProjectSystem.HotReload;
6-
using Microsoft.VisualStudio.ProjectSystem.VS.HotReload;
76

87
namespace Microsoft.VisualStudio.ProjectSystem.VS.Web;
98

src/Microsoft.VisualStudio.ProjectSystem.Managed.VS/PublicAPI.Shipped.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ Microsoft.VisualStudio.ProjectSystem.VS.Query.QueryProjectPropertiesContext.Quer
428428
override Microsoft.VisualStudio.ProjectSystem.VS.Query.QueryProjectPropertiesContext.Equals(object! obj) -> bool
429429
override Microsoft.VisualStudio.ProjectSystem.VS.Query.QueryProjectPropertiesContext.GetHashCode() -> int
430430
static readonly Microsoft.VisualStudio.ProjectSystem.VS.Query.QueryProjectPropertiesContext.ProjectFile -> Microsoft.VisualStudio.ProjectSystem.VS.Query.QueryProjectPropertiesContext!
431-
Microsoft.VisualStudio.ProjectSystem.VS.Web.VisualStudioBrowserRefreshServerAccessor
432-
Microsoft.VisualStudio.ProjectSystem.VS.Web.VisualStudioBrowserRefreshServerAccessor.VisualStudioBrowserRefreshServerAccessor(Microsoft.Extensions.Logging.ILogger! logger, Microsoft.Extensions.Logging.ILoggerFactory! loggerFactory, string! projectName, int port, int sslPort, string! virtualDirectory) -> void
433431
Microsoft.VisualStudio.ProjectSystem.VS.Debug.IDebugProfileLaunchTargetsProvider5
434-
Microsoft.VisualStudio.ProjectSystem.VS.Debug.IDebugProfileLaunchTargetsProvider5.OnAfterLaunchAsync(Microsoft.VisualStudio.ProjectSystem.Debug.DebugLaunchOptions launchOptions, Microsoft.VisualStudio.ProjectSystem.Debug.ILaunchProfile! profile, Microsoft.VisualStudio.ProjectSystem.VS.Debug.IDebugLaunchSettings! debugLaunchSetting, Microsoft.VisualStudio.Debugger.Interop.IVsLaunchedProcess! vsLaunchedProcess, Microsoft.VisualStudio.Shell.Interop.VsDebugTargetProcessInfo processInfo) -> System.Threading.Tasks.Task!
432+
Microsoft.VisualStudio.ProjectSystem.VS.Debug.IDebugProfileLaunchTargetsProvider5.OnAfterLaunchAsync(Microsoft.VisualStudio.ProjectSystem.Debug.DebugLaunchOptions launchOptions, Microsoft.VisualStudio.ProjectSystem.Debug.ILaunchProfile! profile, Microsoft.VisualStudio.ProjectSystem.VS.Debug.IDebugLaunchSettings! debugLaunchSetting, Microsoft.VisualStudio.Debugger.Interop.IVsLaunchedProcess! vsLaunchedProcess, Microsoft.VisualStudio.Shell.Interop.VsDebugTargetProcessInfo processInfo) -> System.Threading.Tasks.Task!
433+
Microsoft.VisualStudio.ProjectSystem.VS.Web.VisualStudioBrowserRefreshServerAccessor
434+
Microsoft.VisualStudio.ProjectSystem.VS.Web.VisualStudioBrowserRefreshServerAccessor.VisualStudioBrowserRefreshServerAccessor(Microsoft.Extensions.Logging.ILogger! logger, Microsoft.Extensions.Logging.ILoggerFactory! loggerFactory, string! projectName, int port, int sslPort, string! virtualDirectory) -> void

src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/HotReload/Contracts/AbstractBrowserRefreshServerAccessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
using Microsoft.DotNet.HotReload;
44

5-
namespace Microsoft.VisualStudio.ProjectSystem.VS.HotReload;
5+
namespace Microsoft.VisualStudio.ProjectSystem.HotReload;
66

77
public abstract class AbstractBrowserRefreshServerAccessor : IDisposable
88
{
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE.md file in the project root for more information.
2+
3+
using Microsoft.VisualStudio.Debugger.Contracts.HotReload;
4+
namespace Microsoft.VisualStudio.ProjectSystem.HotReload;
5+
6+
public interface ICssHotReloadService
7+
{
8+
/// <summary>
9+
/// Returns the name of this projects scoped css filename.
10+
/// </summary>
11+
string GetScopedCSSFilenameForProject();
12+
13+
/// <summary>
14+
/// Once this component is loaded for a project it will remain active even if a capability is removed and the feature
15+
/// should be disabled. This property defaults to true. Set to false if the capability supporting this feature
16+
/// is removed.
17+
/// </summary>
18+
bool CssHotReloadEnabled { get; set; }
19+
20+
ValueTask<HotReloadResult> ApplyUpdatesAsync(CancellationToken cancellationToken);
21+
}

src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/HotReload/Contracts/IProjectHotReloadSessionWebAssemblyCallback.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE.md file in the project root for more information.
2+
using Microsoft.VisualStudio.ProjectSystem.HotReload;
23

34
namespace Microsoft.VisualStudio.ProjectSystem.VS.HotReload;
45

src/Microsoft.VisualStudio.ProjectSystem.Managed/PublicAPI/net472/PublicAPI.Shipped.txt

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,18 @@ Microsoft.VisualStudio.ProjectSystem.VS.HotReload.IProjectHotReloadSession.Id.ge
223223
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.IProjectHotReloadAgent
224224
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.IProjectHotReloadAgent.CreateHotReloadSession(string! name, int id, Microsoft.VisualStudio.ProjectSystem.ConfiguredProject! configuredProject, Microsoft.VisualStudio.ProjectSystem.VS.HotReload.IProjectHotReloadSessionCallback! callback, Microsoft.VisualStudio.ProjectSystem.Debug.ILaunchProfile! launchProfile, Microsoft.VisualStudio.ProjectSystem.Debug.DebugLaunchOptions debugLaunchOptions) -> Microsoft.VisualStudio.ProjectSystem.VS.HotReload.IProjectHotReloadSession!
225225
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.IProjectHotReloadSessionWebAssemblyCallback
226-
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.IProjectHotReloadSessionWebAssemblyCallback.BrowserRefreshServerAccessor.get -> Microsoft.VisualStudio.ProjectSystem.VS.HotReload.AbstractBrowserRefreshServerAccessor!
227-
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.AbstractBrowserRefreshServerAccessor
228-
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.AbstractBrowserRefreshServerAccessor.ConfigureLaunchEnvironment(System.Collections.Generic.IDictionary<string!, string!>! builder, bool enableHotReload) -> void
229-
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.AbstractBrowserRefreshServerAccessor.Dispose() -> void
230-
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.AbstractBrowserRefreshServerAccessor.RefreshBrowserAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
231-
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.AbstractBrowserRefreshServerAccessor.SendPingMessageAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
232-
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.AbstractBrowserRefreshServerAccessor.SendReloadMessageAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
233-
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.AbstractBrowserRefreshServerAccessor.SendWaitMessageAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
234-
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.AbstractBrowserRefreshServerAccessor.StartServerAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
235-
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.AbstractBrowserRefreshServerAccessor.UpdateStaticAssetsAsync(System.Collections.Generic.IEnumerable<string!>! relativeUrls, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
226+
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.IProjectHotReloadSessionWebAssemblyCallback.BrowserRefreshServerAccessor.get -> Microsoft.VisualStudio.ProjectSystem.HotReload.AbstractBrowserRefreshServerAccessor!
227+
Microsoft.VisualStudio.ProjectSystem.HotReload.AbstractBrowserRefreshServerAccessor
228+
Microsoft.VisualStudio.ProjectSystem.HotReload.AbstractBrowserRefreshServerAccessor.ConfigureLaunchEnvironment(System.Collections.Generic.IDictionary<string!, string!>! builder, bool enableHotReload) -> void
229+
Microsoft.VisualStudio.ProjectSystem.HotReload.AbstractBrowserRefreshServerAccessor.Dispose() -> void
230+
Microsoft.VisualStudio.ProjectSystem.HotReload.AbstractBrowserRefreshServerAccessor.RefreshBrowserAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
231+
Microsoft.VisualStudio.ProjectSystem.HotReload.AbstractBrowserRefreshServerAccessor.SendPingMessageAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
232+
Microsoft.VisualStudio.ProjectSystem.HotReload.AbstractBrowserRefreshServerAccessor.SendReloadMessageAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
233+
Microsoft.VisualStudio.ProjectSystem.HotReload.AbstractBrowserRefreshServerAccessor.SendWaitMessageAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
234+
Microsoft.VisualStudio.ProjectSystem.HotReload.AbstractBrowserRefreshServerAccessor.StartServerAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
235+
Microsoft.VisualStudio.ProjectSystem.HotReload.AbstractBrowserRefreshServerAccessor.UpdateStaticAssetsAsync(System.Collections.Generic.IEnumerable<string!>! relativeUrls, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
236+
Microsoft.VisualStudio.ProjectSystem.HotReload.ICssHotReloadService
237+
Microsoft.VisualStudio.ProjectSystem.HotReload.ICssHotReloadService.ApplyUpdatesAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask<Microsoft.VisualStudio.Debugger.Contracts.HotReload.HotReloadResult>
238+
Microsoft.VisualStudio.ProjectSystem.HotReload.ICssHotReloadService.CssHotReloadEnabled.get -> bool
239+
Microsoft.VisualStudio.ProjectSystem.HotReload.ICssHotReloadService.CssHotReloadEnabled.set -> void
240+
Microsoft.VisualStudio.ProjectSystem.HotReload.ICssHotReloadService.GetScopedCSSFilenameForProject() -> string!

src/Microsoft.VisualStudio.ProjectSystem.Managed/PublicAPI/net9.0/PublicAPI.Shipped.txt

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,18 @@ Microsoft.VisualStudio.ProjectSystem.VS.HotReload.IProjectHotReloadSession.Id.ge
217217
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.IProjectHotReloadAgent
218218
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.IProjectHotReloadAgent.CreateHotReloadSession(string name, int id, Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, Microsoft.VisualStudio.ProjectSystem.VS.HotReload.IProjectHotReloadSessionCallback callback, Microsoft.VisualStudio.ProjectSystem.Debug.ILaunchProfile launchProfile, Microsoft.VisualStudio.ProjectSystem.Debug.DebugLaunchOptions debugLaunchOptions) -> Microsoft.VisualStudio.ProjectSystem.VS.HotReload.IProjectHotReloadSession
219219
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.IProjectHotReloadSessionWebAssemblyCallback
220-
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.IProjectHotReloadSessionWebAssemblyCallback.BrowserRefreshServerAccessor.get -> Microsoft.VisualStudio.ProjectSystem.VS.HotReload.AbstractBrowserRefreshServerAccessor
221-
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.AbstractBrowserRefreshServerAccessor
222-
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.AbstractBrowserRefreshServerAccessor.ConfigureLaunchEnvironment(System.Collections.Generic.IDictionary<string, string> builder, bool enableHotReload) -> void
223-
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.AbstractBrowserRefreshServerAccessor.Dispose() -> void
224-
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.AbstractBrowserRefreshServerAccessor.RefreshBrowserAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
225-
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.AbstractBrowserRefreshServerAccessor.SendPingMessageAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
226-
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.AbstractBrowserRefreshServerAccessor.SendReloadMessageAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
227-
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.AbstractBrowserRefreshServerAccessor.SendWaitMessageAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
228-
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.AbstractBrowserRefreshServerAccessor.StartServerAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
229-
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.AbstractBrowserRefreshServerAccessor.UpdateStaticAssetsAsync(System.Collections.Generic.IEnumerable<string> relativeUrls, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
220+
Microsoft.VisualStudio.ProjectSystem.VS.HotReload.IProjectHotReloadSessionWebAssemblyCallback.BrowserRefreshServerAccessor.get -> Microsoft.VisualStudio.ProjectSystem.HotReload.AbstractBrowserRefreshServerAccessor
221+
Microsoft.VisualStudio.ProjectSystem.HotReload.AbstractBrowserRefreshServerAccessor
222+
Microsoft.VisualStudio.ProjectSystem.HotReload.AbstractBrowserRefreshServerAccessor.ConfigureLaunchEnvironment(System.Collections.Generic.IDictionary<string, string> builder, bool enableHotReload) -> void
223+
Microsoft.VisualStudio.ProjectSystem.HotReload.AbstractBrowserRefreshServerAccessor.Dispose() -> void
224+
Microsoft.VisualStudio.ProjectSystem.HotReload.AbstractBrowserRefreshServerAccessor.RefreshBrowserAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
225+
Microsoft.VisualStudio.ProjectSystem.HotReload.AbstractBrowserRefreshServerAccessor.SendPingMessageAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
226+
Microsoft.VisualStudio.ProjectSystem.HotReload.AbstractBrowserRefreshServerAccessor.SendReloadMessageAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
227+
Microsoft.VisualStudio.ProjectSystem.HotReload.AbstractBrowserRefreshServerAccessor.SendWaitMessageAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
228+
Microsoft.VisualStudio.ProjectSystem.HotReload.AbstractBrowserRefreshServerAccessor.StartServerAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
229+
Microsoft.VisualStudio.ProjectSystem.HotReload.AbstractBrowserRefreshServerAccessor.UpdateStaticAssetsAsync(System.Collections.Generic.IEnumerable<string> relativeUrls, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
230+
Microsoft.VisualStudio.ProjectSystem.HotReload.ICssHotReloadService
231+
Microsoft.VisualStudio.ProjectSystem.HotReload.ICssHotReloadService.ApplyUpdatesAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask<Microsoft.VisualStudio.Debugger.Contracts.HotReload.HotReloadResult>
232+
Microsoft.VisualStudio.ProjectSystem.HotReload.ICssHotReloadService.CssHotReloadEnabled.get -> bool
233+
Microsoft.VisualStudio.ProjectSystem.HotReload.ICssHotReloadService.CssHotReloadEnabled.set -> void
234+
Microsoft.VisualStudio.ProjectSystem.HotReload.ICssHotReloadService.GetScopedCSSFilenameForProject() -> string

0 commit comments

Comments
 (0)