Skip to content

Commit

Permalink
Updates for VS 17.9p3 (#301)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Matteo Prosperi <[email protected]>
  • Loading branch information
matteo-prosperi and Matteo Prosperi committed Jan 17, 2024
1 parent cbaf153 commit ec871c8
Show file tree
Hide file tree
Showing 58 changed files with 150 additions and 170 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
<TargetFrameworks>net8.0-windows8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>11</LangVersion>
<LangVersion>12</LangVersion>

<!-- The VisualStudio.Extensibility preview packages are available from the azure-public/vside/msft_consumption feed -->
<RestoreAdditionalProjectSources>https://pkgs.dev.azure.com/azure-public/vside/_packaging/msft_consumption/nuget/v3/index.json;$(RestoreAdditionalProjectSources)</RestoreAdditionalProjectSources>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.9.1068-preview-2" />
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.9.1068-preview-2" />
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.9.2092" />
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.9.2092" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ internal static class ExtensionCommandConfiguration
[VisualStudioContribution]
public static ToolbarConfiguration ToolBar => new("%CommandParentingSample.ToolBar.DisplayName%")
{
Children = new[]
{
Children =
[
ToolbarChild.Command<SampleCommand>(),
},
],
};
}
12 changes: 6 additions & 6 deletions New_Extensibility_Model/Samples/CommandParentingSample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ The `CommandConfiguration` property defines information about the command that a
```csharp
public override CommandConfiguration CommandConfiguration => new("%CommandParentingSample.SampleCommand.DisplayName%")
{
Placements = new[]
{
Placements =
[
// File in project context menu
CommandPlacement.VsctParent(new Guid("{d309f791-903f-11d0-9efc-00a0c911004f}"), id: 521, priority: 0),

Expand All @@ -38,7 +38,7 @@ The `CommandConfiguration` property defines information about the command that a

// Solution context menu
CommandPlacement.VsctParent(new Guid("{d309f791-903f-11d0-9efc-00a0c911004f}"), id: 537, priority: 0),
},
],
};
```

Expand All @@ -54,10 +54,10 @@ The `ToolbarConfiguration` property defines information about the toolbar that a
[VisualStudioContribution]
public static ToolbarConfiguration ToolBar => new("%CommandParentingSample.ToolBar.DisplayName%")
{
Children = new[]
{
Children =
[
ToolbarChild.Command<SampleCommand>(),
},
],
};
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,12 @@ internal class SampleCommand : Command
/// <inheritdoc />
public override CommandConfiguration CommandConfiguration => new("%CommandParentingSample.SampleCommand.DisplayName%")
{
Placements = new[]
{
// File in project context menu
CommandPlacement.VsctParent(new Guid("{d309f791-903f-11d0-9efc-00a0c911004f}"), id: 521, priority: 0),

// Project context menu
CommandPlacement.VsctParent(new Guid("{d309f791-903f-11d0-9efc-00a0c911004f}"), id: 518, priority: 0),

// Solution context menu
CommandPlacement.VsctParent(new Guid("{d309f791-903f-11d0-9efc-00a0c911004f}"), id: 537, priority: 0),
},
Placements =
[
CommandPlacement.VsctParent(new Guid("{d309f791-903f-11d0-9efc-00a0c911004f}"), id: 521, priority: 0), // File in project context menu
CommandPlacement.VsctParent(new Guid("{d309f791-903f-11d0-9efc-00a0c911004f}"), id: 518, priority: 0), // Project context menu
CommandPlacement.VsctParent(new Guid("{d309f791-903f-11d0-9efc-00a0c911004f}"), id: 537, priority: 0), // Solution context menu
],
};

/// <inheritdoc />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net472</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>11</LangVersion>
<LangVersion>12</LangVersion>
<NoWarn>$(NoWarn);SA1633</NoWarn>

