Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 11 additions & 4 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"build",
"${workspaceFolder}/EmoTracker.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
"/consoleloggerparameters:NoSummary",
"/p:EmoTrackerRegularBuild=1"
],
"problemMatcher": "$msCompile",
"group": {
Expand All @@ -29,8 +30,10 @@
"--configuration",
"Debug",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
"/consoleloggerparameters:NoSummary",
"/p:EmoTrackerRegularBuild=1"
],

"problemMatcher": "$msCompile"
},
{
Expand All @@ -45,8 +48,10 @@
"--configuration",
"Release",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
"/consoleloggerparameters:NoSummary",
"/p:EmoTrackerRegularBuild=1"
],

"problemMatcher": "$msCompile"
},
{
Expand All @@ -59,8 +64,10 @@
"--configuration",
"Release",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
"/consoleloggerparameters:NoSummary",
"/p:EmoTrackerRegularBuild=1"
],

"problemMatcher": "$msCompile"
},
{
Expand Down
18 changes: 18 additions & 0 deletions EmoTracker.SourceGenerators/EmoTracker.SourceGenerators.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,24 @@
<NoWarn>$(NoWarn);RS2008</NoWarn>
</PropertyGroup>

<!--
The Avalonia VS Code Language Server (AvaloniaUI.VSCodeServer.dll) builds this
project in-process, loads EmoTracker.SourceGenerators.dll as a Roslyn analyzer,
and keeps a file lock on it for the entire VS Code session. This prevents
regular builds from copying an updated DLL to the same location.

Fix: when building via VS Code tasks (which pass /p:EmoTrackerRegularBuild=1),
redirect the output to a separate "-build" directory so regular builds and the
language server write to different paths and never contend on the same file.

The consuming project (EmoTracker.Data) resolves the analyzer path via
$(TargetPath) which follows $(OutputPath), so both the generator and its
consumer use the correct path within the same build invocation.
-->
<PropertyGroup Condition="'$(EmoTrackerRegularBuild)' == '1'">
<OutputPath>bin\$(Configuration)-build\$(TargetFramework)\</OutputPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" PrivateAssets="all" />
Expand Down
16 changes: 16 additions & 0 deletions EmoTracker.UI/Converters/VisibilityConverters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,22 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
=> throw new NotSupportedException();
}

/// <summary>
/// Returns <c>0.0</c> (zero height) when the value is null or empty; otherwise returns
/// <c>Double.PositiveInfinity</c> (no maximum). Use for MaxHeight bindings on badge overlays
/// that should have zero layout footprint when there is no badge text, preventing the
/// invisible badge from inflating the parent container's measured height while keeping
/// data bindings active (avoiding the blank-text flash that <c>IsVisible</c> can cause).
/// </summary>
public class NonEmptyStringToMaxHeightConverter : Singleton<NonEmptyStringToMaxHeightConverter>, IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
=> value is string s && s.Length > 0 ? double.PositiveInfinity : 0.0;

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
=> throw new NotSupportedException();
}

/// <summary>
/// Returns <c>true</c> when the integer/uint value is non-zero.
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions EmoTracker/UI/TrackableItemControl.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<Grid VerticalAlignment="Bottom"
HorizontalAlignment="Right"
MaxWidth="{Binding IconWidth, RelativeSource={RelativeSource AncestorType=local:TrackableItemControl}}"
MaxHeight="{Binding BadgeText, Converter={x:Static converters:NonEmptyStringToMaxHeightConverter.Instance}, FallbackValue=0}"
Opacity="{Binding BadgeText, Converter={x:Static converters:NonEmptyStringToOpacityConverter.Instance}, FallbackValue=0}"
IsHitTestVisible="{Binding BadgeText, Converter={x:Static converters:NonEmptyStringToBoolConverter.Instance}, FallbackValue=False}">
<TextBlock Text="{Binding BadgeText}"
Expand Down
Loading