Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove references to torn analyzers #75533

Merged
merged 5 commits into from
Oct 17, 2024
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
2 changes: 2 additions & 0 deletions eng/targets/Imports.targets
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
<RoslynCheckCodeStyle Condition="'$(RoslynCheckCodeStyle)' == '' AND '$(DisableNullableWarnings)' == 'true'">false</RoslynCheckCodeStyle>
<RoslynCheckCodeStyle Condition="'$(RoslynCheckCodeStyle)' == '' AND ('$(ContinuousIntegrationBuild)' != 'true' OR '$(RoslynEnforceCodeStyle)' == 'true')">true</RoslynCheckCodeStyle>

<EnforceCodeStyleInBuild Condition="'$(EnforceCodeStyleInBuild)' == '' AND '$(RoslynCheckCodeStyle)' == 'true'">true</EnforceCodeStyleInBuild>

<!--https://github.com/dotnet/sdk/issues/37826 -->
<MSBuildWarningsAsMessages Condition="'$(OutputType)' == 'Library'">$(MSBuildWarningsAsMessages);NETSDK1206</MSBuildWarningsAsMessages>
</PropertyGroup>
Expand Down
15 changes: 0 additions & 15 deletions eng/targets/Settings.props
Original file line number Diff line number Diff line change
Expand Up @@ -183,21 +183,6 @@
<GeneratePerformanceSensitiveAttribute>false</GeneratePerformanceSensitiveAttribute>
</PropertyGroup>

<!-- Language-specific analyzer packages -->
<Choose>
<When Condition="'$(Language)' == 'VB'">
<ItemGroup Condition="'$(RoslynCheckCodeStyle)' == 'true'">
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.CodeStyle" PrivateAssets="all" />
</ItemGroup>
</When>

<When Condition="'$(Language)' == 'C#'">
<ItemGroup Condition="'$(RoslynCheckCodeStyle)' == 'true'">
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeStyle" PrivateAssets="all" />
</ItemGroup>
</When>
</Choose>

<PropertyGroup Condition="'$(RoslynEnforceCodeStyle)' != 'true'">
<!-- Don't treat FormattingAnalyzer as an error, even when TreatWarningsAsErrors is specified. -->
<WarningsNotAsErrors>$(WarningsNotAsErrors);IDE0055</WarningsNotAsErrors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private async Task<Document> IntroduceUsingStatementAsync(

if (tryStatement != null &&
ShouldReplaceTryStatementWithUsing(
syntaxFacts, declarationStatement, variableName, tryStatement, out var tryStatements))
syntaxFacts, variableName, tryStatement, out var tryStatements))
{
var usingStatement = CreateUsingStatement(declarationStatement, tryStatements);

Expand Down Expand Up @@ -188,7 +188,6 @@ [.. surroundingStatements

private bool ShouldReplaceTryStatementWithUsing(
ISyntaxFactsService syntaxFacts,
TLocalDeclarationSyntax declarationStatement,
string variableName,
TTryStatementSyntax tryStatement,
out SyntaxList<TStatementSyntax> tryStatements)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ int IVsEditorFactoryNotify.NotifyItemAdded(uint grfEFN, IVsHierarchy pHier, uint
defaultDescription: "",
allowCancellation: false,
showProgress: false,
action: c => FormatDocumentCreatedFromTemplate(pHier, itemid, pszMkDocument, c.UserCancellationToken));
action: c => FormatDocumentCreatedFromTemplate(pHier, pszMkDocument, c.UserCancellationToken));
}

return VSConstants.S_OK;
Expand All @@ -249,10 +249,10 @@ int IVsEditorFactoryNotify.NotifyItemAdded(uint grfEFN, IVsHierarchy pHier, uint
int IVsEditorFactoryNotify.NotifyItemRenamed(IVsHierarchy pHier, uint itemid, string pszMkDocumentOld, string pszMkDocumentNew)
=> VSConstants.S_OK;

private void FormatDocumentCreatedFromTemplate(IVsHierarchy hierarchy, uint itemid, string filePath, CancellationToken cancellationToken)
private void FormatDocumentCreatedFromTemplate(IVsHierarchy hierarchy, string filePath, CancellationToken cancellationToken)
{
var threadingContext = _componentModel.GetService<IThreadingContext>();
threadingContext.JoinableTaskFactory.Run(() => FormatDocumentCreatedFromTemplateAsync(hierarchy, itemid, filePath, cancellationToken));
threadingContext.JoinableTaskFactory.Run(() => FormatDocumentCreatedFromTemplateAsync(hierarchy, filePath, cancellationToken));
}

// NOTE: This function has been created to hide IWinFormsEditorFactory type in non-WinForms scenarios (e.g. editing .cs or .vb file)
Expand Down Expand Up @@ -286,7 +286,7 @@ private int CreateWinFormsEditorInstance(
out pguidCmdUI);
}

private async Task FormatDocumentCreatedFromTemplateAsync(IVsHierarchy hierarchy, uint itemid, string filePath, CancellationToken cancellationToken)
private async Task FormatDocumentCreatedFromTemplateAsync(IVsHierarchy hierarchy, string filePath, CancellationToken cancellationToken)
{
// A file has been created on disk which the user added from the "Add Item" dialog. We need
// to include this in a workspace to figure out the right options it should be formatted with.
Expand Down