提交 1ac495de 编写于 作者: M Manish Vasani

Merge remote-tracking branch 'upstream/master' into EnforceRemoveUnusedParameter

......@@ -231,6 +231,8 @@ dotnet_diagnostic.IDE0005.severity = warning
# IDE0011: Add braces
csharp_prefer_braces = when_multiline:warning
# NOTE: We need the below severity entry for Add Braces due to https://github.com/dotnet/roslyn/issues/44201
dotnet_diagnostic.IDE0011.severity = warning
# IDE0035: Remove unreachable code
dotnet_diagnostic.IDE0035.severity = warning
......
......@@ -72,7 +72,11 @@ private static bool InvalidLevel(int? level)
case SyntaxKind.NamespaceDeclaration:
{
var ns = (NamespaceDeclarationSyntax)node;
foreach (var decl in ns.Members) ComputeDeclarations(model, decl, shouldSkip, getSymbol, builder, newLevel, cancellationToken);
foreach (var decl in ns.Members)
{
ComputeDeclarations(model, decl, shouldSkip, getSymbol, builder, newLevel, cancellationToken);
}
var declInfo = GetDeclarationInfo(model, node, getSymbol, cancellationToken);
builder.Add(declInfo);
......@@ -94,7 +98,11 @@ private static bool InvalidLevel(int? level)
case SyntaxKind.InterfaceDeclaration:
{
var t = (TypeDeclarationSyntax)node;
foreach (var decl in t.Members) ComputeDeclarations(model, decl, shouldSkip, getSymbol, builder, newLevel, cancellationToken);
foreach (var decl in t.Members)
{
ComputeDeclarations(model, decl, shouldSkip, getSymbol, builder, newLevel, cancellationToken);
}
var attributes = GetAttributes(t.AttributeLists).Concat(GetTypeParameterListAttributes(t.TypeParameterList));
builder.Add(GetDeclarationInfo(model, node, getSymbol, attributes, cancellationToken));
return;
......@@ -103,7 +111,11 @@ private static bool InvalidLevel(int? level)
case SyntaxKind.EnumDeclaration:
{
var t = (EnumDeclarationSyntax)node;
foreach (var decl in t.Members) ComputeDeclarations(model, decl, shouldSkip, getSymbol, builder, newLevel, cancellationToken);
foreach (var decl in t.Members)
{
ComputeDeclarations(model, decl, shouldSkip, getSymbol, builder, newLevel, cancellationToken);
}
var attributes = GetAttributes(t.AttributeLists);
builder.Add(GetDeclarationInfo(model, node, getSymbol, attributes, cancellationToken));
return;
......@@ -133,7 +145,10 @@ private static bool InvalidLevel(int? level)
var t = (EventDeclarationSyntax)node;
if (t.AccessorList != null)
{
foreach (var decl in t.AccessorList.Accessors) ComputeDeclarations(model, decl, shouldSkip, getSymbol, builder, newLevel, cancellationToken);
foreach (var decl in t.AccessorList.Accessors)
{
ComputeDeclarations(model, decl, shouldSkip, getSymbol, builder, newLevel, cancellationToken);
}
}
var attributes = GetAttributes(t.AttributeLists);
builder.Add(GetDeclarationInfo(model, node, getSymbol, attributes, cancellationToken));
......@@ -170,7 +185,10 @@ private static bool InvalidLevel(int? level)
var t = (PropertyDeclarationSyntax)node;
if (t.AccessorList != null)
{
foreach (var decl in t.AccessorList.Accessors) ComputeDeclarations(model, decl, shouldSkip, getSymbol, builder, newLevel, cancellationToken);
foreach (var decl in t.AccessorList.Accessors)
{
ComputeDeclarations(model, decl, shouldSkip, getSymbol, builder, newLevel, cancellationToken);
}
}
if (t.ExpressionBody != null)
......@@ -259,7 +277,10 @@ private static bool InvalidLevel(int? level)
case SyntaxKind.CompilationUnit:
{
var t = (CompilationUnitSyntax)node;
foreach (var decl in t.Members) ComputeDeclarations(model, decl, shouldSkip, getSymbol, builder, newLevel, cancellationToken);
foreach (var decl in t.Members)
{
ComputeDeclarations(model, decl, shouldSkip, getSymbol, builder, newLevel, cancellationToken);
}
if (t.AttributeLists.Any())
{
......
......@@ -1879,6 +1879,7 @@ public override BoundNode VisitAddressOfOperator(BoundAddressOfOperator node)
return null;
}
#nullable enable
protected override void WriteArgument(BoundExpression arg, RefKind refKind, MethodSymbol method)
{
if (refKind == RefKind.Ref)
......@@ -1895,11 +1896,12 @@ protected override void WriteArgument(BoundExpression arg, RefKind refKind, Meth
// we assume that external method may write and/or read all of its fields (recursively).
// Strangely, the native compiler requires the "ref", even for reference types, to exhibit
// this behavior.
if (refKind != RefKind.None && ((object)method == null || method.IsExtern))
if (refKind != RefKind.None && ((object)method == null || method.IsExtern) && arg.Type is TypeSymbol type)
{
MarkFieldsUsed(arg.Type);
MarkFieldsUsed(type);
}
}
#nullable restore
protected void CheckAssigned(BoundExpression expr, SyntaxNode node)
{
......@@ -1936,6 +1938,7 @@ protected void CheckAssigned(BoundExpression expr, SyntaxNode node)
}
}
#nullable enable
private void MarkFieldsUsed(TypeSymbol type)
{
switch (type.TypeKind)
......@@ -1951,9 +1954,7 @@ private void MarkFieldsUsed(TypeSymbol type)
return;
}
var namedType = (NamedTypeSymbol)type;
var assembly = type.ContainingAssembly as SourceAssemblySymbol;
if ((object)assembly == null)
if (!(type.ContainingAssembly is SourceAssemblySymbol assembly))
{
return; // could be retargeting assembly
}
......@@ -1961,6 +1962,7 @@ private void MarkFieldsUsed(TypeSymbol type)
var seen = assembly.TypesReferencedInExternalMethods;
if (seen.Add(type))
{
var namedType = (NamedTypeSymbol)type;
foreach (var symbol in namedType.GetMembersUnordered())
{
if (symbol.Kind != SymbolKind.Field)
......@@ -1976,6 +1978,7 @@ private void MarkFieldsUsed(TypeSymbol type)
return;
}
}
#nullable restore
public override BoundNode VisitBaseReference(BoundBaseReference node)
{
......
......@@ -990,6 +990,19 @@ void M()
Diagnostic(ErrorCode.ERR_RefLocalOrParamExpected, "P").WithLocation(8, 9));
}
[Fact, WorkItem(44153, "https://github.com/dotnet/roslyn/issues/44153")]
public void RefErrorProperty()
{
CreateCompilation(@"
public class C {
public ref ERROR Prop => throw null!;
}
").VerifyEmitDiagnostics(
// (3,16): error CS0246: The type or namespace name 'ERROR' could not be found (are you missing a using directive or an assembly reference?)
// public ref ERROR Prop => throw null!;
Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "ERROR").WithArguments("ERROR").WithLocation(3, 16));
}
[Fact]
public void RefReadonlyOnlyIn72()
{
......
......@@ -163,7 +163,7 @@ internal class SerializableSourceReferenceItem
{
public int DefinitionId;
public SerializableDocumentSpan SourceSpan;
public SymbolUsageInfo SymbolUsageInfo;
public SerializableSymbolUsageInfo SymbolUsageInfo;
public (string Key, string Value)[] AdditionalProperties;
public static SerializableSourceReferenceItem Dehydrate(
......@@ -173,7 +173,7 @@ internal class SerializableSourceReferenceItem
{
DefinitionId = definitionId,
SourceSpan = SerializableDocumentSpan.Dehydrate(item.SourceSpan),
SymbolUsageInfo = item.SymbolUsageInfo,
SymbolUsageInfo = SerializableSymbolUsageInfo.Dehydrate(item.SymbolUsageInfo),
AdditionalProperties = item.AdditionalProperties.Select(kvp => (kvp.Key, kvp.Value)).ToArray(),
};
}
......@@ -183,7 +183,7 @@ public SourceReferenceItem Rehydrate(Solution solution, DefinitionItem definitio
return new SourceReferenceItem(
definition,
SourceSpan.Rehydrate(solution),
SymbolUsageInfo,
SymbolUsageInfo.Rehydrate(),
AdditionalProperties.ToImmutableDictionary(t => t.Key, t => t.Value));
}
}
......
......@@ -98,8 +98,10 @@ public bool TryConvert(out DocumentUpdateInfo documentUpdateInfo)
{
if (!documentUpdateInfo.Source.IsParentKind(SyntaxKind.Block) &&
documentUpdateInfo.Destinations.Length > 1)
{
documentUpdateInfo = new DocumentUpdateInfo(documentUpdateInfo.Source, SyntaxFactory.Block(documentUpdateInfo.Destinations));
}
return true;
}
......
......@@ -155,7 +155,9 @@ where m.IsAccessibleWithin(enclosingType)
{
if (!CanFix(semanticModel, diagnostic, cancellationToken,
out var nameNode, out var matchingMember, out _))
{
continue;
}
var newNameNode = matchingMember.Name.ToIdentifierName();
var newExpr = (ExpressionSyntax)newNameNode;
......
......@@ -419,8 +419,10 @@ private int GetFirstStatementAffectedIndex(SyntaxNode innermostCommonBlock, ISet
var nextStatementLeading = nextStatement.GetLeadingTrivia();
var precedingEndOfLine = nextStatementLeading.LastOrDefault(t => t.Kind() == SyntaxKind.EndOfLineTrivia);
if (precedingEndOfLine == default)
{
return oldStatements.ReplaceRange(
nextStatement, new[] { newStatement, nextStatement });
}
var endOfLineIndex = nextStatementLeading.IndexOf(precedingEndOfLine) + 1;
......
......@@ -53,7 +53,9 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte
if (declaration == null ||
declaration.Variables.Count != 1 ||
forStatement.Incrementors.Count != 1)
{
return;
}
var variable = declaration.Variables[0];
var after = forStatement.Incrementors[0];
......
......@@ -93,7 +93,9 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
// issue there.
if (startTrivia.RawKind == _syntaxKinds.ConflictMarkerTrivia ||
middleTrivia.RawKind == _syntaxKinds.ConflictMarkerTrivia)
{
return false;
}
}
return true;
......
......@@ -131,7 +131,7 @@ public Task<ImmutableArray<DiagnosticData>> GetDiagnosticsAsync(Solution solutio
return SpecializedTasks.EmptyImmutableArray<DiagnosticData>();
}
public async Task ForceAnalyzeAsync(Solution solution, ProjectId? projectId = null, CancellationToken cancellationToken = default)
public async Task ForceAnalyzeAsync(Solution solution, Action<Project> onProjectAnalyzed, ProjectId? projectId = null, CancellationToken cancellationToken = default)
{
if (_map.TryGetValue(solution.Workspace, out var analyzer))
{
......@@ -141,6 +141,7 @@ public async Task ForceAnalyzeAsync(Solution solution, ProjectId? projectId = nu
if (project != null)
{
await analyzer.ForceAnalyzeProjectAsync(project, cancellationToken).ConfigureAwait(false);
onProjectAnalyzed(project);
}
}
else
......@@ -149,8 +150,11 @@ public async Task ForceAnalyzeAsync(Solution solution, ProjectId? projectId = nu
var index = 0;
foreach (var project in solution.Projects)
{
tasks[index++] = Task.Run(
() => analyzer.ForceAnalyzeProjectAsync(project, cancellationToken));
tasks[index++] = Task.Run(async () =>
{
await analyzer.ForceAnalyzeProjectAsync(project, cancellationToken).ConfigureAwait(false);
onProjectAnalyzed(project);
});
}
await Task.WhenAll(tasks).ConfigureAwait(false);
......
......@@ -43,7 +43,7 @@ internal interface IDiagnosticAnalyzerService
/// <summary>
/// Force computes diagnostics and raises diagnostic events for the given project or solution. all diagnostics returned should be up-to-date with respect to the given project or solution.
/// </summary>
Task ForceAnalyzeAsync(Solution solution, ProjectId? projectId = null, CancellationToken cancellationToken = default);
Task ForceAnalyzeAsync(Solution solution, Action<Project> onProjectAnalyzed, ProjectId? projectId = null, CancellationToken cancellationToken = default);
/// <summary>
/// True if given project has any diagnostics
......
......@@ -269,7 +269,9 @@ private static bool CharInClassInternal(char ch, string set, int start, int mySe
// reverse this check.
Debug.Assert((SETSTART & 0x1) == 1, "If SETSTART is not odd, the calculation below this will be reversed");
if ((min & 0x1) == (start & 0x1))
{
return true;
}
else
{
if (myCategoryLength == 0)
......@@ -302,7 +304,9 @@ private static bool CharInCategory(char ch, string set, int start, int mySetLeng
if (curcat == SpaceConst)
{
if (char.IsWhiteSpace(ch))
{
return true;
}
else
{
i++;
......@@ -320,7 +324,9 @@ private static bool CharInCategory(char ch, string set, int start, int mySetLeng
if (curcat == NotSpaceConst)
{
if (!char.IsWhiteSpace(ch))
{
return true;
}
else
{
i++;
......
......@@ -199,29 +199,30 @@ public void RunAnalyzers(IVsHierarchy? hierarchy)
string? projectOrSolutionName = project?.Name ?? PathUtilities.GetFileName(solution.FilePath);
// Add a message to VS status bar that we are running code analysis.
var statusMessage = projectOrSolutionName != null
? string.Format(ServicesVSResources.Running_code_analysis_for_0, projectOrSolutionName)
: ServicesVSResources.Running_code_analysis_for_Solution;
var statusBar = _serviceProvider?.GetService(typeof(SVsStatusbar)) as IVsStatusbar;
statusBar?.SetText(statusMessage);
var totalProjectCount = project != null ? 1 : (uint)solution.ProjectIds.Count;
var statusBarUpdater = statusBar != null ?
new StatusBarUpdater(statusBar, _threadingContext, projectOrSolutionName, totalProjectCount) :
null;
// Force complete analyzer execution in background.
var asyncToken = _listener.BeginAsyncOperation($"{nameof(VisualStudioDiagnosticAnalyzerService)}_{nameof(RunAnalyzers)}");
Task.Run(async () =>
{
await _diagnosticService.ForceAnalyzeAsync(solution, project?.Id, CancellationToken.None).ConfigureAwait(false);
// If user has disabled live analyzer execution for any project(s), i.e. set RunAnalyzersDuringLiveAnalysis = false,
// then ForceAnalyzeAsync will not cause analyzers to execute.
// We explicitly fetch diagnostics for such projects and report these as "Host" diagnostics.
HandleProjectsWithDisabledAnalysis();
try
{
var onProjectAnalyzed = statusBarUpdater != null ? statusBarUpdater.OnProjectAnalyzed : (Action<Project>)((Project _) => { });
await _diagnosticService.ForceAnalyzeAsync(solution, onProjectAnalyzed, project?.Id, CancellationToken.None).ConfigureAwait(false);
// Add a message to VS status bar that we completed executing code analysis.
await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync();
var notificationMesage = projectOrSolutionName != null
? string.Format(ServicesVSResources.Code_analysis_completed_for_0, projectOrSolutionName)
: ServicesVSResources.Code_analysis_completed_for_Solution;
statusBar?.SetText(notificationMesage);
// If user has disabled live analyzer execution for any project(s), i.e. set RunAnalyzersDuringLiveAnalysis = false,
// then ForceAnalyzeAsync will not cause analyzers to execute.
// We explicitly fetch diagnostics for such projects and report these as "Host" diagnostics.
HandleProjectsWithDisabledAnalysis();
}
finally
{
statusBarUpdater?.Dispose();
}
}).CompletesAsyncOperation(asyncToken);
return;
......@@ -348,5 +349,94 @@ private bool IsBuildActive()
}
}
}
private sealed class StatusBarUpdater : IDisposable
{
private readonly IVsStatusbar _statusBar;
private readonly IThreadingContext _threadingContext;
private readonly uint _totalProjectCount;
private readonly string _statusMessageWhileRunning;
private readonly string _statusMesageOnCompleted;
private readonly string _statusMesageOnTerminated;
private readonly Timer _timer;
private int _analyzedProjectCount;
private bool _disposed;
private uint _statusBarCookie;
public StatusBarUpdater(IVsStatusbar statusBar, IThreadingContext threadingContext, string? projectOrSolutionName, uint totalProjectCount)
{
Contract.ThrowIfFalse(threadingContext.HasMainThread);
_statusBar = statusBar;
_threadingContext = threadingContext;
_totalProjectCount = totalProjectCount;
_statusMessageWhileRunning = projectOrSolutionName != null
? string.Format(ServicesVSResources.Running_code_analysis_for_0, projectOrSolutionName)
: ServicesVSResources.Running_code_analysis_for_Solution;
_statusMesageOnCompleted = projectOrSolutionName != null
? string.Format(ServicesVSResources.Code_analysis_completed_for_0, projectOrSolutionName)
: ServicesVSResources.Code_analysis_completed_for_Solution;
_statusMesageOnTerminated = projectOrSolutionName != null
? string.Format(ServicesVSResources.Code_analysis_terminated_before_completion_for_0, projectOrSolutionName)
: ServicesVSResources.Code_analysis_terminated_before_completion_for_Solution;
// Set the initial status bar progress and text.
_statusBar.Progress(ref _statusBarCookie, fInProgress: 1, _statusMessageWhileRunning, nComplete: 0, nTotal: totalProjectCount);
_statusBar.SetText(_statusMessageWhileRunning);
// Create a timer to periodically update the status message while running analysis.
_timer = new Timer(new TimerCallback(UpdateStatusOnTimer), new AutoResetEvent(false),
dueTime: TimeSpan.FromSeconds(5), period: TimeSpan.FromSeconds(5));
}
internal void OnProjectAnalyzed(Project _)
{
Interlocked.Increment(ref _analyzedProjectCount);
UpdateStatusCore();
}
// Add a message to VS status bar that we are running code analysis.
private void UpdateStatusOnTimer(object state)
=> UpdateStatusCore();
public void Dispose()
{
_timer.Dispose();
_disposed = true;
UpdateStatusCore();
}
private void UpdateStatusCore()
{
_threadingContext.JoinableTaskFactory.RunAsync(async () =>
{
await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync();
string message;
int fInProgress;
var analyzedProjectCount = (uint)_analyzedProjectCount;
if (analyzedProjectCount == _totalProjectCount)
{
message = _statusMesageOnCompleted;
fInProgress = 0;
}
else if (_disposed)
{
message = _statusMesageOnTerminated;
fInProgress = 0;
}
else
{
message = _statusMessageWhileRunning;
fInProgress = 1;
}
// Update the status bar progress and text.
_statusBar.Progress(ref _statusBarCookie, fInProgress, message, analyzedProjectCount, _totalProjectCount);
_statusBar.SetText(message);
});
}
}
}
}
......@@ -93,16 +93,19 @@ public static void ReportNonFatal(Exception exception)
exceptionObject: exception,
gatherEventDetails: faultUtility =>
{
// add current process dump
faultUtility.AddProcessDump(currentProcess.Id);
// add ServiceHub log files:
foreach (var path in CollectServiceHubLogFilePaths())
if (faultUtility is FaultEvent { IsIncludedInWatsonSample: true })
{
faultUtility.AddFile(path);
// add ServiceHub log files:
foreach (var path in CollectServiceHubLogFilePaths())
{
faultUtility.AddFile(path);
}
}
// Returning "0" signals that we should send data to Watson; any other value will cancel the Watson report.
// Returning "0" signals that, if sampled, we should send data to Watson.
// Any other value will cancel the Watson report. We never want to trigger a process dump manually,
// we'll let TargetedNotifications determine if a dump should be collected.
// See https://aka.ms/roslynnfwdocs for more details
return 0;
});
......
......@@ -1344,6 +1344,12 @@ I agree to all of the foregoing:</value>
<data name="Code_analysis_completed_for_Solution" xml:space="preserve">
<value>Code analysis completed for Solution.</value>
</data>
<data name="Code_analysis_terminated_before_completion_for_0" xml:space="preserve">
<value>Code analysis terminated before completion for '{0}'.</value>
</data>
<data name="Code_analysis_terminated_before_completion_for_Solution" xml:space="preserve">
<value>Code analysis terminated before completion for Solution.</value>
</data>
<data name="Background_analysis_scope_colon" xml:space="preserve">
<value>Background analysis scope:</value>
</data>
......
......@@ -122,6 +122,16 @@
<target state="translated">Dokončila se analýza kódu pro řešení.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_0">
<source>Code analysis terminated before completion for '{0}'.</source>
<target state="new">Code analysis terminated before completion for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_Solution">
<source>Code analysis terminated before completion for Solution.</source>
<target state="new">Code analysis terminated before completion for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
<source>Colorize regular expressions</source>
<target state="translated">Obarvit regulární výrazy</target>
......
......@@ -122,6 +122,16 @@
<target state="translated">Die Codeanalyse für die Projektmappe wurde abgeschlossen.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_0">
<source>Code analysis terminated before completion for '{0}'.</source>
<target state="new">Code analysis terminated before completion for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_Solution">
<source>Code analysis terminated before completion for Solution.</source>
<target state="new">Code analysis terminated before completion for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
<source>Colorize regular expressions</source>
<target state="translated">Reguläre Ausdrücke farbig hervorheben</target>
......
......@@ -122,6 +122,16 @@
<target state="translated">El análisis de código se ha completado para la solución.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_0">
<source>Code analysis terminated before completion for '{0}'.</source>
<target state="new">Code analysis terminated before completion for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_Solution">
<source>Code analysis terminated before completion for Solution.</source>
<target state="new">Code analysis terminated before completion for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
<source>Colorize regular expressions</source>
<target state="translated">Colorear expresiones regulares</target>
......
......@@ -122,6 +122,16 @@
<target state="translated">Analyse du code effectuée pour la solution.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_0">
<source>Code analysis terminated before completion for '{0}'.</source>
<target state="new">Code analysis terminated before completion for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_Solution">
<source>Code analysis terminated before completion for Solution.</source>
<target state="new">Code analysis terminated before completion for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
<source>Colorize regular expressions</source>
<target state="translated">Coloriser les expressions régulières</target>
......
......@@ -122,6 +122,16 @@
<target state="translated">Analisi codice completata per la soluzione.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_0">
<source>Code analysis terminated before completion for '{0}'.</source>
<target state="new">Code analysis terminated before completion for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_Solution">
<source>Code analysis terminated before completion for Solution.</source>
<target state="new">Code analysis terminated before completion for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
<source>Colorize regular expressions</source>
<target state="translated">Colora espressioni regolari</target>
......
......@@ -122,6 +122,16 @@
<target state="translated">ソリューションのコード分析が完了しました。</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_0">
<source>Code analysis terminated before completion for '{0}'.</source>
<target state="new">Code analysis terminated before completion for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_Solution">
<source>Code analysis terminated before completion for Solution.</source>
<target state="new">Code analysis terminated before completion for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
<source>Colorize regular expressions</source>
<target state="translated">正規表現をカラー化</target>
......
......@@ -122,6 +122,16 @@
<target state="translated">솔루션에 대한 코드 분석이 완료되었습니다.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_0">
<source>Code analysis terminated before completion for '{0}'.</source>
<target state="new">Code analysis terminated before completion for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_Solution">
<source>Code analysis terminated before completion for Solution.</source>
<target state="new">Code analysis terminated before completion for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
<source>Colorize regular expressions</source>
<target state="translated">정규식 색 지정</target>
......
......@@ -122,6 +122,16 @@
<target state="translated">Ukończono analizę kodu dla rozwiązania.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_0">
<source>Code analysis terminated before completion for '{0}'.</source>
<target state="new">Code analysis terminated before completion for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_Solution">
<source>Code analysis terminated before completion for Solution.</source>
<target state="new">Code analysis terminated before completion for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
<source>Colorize regular expressions</source>
<target state="translated">Koloruj wyrażenia regularne</target>
......
......@@ -122,6 +122,16 @@
<target state="translated">Análise de código concluída para a Solução.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_0">
<source>Code analysis terminated before completion for '{0}'.</source>
<target state="new">Code analysis terminated before completion for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_Solution">
<source>Code analysis terminated before completion for Solution.</source>
<target state="new">Code analysis terminated before completion for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
<source>Colorize regular expressions</source>
<target state="translated">Colorir expressões regulares</target>
......
......@@ -122,6 +122,16 @@
<target state="translated">Анализ кода для решения выполнен.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_0">
<source>Code analysis terminated before completion for '{0}'.</source>
<target state="new">Code analysis terminated before completion for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_Solution">
<source>Code analysis terminated before completion for Solution.</source>
<target state="new">Code analysis terminated before completion for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
<source>Colorize regular expressions</source>
<target state="translated">Выделить регулярные выражения цветом</target>
......
......@@ -122,6 +122,16 @@
<target state="translated">Çözüm için kod analizi tamamlandı.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_0">
<source>Code analysis terminated before completion for '{0}'.</source>
<target state="new">Code analysis terminated before completion for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_Solution">
<source>Code analysis terminated before completion for Solution.</source>
<target state="new">Code analysis terminated before completion for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
<source>Colorize regular expressions</source>
<target state="translated">Normal ifadeleri renklendir</target>
......
......@@ -122,6 +122,16 @@
<target state="translated">解决方案的代码分析已完成。</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_0">
<source>Code analysis terminated before completion for '{0}'.</source>
<target state="new">Code analysis terminated before completion for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_Solution">
<source>Code analysis terminated before completion for Solution.</source>
<target state="new">Code analysis terminated before completion for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
<source>Colorize regular expressions</source>
<target state="translated">为正规表达式着色</target>
......
......@@ -122,6 +122,16 @@
<target state="translated">解決方案的程式碼分析已完成。</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_0">
<source>Code analysis terminated before completion for '{0}'.</source>
<target state="new">Code analysis terminated before completion for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_terminated_before_completion_for_Solution">
<source>Code analysis terminated before completion for Solution.</source>
<target state="new">Code analysis terminated before completion for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
<source>Colorize regular expressions</source>
<target state="translated">為規則運算式添加色彩</target>
......
......@@ -508,7 +508,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics
Throw New NotImplementedException()
End Function
Public Function ForceAnalyzeAsync(solution As Solution, Optional projectId As ProjectId = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task Implements IDiagnosticAnalyzerService.ForceAnalyzeAsync
Public Function ForceAnalyzeAsync(solution As Solution, onProjectAnalyzed As Action(Of Project), Optional projectId As ProjectId = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task Implements IDiagnosticAnalyzerService.ForceAnalyzeAsync
Throw New NotImplementedException()
End Function
End Class
......
......@@ -237,8 +237,10 @@ internal async Task<Solution> SimplifyAsync(Solution solution, IEnumerable<Docum
var builder = ImmutableDictionary.CreateBuilder<DocumentId, ImmutableArray<ComplexifiedSpan>>();
foreach (var (docId, spans) in _documentToComplexifiedSpansMap)
{
builder.Add(docId, spans.SelectAsArray(
s => new ComplexifiedSpan(s.OriginalSpan, s.NewSpan, s.ModifiedSubSpans.ToImmutableArray())));
}
return builder.ToImmutable();
}
......
......@@ -68,7 +68,7 @@ public override void AddAnchorIndentationOperations(List<AnchorIndentationOperat
case AccessorDeclarationSyntax accessorDeclNode:
AddAnchorIndentationOperation(list, accessorDeclNode);
return;
case CSharpSyntaxNode switchExpressionArm when switchExpressionArm.IsKind(SyntaxKind.SwitchExpressionArm):
case SwitchExpressionArmSyntax switchExpressionArm:
// The expression in a switch expression arm should be anchored to the beginning of the arm
// ```
// e switch
......
......@@ -7,12 +7,10 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Formatting.Rules;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Shared.Utilities;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
......@@ -177,13 +175,8 @@ private void AddAlignmentBlockOperation(List<IndentBlockOperation> list, SyntaxN
case ImplicitArrayCreationExpressionSyntax implicitArrayCreation when implicitArrayCreation.Initializer != null:
SetAlignmentBlockOperation(list, implicitArrayCreation.NewKeyword, implicitArrayCreation.Initializer.OpenBraceToken, implicitArrayCreation.Initializer.CloseBraceToken, IndentBlockOption.RelativeToFirstTokenOnBaseTokenLine);
return;
case CSharpSyntaxNode syntaxNode when syntaxNode.IsKind(SyntaxKind.SwitchExpression):
SetAlignmentBlockOperation(
list,
syntaxNode.GetFirstToken(),
syntaxNode.ChildNodesAndTokens().First(child => child.IsKind(SyntaxKind.OpenBraceToken)).AsToken(),
syntaxNode.ChildNodesAndTokens().Last(child => child.IsKind(SyntaxKind.CloseBraceToken)).AsToken(),
IndentBlockOption.RelativeToFirstTokenOnBaseTokenLine);
case SwitchExpressionSyntax switchExpression:
SetAlignmentBlockOperation(list, switchExpression.GetFirstToken(), switchExpression.OpenBraceToken, switchExpression.CloseBraceToken, IndentBlockOption.RelativeToFirstTokenOnBaseTokenLine);
return;
}
}
......
......@@ -102,7 +102,9 @@ void AddSelectedFieldOrPropertyDeclarations(TMemberDeclarationSyntax member)
{
if (!(member is TFieldDeclarationSyntax) &&
!(member is TPropertyDeclarationSyntax))
{
return;
}
// first, check if entire member is selected. If so, we definitely include this member.
if (textSpan.Contains(member.Span))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册