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

[automated] Merge branch 'main' => 'release/dev18.0' #77644

Merged
merged 4 commits into from
Mar 17, 2025
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
20 changes: 10 additions & 10 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<SourceBuild RepoName="source-build-externals" ManagedOnly="true" />
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="10.0.616304">
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="10.0.616401">
<Uri>https://github.com/dotnet/source-build-reference-packages</Uri>
<Sha>cac4d021768f34079c30570518ece6af317cbab8</Sha>
<Sha>c3d4c372a15c2de79a2f26fe2b6b3644996d8550</Sha>
<SourceBuild RepoName="source-build-reference-packages" ManagedOnly="true" />
</Dependency>
<Dependency Name="System.CommandLine" Version="2.0.0-beta4.24528.1">
Expand Down Expand Up @@ -122,19 +122,19 @@
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="9.0.0-beta.25161.4">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="9.0.0-beta.25164.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>f33d9e642f0e68a61312164cd9e0baf4e142a999</Sha>
<Sha>5ba9ca776c1d0bb72b2791591e54cf51fc52dfee</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.arcade" Version="9.0.0-beta.25161.4">
<Dependency Name="Microsoft.SourceBuild.Intermediate.arcade" Version="9.0.0-beta.25164.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>f33d9e642f0e68a61312164cd9e0baf4e142a999</Sha>
<Sha>5ba9ca776c1d0bb72b2791591e54cf51fc52dfee</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.DotNet.XliffTasks" Version="9.0.0-beta.25161.4">
<Dependency Name="Microsoft.DotNet.XliffTasks" Version="9.0.0-beta.25164.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>f33d9e642f0e68a61312164cd9e0baf4e142a999</Sha>
<Sha>5ba9ca776c1d0bb72b2791591e54cf51fc52dfee</Sha>
</Dependency>
<Dependency Name="Microsoft.DiaSymReader" Version="2.0.0">
<Uri>https://github.com/dotnet/symreader</Uri>
Expand All @@ -150,9 +150,9 @@
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>5d10d428050c0d6afef30a072c4ae68776621877</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="9.0.0-beta.25161.4">
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="9.0.0-beta.25164.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>f33d9e642f0e68a61312164cd9e0baf4e142a999</Sha>
<Sha>5ba9ca776c1d0bb72b2791591e54cf51fc52dfee</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0-preview.23468.1">
<Uri>https://github.com/dotnet/roslyn-analyzers</Uri>
Expand Down
4 changes: 2 additions & 2 deletions eng/common/tools.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
[bool]$useInstalledDotNetCli = if (Test-Path variable:useInstalledDotNetCli) { $useInstalledDotNetCli } else { $true }

# Enable repos to use a particular version of the on-line dotnet-install scripts.
# default URL: https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1
# default URL: https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.ps1
[string]$dotnetInstallScriptVersion = if (Test-Path variable:dotnetInstallScriptVersion) { $dotnetInstallScriptVersion } else { 'v1' }

