Skip to content

Commit 3516fbd

Browse files
CopilotJusterZhu
andauthored
Remove unused extension metadata fields (Icon, Repository, DownloadCount) (#131)
* Initial plan * Remove repository, downloadcount, icon metadata and related code Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com>
1 parent 57ea9c5 commit 3516fbd

6 files changed

Lines changed: 0 additions & 134 deletions

File tree

src/c#/ExtensionTest/Metadata/AvailableExtensionTests.cs

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,6 @@ public void Constructor_ShouldSetIsPreReleaseToFalse()
3636
Assert.False(extension.IsPreRelease);
3737
}
3838

39-
/// <summary>
40-
/// Tests that a new AvailableExtension has DownloadCount initialized to null.
41-
/// </summary>
42-
[Fact]
43-
public void Constructor_ShouldSetDownloadCountToNull()
44-
{
45-
// Act
46-
var extension = new AvailableExtension();
47-
48-
// Assert
49-
Assert.Null(extension.DownloadCount);
50-
}
51-
5239
/// <summary>
5340
/// Tests that Descriptor property can be set and retrieved.
5441
/// </summary>
@@ -85,54 +72,5 @@ public void IsPreRelease_CanBeSetToTrue()
8572
// Assert
8673
Assert.True(extension.IsPreRelease);
8774
}
88-
89-
/// <summary>
90-
/// Tests that DownloadCount property can be set and retrieved.
91-
/// </summary>
92-
[Fact]
93-
public void DownloadCount_CanBeSetAndRetrieved()
94-
{
95-
// Arrange
96-
var extension = new AvailableExtension();
97-
var expectedCount = 10000L;
98-
99-
// Act
100-
extension.DownloadCount = expectedCount;
101-
102-
// Assert
103-
Assert.Equal(expectedCount, extension.DownloadCount);
104-
}
105-
106-
/// <summary>
107-
/// Tests that DownloadCount can be set to zero.
108-
/// </summary>
109-
[Fact]
110-
public void DownloadCount_CanBeSetToZero()
111-
{
112-
// Arrange
113-
var extension = new AvailableExtension();
114-
115-
// Act
116-
extension.DownloadCount = 0;
117-
118-
// Assert
119-
Assert.Equal(0, extension.DownloadCount);
120-
}
121-
122-
/// <summary>
123-
/// Tests that DownloadCount can be set back to null after having a value.
124-
/// </summary>
125-
[Fact]
126-
public void DownloadCount_CanBeSetBackToNull()
127-
{
128-
// Arrange
129-
var extension = new AvailableExtension { DownloadCount = 1000 };
130-
131-
// Act
132-
extension.DownloadCount = null;
133-
134-
// Assert
135-
Assert.Null(extension.DownloadCount);
136-
}
13775
}
13876
}

src/c#/ExtensionTest/Metadata/ExtensionDescriptorTests.cs

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -195,40 +195,6 @@ public void Categories_CanBeSetAndRetrieved()
195195
Assert.Same(expectedCategories, descriptor.Categories);
196196
}
197197

