terminal/src/cascadia/TerminalSettingsModel/VisualStudioGenerator.cpp
Leonard Hecker 5a23029dac
Further reduce number of generated VS profiles (#11489)
This commit reduces the number of generated VS profiles from 6 down to just 2
per VS instance. The reason we did this is out of concern of overwhelming or
annoying new users with too many profiles. Especially since it's far easier
at the moment to add new generators compared to removing them.

As before only the latest instance is not hidden by default.

## PR Checklist
* [x] I work here
* [x] Tests added/passed
* [x] As discussed in a Team Sync meeting

## Validation Steps Performed
* Installed Visual Studio 2019 and 2022 Preview
* A profile for both is generated, while the 2019 one is hidden by default ✔️
* $env:VSCMD_ARG_TGT_ARCH is x64 on my AMD64 machine ✔️
2021-10-19 23:52:00 +00:00

33 lines
1.1 KiB
C++

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#include "pch.h"
#include "DynamicProfileUtils.h"
#include "VisualStudioGenerator.h"
#include "VsDevCmdGenerator.h"
#include "VsDevShellGenerator.h"
using namespace winrt::Microsoft::Terminal::Settings::Model;
std::wstring_view VisualStudioGenerator::GetNamespace() const noexcept
{
return std::wstring_view{ L"Windows.Terminal.VisualStudio" };
}
void VisualStudioGenerator::GenerateProfiles(std::vector<winrt::com_ptr<implementation::Profile>>& profiles) const
{
const auto instances = VsSetupConfiguration::QueryInstances();
VsDevCmdGenerator devCmdGenerator;
VsDevShellGenerator devShellGenerator;
// Instances are ordered from latest to oldest. Hide all but the profiles for the latest instance.
bool hidden = false;
for (auto const& instance : instances)
{
devCmdGenerator.GenerateProfiles(instance, hidden, profiles);
devShellGenerator.GenerateProfiles(instance, hidden, profiles);
hidden = true;
}
}