<!-- The VisualStudio.Extensibility preview packages are available from the azure-public/vside/msft_consumption feed -->
Expand All @@ -14,8 +14,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.9.1068-preview-2" />
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.9.1068-preview-2" />
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.9.2092" />
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.9.2092" />
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.6.36389" ExcludeAssets="runtime" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal abstract class CommentRemoverCommand : Microsoft.VisualStudio.Extensibi
{
protected static readonly ActivationConstraint CommandEnabledWhen = ActivationConstraint.ClientContext(ClientContextKey.Shell.ActiveSelectionFileName, @"\.(cs|vb|fs)$");

private static readonly string[] TaskCaptions = { "TODO", "HACK", "UNDONE", "UNRESOLVEDMERGECONFLICT" };
private static readonly string[] TaskCaptions = ["TODO", "HACK", "UNDONE", "UNRESOLVEDMERGECONFLICT"];

public CommentRemoverCommand(
TraceSource traceSource,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ internal static class ExtensionCommandConfiguration
[VisualStudioContribution]
public static MenuConfiguration CommentRemoverMenu => new("%CommentRemover.CommentRemoverMenu.DisplayName%")
{
Placements = new[]
{
Placements =
[
CommandPlacement.KnownPlacements.ExtensionsMenu.WithPriority(0x01),
},
Children = new[]
{
],
Children =
[
MenuChild.Command<RemoveAllComments>(),
MenuChild.Command<RemoveXmlDocComments>(),
MenuChild.Command<RemoveAllExceptXmlDocComments>(),
Expand All @@ -22,6 +22,6 @@ internal static class ExtensionCommandConfiguration
MenuChild.Command<RemoveAllExceptTaskComments>(),
MenuChild.Separator,
MenuChild.Command<RemoveRegions>(),
},
],
};
}
14 changes: 7 additions & 7 deletions New_Extensibility_Model/Samples/CommentRemover/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ internal class RemoveAllComments : CommentRemoverCommand
{
Icon = new(ImageMoniker.KnownValues.Uncomment, IconSettings.IconAndText),
EnabledWhen = CommandEnabledWhen,
Shortcuts = new[] { new CommandShortcutConfiguration(ModifierKey.Control, Key.K, ModifierKey.Control, Key.Q) },
Shortcuts = [new CommandShortcutConfiguration(ModifierKey.Control, Key.K, ModifierKey.Control, Key.Q)],
};

public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken)
Expand All @@ -57,12 +57,12 @@ internal static class ExtensionCommandConfiguration
[VisualStudioContribution]
public static MenuConfiguration CommentRemoverMenu => new("%CommentRemover.CommentRemoverMenu.DisplayName%")
{
Placements = new[]
{
Placements =
[
CommandPlacement.KnownPlacements.ExtensionsMenu.WithPriority(0x01),
},
Children = new[]
{
],
Children =
[
MenuChild.Command<RemoveAllComments>(),
MenuChild.Command<RemoveXmlDocComments>(),
MenuChild.Command<RemoveAllExceptXmlDocComments>(),
Expand All @@ -71,7 +71,7 @@ internal static class ExtensionCommandConfiguration
MenuChild.Command<RemoveAllExceptTaskComments>(),
MenuChild.Separator,
MenuChild.Command<RemoveRegions>(),
},
],
};
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public RemoveAllComments(
{
Icon = new(ImageMoniker.KnownValues.Uncomment, IconSettings.IconAndText),
EnabledWhen = CommandEnabledWhen,
Shortcuts = new[] { new CommandShortcutConfiguration(ModifierKey.Control, Key.K, ModifierKey.Control, Key.Q) },
Shortcuts = [new CommandShortcutConfiguration(ModifierKey.Control, Key.K, ModifierKey.Control, Key.Q)],
};

public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
<PropertyGroup>
<TargetFramework>net8.0-windows8.0</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>11</LangVersion>
<LangVersion>12</LangVersion>
<NeutralLanguage>en-US</NeutralLanguage>

<!-- The VisualStudio.Extensibility preview packages are available from the azure-public/vside/msft_consumption feed -->
<RestoreAdditionalProjectSources>https://pkgs.dev.azure.com/azure-public/vside/_packaging/msft_consumption/nuget/v3/index.json;$(RestoreAdditionalProjectSources)</RestoreAdditionalProjectSources>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.9.1068-preview-2" />
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.9.1068-preview-2" />
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.9.2092" />
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.9.2092" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class MyDialogCommand : Command
/// <inheritdoc />
public override CommandConfiguration CommandConfiguration => new("%DialogSample.MyDialogCommand.DisplayName%")
{
Placements = new[] { CommandPlacement.KnownPlacements.ToolsMenu },
Placements = [CommandPlacement.KnownPlacements.ToolsMenu],
Icon = new(ImageMoniker.KnownValues.Dialog, IconSettings.IconAndText),
};

Expand Down
2 changes: 1 addition & 1 deletion New_Extensibility_Model/Samples/DialogSample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The `CommandConfiguration` property defines information about the command that a
```csharp
public override CommandConfiguration CommandConfiguration => new("%DialogSample.MyDialogCommand.DisplayName%")
{
Placements = new[] { CommandPlacement.KnownPlacements.ToolsMenu },
Placements = [CommandPlacement.KnownPlacements.ToolsMenu],
Icon = new(ImageMoniker.KnownValues.Dialog, IconSettings.IconAndText),
};
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
<PropertyGroup>
<TargetFramework>net8.0-windows8.0</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>11</LangVersion>
<LangVersion>12</LangVersion>
<NeutralLanguage>en-US</NeutralLanguage>

<!-- The VisualStudio.Extensibility preview packages are available from the azure-public/vside/msft_consumption feed -->
<RestoreAdditionalProjectSources>https://pkgs.dev.azure.com/azure-public/vside/_packaging/msft_consumption/nuget/v3/index.json;$(RestoreAdditionalProjectSources)</RestoreAdditionalProjectSources>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.9.1068-preview-2" />
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.9.1068-preview-2" />
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.9.2092" />
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.9.2092" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ The extension emulates running unit tests on background when user opens any C# f
/// <inheritdoc />
public TextViewExtensionConfiguration TextViewExtensionConfiguration => new()
{
AppliesTo = new[]
{
DocumentFilter.FromGlobPattern("**/tests/*.cs", relativePath: false),
},
AppliesTo =
[
DocumentFilter.FromGlobPattern("**/tests/*.cs", relativePath: false),
],
};
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace DocumentSelectorSample;
/// This text view event listener monitors users opening/modifying/closing C# files in "tests" folder and emulates running
/// unit tests in these files.
/// </summary>
#pragma warning disable VSEXTPREVIEW_OUTPUTWINDOW // Type is for evaluation purposes only and is subject to change or removal in future updates.
[VisualStudioContribution]
internal class UnitTestRunner : ExtensionPart, ITextViewOpenClosedListener, ITextViewChangedListener
{
Expand All @@ -33,10 +34,10 @@ public UnitTestRunner(Extension extension, VisualStudioExtensibility extensibili
/// <inheritdoc />
public TextViewExtensionConfiguration TextViewExtensionConfiguration => new()
{
AppliesTo = new[]
{
AppliesTo =
[
DocumentFilter.FromGlobPattern("**/tests/*.cs", relativePath: false),
},
],
};

/// <inheritdoc />
Expand Down Expand Up @@ -77,20 +78,17 @@ private async Task StopUnitTestsAsync(ITextViewSnapshot textViewSnapshot, Cancel

private async Task<OutputWindow> GetOutputWindowAsync(CancellationToken cancellationToken)
{
#pragma warning disable VSEXTAPI0001 // This API is marked as Preview.
return this.outputWindow ??= await this.Extensibility.Views().Output.GetChannelAsync(
identifier: nameof(DocumentSelectorSample),
displayNameResourceId: nameof(Resources.OutputWindowPaneName),
cancellationToken);
#pragma warning restore VSEXTAPI0001 // This API is marked as Preview.
}

private async Task WriteToOutputWindowAsync(string message, CancellationToken cancellationToken)
{
var channel = await this.GetOutputWindowAsync(cancellationToken);
Assumes.NotNull(channel);
#pragma warning disable VSEXTAPI0001 // This API is marked as Preview.
await channel.Writer.WriteLineAsync(message);
#pragma warning restore VSEXTAPI0001 // This API is marked as Preview.
}
}
#pragma warning restore VSEXTPREVIEW_OUTPUTWINDOW // Type is for evaluation purposes only and is subject to change or removal in future updates.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public EditorMarginTest(VisualStudioExtensibility extensibility)
[VisualStudioContribution]
public static DocumentTypeConfiguration WordsDocumentType => new(FileExtension)
{
FileExtensions = new[] { "." + FileExtension },
FileExtensions = ["." + FileExtension],
BaseDocumentType = DocumentType.KnownValues.Text,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ internal class WordCountMarginProvider : ExtensionPart, ITextViewMarginProvider,
/// <inheritdoc />
public TextViewExtensionConfiguration TextViewExtensionConfiguration => new()
{
AppliesTo = new[]
{
AppliesTo =
[
DocumentFilter.FromDocumentType(EditorMarginTest.WordsDocumentType),
},
],
};

/// <inheritdoc />
public TextViewMarginProviderConfiguration TextViewMarginProviderConfiguration =>
new(marginContainer: ContainerMarginPlacement.KnownValues.BottomRightCorner)
{
Before = new[] { MarginPlacement.KnownValues.RowMargin },
Before = [MarginPlacement.KnownValues.RowMargin],
};

/// <inheritdoc />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<PropertyGroup>
<TargetFramework>net8.0-windows8.0</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>11</LangVersion>
<LangVersion>12</LangVersion>
<NeutralLanguage>en-US</NeutralLanguage>

<!-- The VisualStudio.Extensibility preview packages are available from the azure-public/vside/msft_consumption feed -->
<RestoreAdditionalProjectSources>https://pkgs.dev.azure.com/azure-public/vside/_packaging/msft_consumption/nuget/v3/index.json;$(RestoreAdditionalProjectSources)</RestoreAdditionalProjectSources>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.9.1068-preview-2" />
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.9.1068-preview-2" />
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.9.2092" />
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.9.2092" />
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol" Version="17.2.8" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ public LanguageServerTest(VisualStudioExtensibility extensibility)
}

[VisualStudioContribution]
#pragma warning disable VSEXTAPI0001 // This API is marked as Preview.
#pragma warning disable VSEXTPREVIEW_LSP // Type is for evaluation purposes only and is subject to change or removal in future updates.
public static DocumentTypeConfiguration TodosDocumentType => new(FileExtension)
{
FileExtensions = new[] { "." + FileExtension },
FileExtensions = ["." + FileExtension],
BaseDocumentType = LanguageServerProvider.LanguageServerBaseDocumentType,
};
#pragma warning restore VSEXTAPI0001 // This API is marked as Preview.
#pragma warning restore VSEXTPREVIEW_LSP // Type is for evaluation purposes only and is subject to change or removal in future updates.

[DataMember]
public override string ButtonText => "Language Server";
Expand Down
Loading

0 comments on commit ec871c8

Please sign in to comment.