diff --git a/src/EditorFeatures/Core.Wpf/QuickInfo/OnTheFlyDocsView.xaml.cs b/src/EditorFeatures/Core.Wpf/QuickInfo/OnTheFlyDocsView.xaml.cs
index ccaa718ed4172..6a8bc27d8b5db 100644
--- a/src/EditorFeatures/Core.Wpf/QuickInfo/OnTheFlyDocsView.xaml.cs
+++ b/src/EditorFeatures/Core.Wpf/QuickInfo/OnTheFlyDocsView.xaml.cs
@@ -69,6 +69,9 @@ public OnTheFlyDocsView(ITextView textView, IViewElementFactoryService viewEleme
_document = onTheFlyDocsElement.Document;
var sparkle = new ImageElement(new VisualStudio.Core.Imaging.ImageId(CopilotConstants.CopilotIconMonikerGuid, CopilotConstants.CopilotIconSparkleId));
+ object onDemandLinkText = _onTheFlyDocsInfo.IsContentExcluded
+ ? ToUIElement(new ContainerElement(ContainerElementStyle.Wrapped, new ClassifiedTextElement([new ClassifiedTextRun(ClassificationTypeNames.Text, EditorFeaturesResources.Describe_with_Copilot_is_unavailable_since_the_referenced_document_is_excluded_by_your_organization)])))
+ : ClassifiedTextElement.CreateHyperlink(EditorFeaturesResources.Describe_with_Copilot, EditorFeaturesResources.Generate_summary_with_Copilot, () => RequestResults());
OnDemandLinkContent = ToUIElement(
new ContainerElement(
@@ -76,8 +79,7 @@ public OnTheFlyDocsView(ITextView textView, IViewElementFactoryService viewEleme
new object[]
{
sparkle,
- ClassifiedTextElement.CreateHyperlink(EditorFeaturesResources.Describe_with_Copilot, EditorFeaturesResources.Generate_summary_with_Copilot, () =>
- RequestResults()),
+ onDemandLinkText,
}));
LoadingContent = ToUIElement(
@@ -202,7 +204,6 @@ public void RequestResults()
CurrentState = OnTheFlyDocsState.Loading;
Logger.Log(FunctionId.Copilot_On_The_Fly_Docs_Loading_State_Entered, KeyValueLogMessage.Create(m =>
{
- m["SymbolHeaderText"] = _onTheFlyDocsInfo.SymbolSignature;
m["HasDocumentationComments"] = _onTheFlyDocsInfo.HasComments;
}, LogLevel.Information));
diff --git a/src/EditorFeatures/Core.Wpf/QuickInfo/OnTheFlyDocsViewFactory.cs b/src/EditorFeatures/Core.Wpf/QuickInfo/OnTheFlyDocsViewFactory.cs
index 7f0bd01daac96..35ee7beb5349d 100644
--- a/src/EditorFeatures/Core.Wpf/QuickInfo/OnTheFlyDocsViewFactory.cs
+++ b/src/EditorFeatures/Core.Wpf/QuickInfo/OnTheFlyDocsViewFactory.cs
@@ -48,10 +48,7 @@ public OnTheFlyDocsViewFactory(IViewElementFactoryService factoryService, IAsync
var onTheFlyDocsElement = (QuickInfoOnTheFlyDocsElement)model;
- Logger.Log(FunctionId.Copilot_On_The_Fly_Docs_Showed_Link, KeyValueLogMessage.Create(m =>
- {
- m["SymbolHeaderText"] = onTheFlyDocsElement.Info.SymbolSignature;
- }, LogLevel.Information));
+ Logger.Log(FunctionId.Copilot_On_The_Fly_Docs_Showed_Link, logLevel: LogLevel.Information);
var quickInfoSession = _asyncQuickInfoBroker.GetSession(textView);
diff --git a/src/EditorFeatures/Core/EditorFeaturesResources.resx b/src/EditorFeatures/Core/EditorFeaturesResources.resx
index 2935410db3198..ff479357f6a54 100644
--- a/src/EditorFeatures/Core/EditorFeaturesResources.resx
+++ b/src/EditorFeatures/Core/EditorFeaturesResources.resx
@@ -953,4 +953,7 @@ Do you want to proceed?
An error occurred while generating documentation for this code.
+
+ 'Describe with Copilot' is unavailable since the referenced document is excluded by your organization.
+
\ No newline at end of file
diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.cs.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.cs.xlf
index 368461da36dce..a25741b5f717c 100644
--- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.cs.xlf
+++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.cs.xlf
@@ -42,6 +42,11 @@
Popis s využitím Copilotu
+
+
+ 'Describe with Copilot' is unavailable since the referenced document is excluded by your organization.
+
+
Nepreferovat this. ani Me.
diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.de.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.de.xlf
index 73d17a0576a0b..12b3fca95419d 100644
--- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.de.xlf
+++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.de.xlf
@@ -42,6 +42,11 @@
Mit Copilot beschreiben
+
+
+ 'Describe with Copilot' is unavailable since the referenced document is excluded by your organization.
+
+
"this." oder "Me." nicht bevorzugen
diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.es.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.es.xlf
index a078c06273a14..e5ba499c82b8b 100644
--- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.es.xlf
+++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.es.xlf
@@ -42,6 +42,11 @@
Describir con Copilot
+
+
+ 'Describe with Copilot' is unavailable since the referenced document is excluded by your organization.
+
+
No preferir "this." ni "Me."
diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.fr.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.fr.xlf
index 71ec07f37b095..0b66e733e9d05 100644
--- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.fr.xlf
+++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.fr.xlf
@@ -42,6 +42,11 @@
Décrire avec Copilot
+
+
+ 'Describe with Copilot' is unavailable since the referenced document is excluded by your organization.
+
+
Ne pas préférer 'this.' ou 'Me.'
diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.it.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.it.xlf
index 9d4f216815ab8..6231f64742e53 100644
--- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.it.xlf
+++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.it.xlf
@@ -42,6 +42,11 @@
Descrivi con Copilot
+
+
+ 'Describe with Copilot' is unavailable since the referenced document is excluded by your organization.
+
+
Non preferire 'this.' o 'Me.'
diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ja.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ja.xlf
index 7c1c5397d7c4b..6b8b4caf72654 100644
--- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ja.xlf
+++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ja.xlf
@@ -42,6 +42,11 @@
Copilot で説明する
+
+
+ 'Describe with Copilot' is unavailable since the referenced document is excluded by your organization.
+
+
'this.' または 'Me' を優先しない
diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ko.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ko.xlf
index 5551bdf08ec3d..4cf5ef46a1654 100644
--- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ko.xlf
+++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ko.xlf
@@ -42,6 +42,11 @@
Copilot으로 설명
+
+
+ 'Describe with Copilot' is unavailable since the referenced document is excluded by your organization.
+
+
'this.' 또는 'Me.'를 기본으로 사용하지 마세요.
diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pl.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pl.xlf
index edd3298f66a38..aac3e348ff453 100644
--- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pl.xlf
+++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pl.xlf
@@ -42,6 +42,11 @@
Opisz za pomocą funkcji Copilot
+
+
+ 'Describe with Copilot' is unavailable since the referenced document is excluded by your organization.
+
+
Nie preferuj zapisu „this.” lub „me.”
diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pt-BR.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pt-BR.xlf
index eb1a663a3611e..ceddf983b7b54 100644
--- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pt-BR.xlf
+++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pt-BR.xlf
@@ -42,6 +42,11 @@
Descrever com o Copilot
+
+
+ 'Describe with Copilot' is unavailable since the referenced document is excluded by your organization.
+
+
Não preferir 'this.' nem 'Me'.
diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ru.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ru.xlf
index aa2e59485bf36..5343cbc8b6007 100644
--- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ru.xlf
+++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ru.xlf
@@ -42,6 +42,11 @@
Описать с помощью Copilot
+
+
+ 'Describe with Copilot' is unavailable since the referenced document is excluded by your organization.
+
+
Не предпочитать "this." или "Me".
diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.tr.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.tr.xlf
index a9cec135218a6..a3fbff3a42ab7 100644
--- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.tr.xlf
+++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.tr.xlf
@@ -42,6 +42,11 @@
Copilot ile açıkla
+
+
+ 'Describe with Copilot' is unavailable since the referenced document is excluded by your organization.
+
+
'this.' veya 'Me.' tercih etme
diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hans.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hans.xlf
index 726e2fb43938f..b3ea85144f991 100644
--- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hans.xlf
+++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hans.xlf
@@ -42,6 +42,11 @@
使用 Copilot 进行描述
+
+
+ 'Describe with Copilot' is unavailable since the referenced document is excluded by your organization.
+
+
不首选 "this." 或 "Me."
diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hant.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hant.xlf
index afe5660870c72..48e5a3c4026f3 100644
--- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hant.xlf
+++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hant.xlf
@@ -42,6 +42,11 @@
使用 Copilot 加以描述
+
+
+ 'Describe with Copilot' is unavailable since the referenced document is excluded by your organization.
+
+
不建議使用 'this.' 或 'Me.'
diff --git a/src/EditorFeatures/ExternalAccess/Copilot/Analyzer/IExternalCSharpCopilotCodeAnalysisService.cs b/src/EditorFeatures/ExternalAccess/Copilot/Analyzer/IExternalCSharpCopilotCodeAnalysisService.cs
index 799fe9c51e731..3a8485c1f14b2 100644
--- a/src/EditorFeatures/ExternalAccess/Copilot/Analyzer/IExternalCSharpCopilotCodeAnalysisService.cs
+++ b/src/EditorFeatures/ExternalAccess/Copilot/Analyzer/IExternalCSharpCopilotCodeAnalysisService.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using System;
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
@@ -18,5 +19,5 @@ internal interface IExternalCSharpCopilotCodeAnalysisService
Task> GetCachedDiagnosticsAsync(Document document, string promptTitle, CancellationToken cancellationToken);
Task StartRefinementSessionAsync(Document oldDocument, Document newDocument, Diagnostic? primaryDiagnostic, CancellationToken cancellationToken);
Task GetOnTheFlyDocsAsync(string symbolSignature, ImmutableArray declarationCode, string language, CancellationToken cancellationToken);
- Task IsAnyExclusionAsync(CancellationToken cancellationToken);
+ Task IsFileExcludedAsync(string filePath, CancellationToken cancellationToken);
}
diff --git a/src/EditorFeatures/ExternalAccess/Copilot/Internal/Analyzer/AbstractCopilotCodeAnalysisService.cs b/src/EditorFeatures/ExternalAccess/Copilot/Internal/Analyzer/AbstractCopilotCodeAnalysisService.cs
index 1762a2cdc460e..1c0353b079b42 100644
--- a/src/EditorFeatures/ExternalAccess/Copilot/Internal/Analyzer/AbstractCopilotCodeAnalysisService.cs
+++ b/src/EditorFeatures/ExternalAccess/Copilot/Internal/Analyzer/AbstractCopilotCodeAnalysisService.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
@@ -39,7 +40,7 @@ internal abstract class AbstractCopilotCodeAnalysisService(IDiagnosticsRefresher
protected abstract Task> GetCachedDiagnosticsCoreAsync(Document document, string promptTitle, CancellationToken cancellationToken);
protected abstract Task StartRefinementSessionCoreAsync(Document oldDocument, Document newDocument, Diagnostic? primaryDiagnostic, CancellationToken cancellationToken);
protected abstract Task GetOnTheFlyDocsCoreAsync(string symbolSignature, ImmutableArray declarationCode, string language, CancellationToken cancellationToken);
- protected abstract Task IsAnyExclusionCoreAsync(CancellationToken cancellationToken);
+ protected abstract Task IsFileExcludedCoreAsync(string filePath, CancellationToken cancellationToken);
public Task IsAvailableAsync(CancellationToken cancellationToken)
=> IsAvailableCoreAsync(cancellationToken);
@@ -180,11 +181,11 @@ public async Task GetOnTheFlyDocsAsync(string symbolSignature, Immutable
return await GetOnTheFlyDocsCoreAsync(symbolSignature, declarationCode, language, cancellationToken).ConfigureAwait(false);
}
- public async Task IsAnyExclusionAsync(CancellationToken cancellationToken)
+ public async Task IsFileExcludedAsync(string filePath, CancellationToken cancellationToken)
{
if (!await IsAvailableAsync(cancellationToken).ConfigureAwait(false))
return false;
- return await IsAnyExclusionCoreAsync(cancellationToken).ConfigureAwait(false);
+ return await IsFileExcludedCoreAsync(filePath, cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/EditorFeatures/ExternalAccess/Copilot/Internal/Analyzer/CSharp/CSharpCopilotCodeAnalysisService.ReflectionWrapper.cs b/src/EditorFeatures/ExternalAccess/Copilot/Internal/Analyzer/CSharp/CSharpCopilotCodeAnalysisService.ReflectionWrapper.cs
index d96f5ea40147b..7b3b41c63c1c6 100644
--- a/src/EditorFeatures/ExternalAccess/Copilot/Internal/Analyzer/CSharp/CSharpCopilotCodeAnalysisService.ReflectionWrapper.cs
+++ b/src/EditorFeatures/ExternalAccess/Copilot/Internal/Analyzer/CSharp/CSharpCopilotCodeAnalysisService.ReflectionWrapper.cs
@@ -21,6 +21,7 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.Copilot.Internal.Analyzer.CSharp
using StartRefinementSessionAsyncDelegateType = Func;
using GetOnTheFlyDocsAsyncDelegateType = Func, string, CancellationToken, Task>;
using IsAnyExclusionAsyncDelegateType = Func>;
+using IsFileExcludedAsyncDelegateType = Func>;
internal sealed partial class CSharpCopilotCodeAnalysisService
{
@@ -36,7 +37,7 @@ private sealed class ReflectionWrapper : IExternalCSharpCopilotCodeAnalysisServi
private const string GetCachedDiagnosticsAsyncMethodName = "GetCachedDiagnosticsAsync";
private const string StartRefinementSessionAsyncMethodName = "StartRefinementSessionAsync";
private const string GetOnTheFlyDocsAsyncMethodName = "GetOnTheFlyDocsAsync";
- private const string IsAnyExclusionAsyncMethodName = "IsAnyExclusionAsync";
+ private const string IsFileExcludedAsyncMethodName = "IsFileExcludedAsync";
// Create and cache closed delegate to ensure we use a singleton object and with better performance.
private readonly Type? _analyzerType;
@@ -47,7 +48,7 @@ private sealed class ReflectionWrapper : IExternalCSharpCopilotCodeAnalysisServi
private readonly Lazy _lazyGetCachedDiagnosticsAsyncDelegate;
private readonly Lazy _lazyStartRefinementSessionAsyncDelegate;
private readonly Lazy _lazyGetOnTheFlyDocsAsyncDelegate;
- private readonly Lazy _lazyIsAnyExclusionAsyncDelegate;
+ private readonly Lazy _lazyIsFileExcludedAsyncDelegate;
public ReflectionWrapper(IServiceProvider serviceProvider, IVsService brokeredServiceContainer)
{
@@ -76,7 +77,7 @@ public ReflectionWrapper(IServiceProvider serviceProvider, IVsService(string methodName, Type[] types) where T : Delegate
@@ -115,8 +116,8 @@ public ReflectionWrapper(IServiceProvider serviceProvider, IVsService CreateDelegate(GetOnTheFlyDocsAsyncMethodName, [typeof(string), typeof(ImmutableArray), typeof(string), typeof(CancellationToken)]);
- private IsAnyExclusionAsyncDelegateType? CreateIsAnyExclusionAsyncDelegate()
- => CreateDelegate(IsAnyExclusionAsyncMethodName, [typeof(CancellationToken)]);
+ private IsFileExcludedAsyncDelegateType? CreateIsFileExcludedAsyncDelegate()
+ => CreateDelegate(IsFileExcludedAsyncMethodName, [typeof(string), typeof(CancellationToken)]);
public async Task IsAvailableAsync(CancellationToken cancellationToken)
{
@@ -166,12 +167,12 @@ public async Task GetOnTheFlyDocsAsync(string symbolSignature, Immutable
return await _lazyGetOnTheFlyDocsAsyncDelegate.Value(symbolSignature, declarationCode, language, cancellationToken).ConfigureAwait(false);
}
- public async Task IsAnyExclusionAsync(CancellationToken cancellationToken)
+ public async Task IsFileExcludedAsync(string filePath, CancellationToken cancellationToken)
{
- if (_lazyIsAnyExclusionAsyncDelegate.Value is null)
+ if (_lazyIsFileExcludedAsyncDelegate.Value is null)
return false;
- return await _lazyIsAnyExclusionAsyncDelegate.Value(cancellationToken).ConfigureAwait(false);
+ return await _lazyIsFileExcludedAsyncDelegate.Value(filePath, cancellationToken).ConfigureAwait(false);
}
}
}
diff --git a/src/EditorFeatures/ExternalAccess/Copilot/Internal/Analyzer/CSharp/CSharpCopilotCodeAnalysisService.cs b/src/EditorFeatures/ExternalAccess/Copilot/Internal/Analyzer/CSharp/CSharpCopilotCodeAnalysisService.cs
index 74fc9ad8b1d74..317a234a68c11 100644
--- a/src/EditorFeatures/ExternalAccess/Copilot/Internal/Analyzer/CSharp/CSharpCopilotCodeAnalysisService.cs
+++ b/src/EditorFeatures/ExternalAccess/Copilot/Internal/Analyzer/CSharp/CSharpCopilotCodeAnalysisService.cs
@@ -80,6 +80,6 @@ protected override async Task> GetDiagnosticsIntersec
return filteredDiagnostics.ToImmutable();
}
- protected override Task IsAnyExclusionCoreAsync(CancellationToken cancellationToken)
- => _lazyExternalCopilotService.Value.IsAnyExclusionAsync(cancellationToken);
+ protected override Task IsFileExcludedCoreAsync(string filePath, CancellationToken cancellationToken)
+ => _lazyExternalCopilotService.Value.IsFileExcludedAsync(filePath, cancellationToken);
}
diff --git a/src/EditorFeatures/ExternalAccess/Copilot/InternalAPI.Unshipped.txt b/src/EditorFeatures/ExternalAccess/Copilot/InternalAPI.Unshipped.txt
index 62074d860791e..9f06d5d62b1b3 100644
--- a/src/EditorFeatures/ExternalAccess/Copilot/InternalAPI.Unshipped.txt
+++ b/src/EditorFeatures/ExternalAccess/Copilot/InternalAPI.Unshipped.txt
@@ -9,8 +9,8 @@ Microsoft.CodeAnalysis.ExternalAccess.Copilot.IExternalCSharpCopilotCodeAnalysis
Microsoft.CodeAnalysis.ExternalAccess.Copilot.IExternalCSharpCopilotCodeAnalysisService.GetAvailablePromptTitlesAsync(Microsoft.CodeAnalysis.Document! document, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task>!
Microsoft.CodeAnalysis.ExternalAccess.Copilot.IExternalCSharpCopilotCodeAnalysisService.GetCachedDiagnosticsAsync(Microsoft.CodeAnalysis.Document! document, string! promptTitle, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task>!
Microsoft.CodeAnalysis.ExternalAccess.Copilot.IExternalCSharpCopilotCodeAnalysisService.GetOnTheFlyDocsAsync(string! symbolSignature, System.Collections.Immutable.ImmutableArray declarationCode, string! language, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task!
-Microsoft.CodeAnalysis.ExternalAccess.Copilot.IExternalCSharpCopilotCodeAnalysisService.IsAnyExclusionAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task!
Microsoft.CodeAnalysis.ExternalAccess.Copilot.IExternalCSharpCopilotCodeAnalysisService.IsAvailableAsync(System.Threading.CancellationToken cancellation) -> System.Threading.Tasks.Task!
+Microsoft.CodeAnalysis.ExternalAccess.Copilot.IExternalCSharpCopilotCodeAnalysisService.IsFileExcludedAsync(string! filePath, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task!
Microsoft.CodeAnalysis.ExternalAccess.Copilot.IExternalCSharpCopilotCodeAnalysisService.StartRefinementSessionAsync(Microsoft.CodeAnalysis.Document! oldDocument, Microsoft.CodeAnalysis.Document! newDocument, Microsoft.CodeAnalysis.Diagnostic? primaryDiagnostic, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task!
Microsoft.CodeAnalysis.ExternalAccess.Copilot.RelatedDocuments.ICopilotRelatedDocumentsService
Microsoft.CodeAnalysis.ExternalAccess.Copilot.RelatedDocuments.ICopilotRelatedDocumentsService.GetRelatedDocumentIdsAsync(Microsoft.CodeAnalysis.Document! document, int position, System.Func, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask>! callbackAsync, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask
diff --git a/src/EditorFeatures/Test2/CodeFixes/CodeFixServiceTests.vb b/src/EditorFeatures/Test2/CodeFixes/CodeFixServiceTests.vb
index fcb96e630d4fb..75c7d563e12f8 100644
--- a/src/EditorFeatures/Test2/CodeFixes/CodeFixServiceTests.vb
+++ b/src/EditorFeatures/Test2/CodeFixes/CodeFixServiceTests.vb
@@ -355,7 +355,7 @@ Namespace Microsoft.CodeAnalysis.Editor.Implementation.CodeFixes.UnitTests
Return Task.FromResult("")
End Function
- Public Function IsAnyExclusionAsync(cancellationToken As CancellationToken) As Task(Of Boolean) Implements ICopilotCodeAnalysisService.IsAnyExclusionAsync
+ Public Function IsFileExcludedAsync(filePath As String, cancellationToken As CancellationToken) As Task(Of Boolean) Implements ICopilotCodeAnalysisService.IsFileExcludedAsync
Return Task.FromResult(False)
End Function
End Class
diff --git a/src/Features/CSharp/Portable/QuickInfo/CSharpSemanticQuickInfoProvider.cs b/src/Features/CSharp/Portable/QuickInfo/CSharpSemanticQuickInfoProvider.cs
index df4197448e231..e9ff906e3cee4 100644
--- a/src/Features/CSharp/Portable/QuickInfo/CSharpSemanticQuickInfoProvider.cs
+++ b/src/Features/CSharp/Portable/QuickInfo/CSharpSemanticQuickInfoProvider.cs
@@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using System;
-using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.Diagnostics.CodeAnalysis;
@@ -15,6 +14,7 @@
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.GoToDefinition;
using Microsoft.CodeAnalysis.Host.Mef;
+using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.QuickInfo;
using Microsoft.CodeAnalysis.Shared.Extensions;
@@ -146,13 +146,6 @@ protected override NullableFlowState GetNullabilityAnalysis(SemanticModel semant
return null;
}
- // Checks to see if there have been any files excluded at the workspace level
- // since the copilot service passes along symbol information.
- if (await copilotService.IsAnyExclusionAsync(cancellationToken).ConfigureAwait(false))
- {
- return null;
- }
-
if (document.GetLanguageService() is not { } service ||
!await service.IsOnTheFlyDocsOptionEnabledAsync().ConfigureAwait(false))
{
@@ -182,6 +175,19 @@ protected override NullableFlowState GetNullabilityAnalysis(SemanticModel semant
return null;
}
+ // Checks to see if any of the files containing the symbol are excluded.
+ var hasContentExcluded = false;
+ var symbolFilePaths = symbol.DeclaringSyntaxReferences.Select(reference => reference.SyntaxTree.FilePath);
+ foreach (var symbolFilePath in symbolFilePaths)
+ {
+ if (await copilotService.IsFileExcludedAsync(symbolFilePath, cancellationToken).ConfigureAwait(false))
+ {
+ hasContentExcluded = true;
+ Logger.Log(FunctionId.Copilot_On_The_Fly_Docs_Content_Excluded, logLevel: LogLevel.Information);
+ break;
+ }
+ }
+
var maxLength = 1000;
var symbolStrings = symbol.DeclaringSyntaxReferences.Select(reference =>
{
@@ -190,6 +196,6 @@ protected override NullableFlowState GetNullabilityAnalysis(SemanticModel semant
return sourceText.GetSubText(new Text.TextSpan(span.Start, Math.Min(maxLength, span.Length))).ToString();
}).ToImmutableArray();
- return new OnTheFlyDocsInfo(symbol.ToDisplayString(), symbolStrings, symbol.Language);
+ return new OnTheFlyDocsInfo(symbol.ToDisplayString(), symbolStrings, symbol.Language, hasContentExcluded);
}
}
diff --git a/src/Features/Core/Portable/Copilot/ICopilotCodeAnalysisService.cs b/src/Features/Core/Portable/Copilot/ICopilotCodeAnalysisService.cs
index 13f2f65139617..0bdd083ad9584 100644
--- a/src/Features/Core/Portable/Copilot/ICopilotCodeAnalysisService.cs
+++ b/src/Features/Core/Portable/Copilot/ICopilotCodeAnalysisService.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using System;
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
@@ -72,8 +73,8 @@ internal interface ICopilotCodeAnalysisService : ILanguageService
Task GetOnTheFlyDocsAsync(string symbolSignature, ImmutableArray declarationCode, string language, CancellationToken cancellationToken);
///
- /// Determines if there are any exclusions in the workspace.
+ /// Determines if the given is excluded in the workspace.
///
- Task IsAnyExclusionAsync(CancellationToken cancellationToken);
+ Task IsFileExcludedAsync(string filePath, CancellationToken cancellationToken);
}
diff --git a/src/Features/Core/Portable/QuickInfo/OnTheFlyDocsInfo.cs b/src/Features/Core/Portable/QuickInfo/OnTheFlyDocsInfo.cs
index a6e61318cf199..c1a69a7d374ff 100644
--- a/src/Features/Core/Portable/QuickInfo/OnTheFlyDocsInfo.cs
+++ b/src/Features/Core/Portable/QuickInfo/OnTheFlyDocsInfo.cs
@@ -13,11 +13,12 @@ namespace Microsoft.CodeAnalysis.QuickInfo;
/// the symbol's declaration code
/// the language of the symbol
/// whether the symbol has comments
-internal sealed class OnTheFlyDocsInfo(string symbolSignature, ImmutableArray declarationCode, string language, bool hasComments = false)
+internal sealed class OnTheFlyDocsInfo(string symbolSignature, ImmutableArray declarationCode, string language, bool isContentExcluded, bool hasComments = false)
{
public string SymbolSignature { get; } = symbolSignature;
public ImmutableArray DeclarationCode { get; } = declarationCode;
public string Language { get; } = language;
+ public bool IsContentExcluded { get; set; } = isContentExcluded;
// Added for telemetry collection purposes.
public bool HasComments { get; set; } = hasComments;
diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Log/FunctionId.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Log/FunctionId.cs
index b6484117c90ae..77c0c94bde897 100644
--- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Log/FunctionId.cs
+++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Log/FunctionId.cs
@@ -633,5 +633,6 @@ internal enum FunctionId
Copilot_On_The_Fly_Docs_Error_Displayed = 813,
Copilot_On_The_Fly_Docs_Results_Canceled = 814,
Copilot_On_The_Fly_Docs_Get_Counts = 815,
+ Copilot_On_The_Fly_Docs_Content_Excluded = 816,
Copilot_Rename = 851
}