198-
/// <summary>
199-
/// Tests that Icon property can be set and retrieved.
200-
/// </summary>
201-
[Fact]
202-
public void Icon_CanBeSetAndRetrieved()
203-
{
204-
// Arrange
205-
var descriptor = new ExtensionDescriptor();
206-
var expectedIcon = "icon.png";
207-
208-
// Act
209-
descriptor.Icon = expectedIcon;
210-
211-
// Assert
212-
Assert.Equal(expectedIcon, descriptor.Icon);
213-
}
214-
215-
/// <summary>
216-
/// Tests that Repository property can be set and retrieved.
217-
/// </summary>
218-
[Fact]
219-
public void Repository_CanBeSetAndRetrieved()
220-
{
221-
// Arrange
222-
var descriptor = new ExtensionDescriptor();
223-
var expectedRepository = "https://github.com/user/repo";
224-
225-
// Act
226-
descriptor.Repository = expectedRepository;
227-
228-
// Assert
229-
Assert.Equal(expectedRepository, descriptor.Repository);
230-
}
231-
232198
/// <summary>
233199
/// Tests that SupportedPlatforms property can be set and retrieved.
234200
/// </summary>
@@ -456,8 +422,6 @@ public void NullableProperties_CanBeSetToNull()
456422
Publisher = "Publisher",
457423
License = "MIT",
458424
Categories = new List<string>(),
459-
Icon = "icon.png",
460-
Repository = "repo",
461425
DownloadUrl = "url",
462426
PackageHash = "hash",
463427
ReleaseDate = DateTime.Now,
@@ -470,8 +434,6 @@ public void NullableProperties_CanBeSetToNull()
470434
descriptor.Publisher = null;
471435
descriptor.License = null;
472436
descriptor.Categories = null;
473-
descriptor.Icon = null;
474-
descriptor.Repository = null;
475437
descriptor.DownloadUrl = null;
476438
descriptor.PackageHash = null;
477439
descriptor.ReleaseDate = null;
@@ -483,8 +445,6 @@ public void NullableProperties_CanBeSetToNull()
483445
Assert.Null(descriptor.Publisher);
484446
Assert.Null(descriptor.License);
485447
Assert.Null(descriptor.Categories);
486-
Assert.Null(descriptor.Icon);
487-
Assert.Null(descriptor.Repository);
488448
Assert.Null(descriptor.DownloadUrl);
489449
Assert.Null(descriptor.PackageHash);
490450
Assert.Null(descriptor.ReleaseDate);

src/c#/GeneralUpdate.Extension/Metadata/AvailableExtension.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,5 @@ public class AvailableExtension
1515
/// Pre-release versions are typically beta or alpha builds.
1616
/// </summary>
1717
public bool IsPreRelease { get; set; }
18-
19-
/// <summary>
20-
/// Gets or sets the total number of times this extension has been downloaded.
21-
/// Null if download statistics are not available.
22-
/// </summary>
23-
public long? DownloadCount { get; set; }
2418
}
2519
}

src/c#/GeneralUpdate.Extension/Metadata/ExtensionDescriptor.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,6 @@ public class ExtensionDescriptor
5959
[JsonPropertyName("categories")]
6060
public List<string>? Categories { get; set; }
6161

62-
/// <summary>
63-
/// Gets or sets the icon path for the extension (relative to package root).
64-
/// </summary>
65-
[JsonPropertyName("icon")]
66-
public string? Icon { get; set; }
67-
68-
/// <summary>
69-
/// Gets or sets the repository URL for the extension source code.
70-
/// </summary>
71-
[JsonPropertyName("repository")]
72-
public string? Repository { get; set; }
73-
7462
/// <summary>
7563
/// Gets or sets the platforms supported by this extension.
7664
/// Uses flags to allow multiple platform targets.

src/c#/GeneralUpdate.Extension/PackageGeneration/ExtensionPackageGenerator.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,16 +162,6 @@ private Task GenerateManifestAsync(string targetDirectory, Metadata.ExtensionDes
162162
manifest["categories"] = descriptor.Categories;
163163
}
164164

165-
if (!string.IsNullOrEmpty(descriptor.Icon))
166-
{
167-
manifest["icon"] = descriptor.Icon;
168-
}
169-
170-
if (!string.IsNullOrEmpty(descriptor.Repository))
171-
{
172-
manifest["repository"] = descriptor.Repository;
173-
}
174-
175165
// Add engine/compatibility information
176166
if (descriptor.Compatibility != null)
177167
{

src/c#/GeneralUpdate.Extension/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,6 @@ Extensions use a descriptor structure aligned with VS Code's package.json format
327327
"maxHostVersion": "2.0.0"
328328
},
329329
"categories": ["Programming Languages", "Debuggers"],
330-
"icon": "icon.png",
331-
"repository": "https://github.com/user/repo",
332330
"supportedPlatforms": 7
333331
}
334332
```
@@ -362,8 +360,6 @@ var descriptor = new Metadata.ExtensionDescriptor
362360
Publisher = "publisher-name",
363361
License = "MIT",
364362
Categories = new List<string> { "Programming Languages" },
365-
Icon = "icon.png",
366-
Repository = "https://github.com/user/repo",
367363
SupportedPlatforms = Metadata.TargetPlatform.All,
368364
Compatibility = new Metadata.VersionCompatibility
369365
{

0 commit comments

Comments
 (0)