# True to use global NuGet cache instead of restoring packages to repository-local directory.
Expand Down Expand Up @@ -262,7 +262,7 @@ function GetDotNetInstallScript([string] $dotnetRoot) {
if (!(Test-Path $installScript)) {
Create-Directory $dotnetRoot
$ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit
$uri = "https://dotnet.microsoft.com/download/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.ps1"
$uri = "https://builds.dotnet.microsoft.com/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.ps1"

Retry({
Write-Host "GET $uri"
Expand Down
4 changes: 2 additions & 2 deletions eng/common/tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ warn_as_error=${warn_as_error:-true}
use_installed_dotnet_cli=${use_installed_dotnet_cli:-true}

# Enable repos to use a particular version of the on-line dotnet-install scripts.
# default URL: https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh
# default URL: https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.sh
dotnetInstallScriptVersion=${dotnetInstallScriptVersion:-'v1'}

# True to use global NuGet cache instead of restoring packages to repository-local directory.
Expand Down Expand Up @@ -295,7 +295,7 @@ function with_retries {
function GetDotNetInstallScript {
local root=$1
local install_script="$root/dotnet-install.sh"
local install_script_url="https://dotnet.microsoft.com/download/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.sh"
local install_script_url="https://builds.dotnet.microsoft.com/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.sh"

if [[ ! -a "$install_script" ]]; then
mkdir -p "$root"
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
}
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.25161.4",
"Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.25161.4",
"Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.25164.2",
"Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.25164.2",
"Microsoft.Build.Traversal": "3.4.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

using System;
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Copilot;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.Internal.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.Settings;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Utilities.UnifiedSettings;

namespace Microsoft.VisualStudio.LanguageServices.CSharp.Options;

Expand Down Expand Up @@ -40,21 +39,20 @@ internal sealed class CSharpVisualStudioCopilotOptionsService : ICopilotOptionsS
/// </summary>
private const string GitHubAccountStatusIsCopilotEntitled = "3DE3FA6E-91B2-46C1-9E9E-DD04975BB890";

private const string CopilotOptionNamePrefix = "Microsoft.VisualStudio.Conversations";

// Default value must reflect their default values in ConversationsOptions in Copilot repo.
private readonly CopilotOption _copilotCodeAnalysisOption = new("EnableCSharpCodeAnalysis", false);
private readonly CopilotOption _copilotRefineOption = new("EnableCSharpRefineQuickActionSuggestion", false);
private readonly CopilotOption _copilotOnTheFlyDocsOption = new("EnableOnTheFlyDocs", true);
private readonly CopilotOption _copilotGenerateDocumentationCommentOption = new("EnableCSharpGenerateDocumentationComment", true);
private readonly CopilotOption _copilotGenerateMethodImplementationOption = new("EnableCSharpGenerateMethodImplementation", true);
private readonly CopilotOption _copilotCodeAnalysisOption = new("copilot.featureFlags.editor.enableCSharpCodeAnalysis", false);
private readonly CopilotOption _copilotRefineOption = new("copilot.featureFlags.editor.enableCSharpRefineQuickActionSuggestion", false);
private readonly CopilotOption _copilotOnTheFlyDocsOption = new("copilot.general.editor.enableOnTheFlyDocs", true);
private readonly CopilotOption _copilotGenerateDocumentationCommentOption = new("copilot.general.editor.enableGenerateDocumentationComment", true);
private readonly CopilotOption _copilotGenerateMethodImplementationOption = new("copilot.featureFlags.editor.enableCSharpGenerateMethodImplementation", false);

private static readonly UIContext s_copilotHasLoadedUIContext = UIContext.FromUIContextGuid(new Guid(CopilotHasLoadedGuid));
private static readonly UIContext s_gitHubAccountStatusDeterminedContext = UIContext.FromUIContextGuid(new Guid(GitHubAccountStatusDetermined));
private static readonly UIContext s_gitHubAccountStatusIsCopilotEntitledUIContext = UIContext.FromUIContextGuid(new Guid(GitHubAccountStatusIsCopilotEntitled));
private static readonly UIContext s_gitHubAccountStatusSignedInUIContext = UIContext.FromUIContextGuid(new Guid(GitHubAccountStatusSignedIn));

private readonly Task<ISettingsManager> _settingsManagerTask;
private ISettingsReader? _settingsReader;

/// <summary>
/// Determines if Copilot is active and the user is signed in and entitled to use Copilot.
Expand All @@ -68,7 +66,7 @@ private static bool IsGithubCopilotLoadedAndSignedIn
[method: ImportingConstructor]
[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public CSharpVisualStudioCopilotOptionsService(
IVsService<SVsSettingsPersistenceManager, ISettingsManager> settingsManagerService,
IVsService<SVsUnifiedSettingsManager, ISettingsManager> settingsManagerService,
IThreadingContext threadingContext)
{
_settingsManagerTask = settingsManagerService.GetValueAsync(threadingContext.DisposalToken);
Expand All @@ -79,11 +77,23 @@ private async Task<bool> IsCopilotOptionEnabledAsync(CopilotOption option)
if (!IsGithubCopilotLoadedAndSignedIn)
return false;

var settingManager = await _settingsManagerTask.ConfigureAwait(false);
// The bool setting is persisted as 0=None, 1=True, 2=False, so it needs to be retrieved as an int.
// If isEnabled is 0 or the value is not persisted, we should return the default value for the option.
var isEnabled = settingManager.GetValueOrDefault($"{CopilotOptionNamePrefix}.{option.Name}", 0);
return isEnabled == 1 || (isEnabled == 0 && option.DefaultValue);
if (_settingsReader == null)
{
var settingsManager = await _settingsManagerTask.ConfigureAwait(false);
_settingsReader = settingsManager.GetReader();
}

try
{
if (_settingsReader.GetValue<bool>(option.Name) is { Outcome: SettingRetrievalOutcome.Success } setting)
return setting.Value;

return option.DefaultValue;
}
catch
{
return option.DefaultValue;
}
}

public Task<bool> IsCodeAnalysisOptionEnabledAsync()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ public async Task<FrameworkElement> InitializeAsync(CancellationToken cancellati
return null;
}

if (!globalOptions.GetOption(SemanticSearchFeatureFlag.PromptEnabled))
{
return null;
}

var outerGrid = new Grid()
{
Background = (Brush)Application.Current.FindResource(CommonControlsColors.TextBoxBackgroundBrushKey),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ public bool TryFetch(LocalUserRegistryOptionPersister persister, OptionKey2 opti
{"dotnet_unsupported_report_invalid_json_patterns", new RoamingProfileStorage("TextEditor.%LANGUAGE%.Specific.ReportInvalidJsonPatterns")},
{"visual_studio_enable_key_binding_reset", new FeatureFlagStorage("Roslyn.KeybindingResetEnabled")},
{"visual_studio_enable_semantic_search", new FeatureFlagStorage("Roslyn.SemanticSearchEnabled")},
{"visual_studio_enable_semantic_search_prompt", new FeatureFlagStorage("Roslyn.ShowPromptInSemanticSearch")},
{"visual_studio_enable_copilot_rename_context", new FeatureFlagStorage("Roslyn.CopilotRenameGetContext")},
{"visual_studio_key_binding_needs_reset", new LocalUserProfileStorage(@"Roslyn\Internal\KeybindingsStatus", "NeedsReset")},
{"visual_studio_key_binding_reset_never_show_again", new LocalUserProfileStorage(@"Roslyn\Internal\KeybindingsStatus", "NeverShowAgain")},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Microsoft.VisualStudio.LanguageServices;
internal static class SemanticSearchFeatureFlag
{
public static readonly Option2<bool> Enabled = new("visual_studio_enable_semantic_search", defaultValue: false);
public static readonly Option2<bool> PromptEnabled = new("visual_studio_enable_semantic_search_prompt", defaultValue: false);

/// <summary>
/// Context id that indicates that Semantic Search feature is enabled.
Expand Down
Loading