mirror of
https://github.com/microsoft/terminal.git
synced 2026-04-07 14:50:55 +00:00
Compare commits
111 Commits
dev/lhecke
...
dev/migrie
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
deab3fe05b | ||
|
|
eb750cca26 | ||
|
|
ab65ecbb39 | ||
|
|
cc837b6e5d | ||
|
|
0f7e9f331b | ||
|
|
589a1e0f96 | ||
|
|
6ea25e4381 | ||
|
|
258c6eb1f8 | ||
|
|
327858b2af | ||
|
|
96d8d1f8ea | ||
|
|
5a00d5f400 | ||
|
|
253dedf477 | ||
|
|
f0bc7f1a28 | ||
|
|
3aa5b4bb29 | ||
|
|
091797c08b | ||
|
|
d41e9735af | ||
|
|
5a029f0744 | ||
|
|
bba8aac96d | ||
|
|
5466965d4f | ||
|
|
b5d063b48e | ||
|
|
406312f2f8 | ||
|
|
625753cc41 | ||
|
|
a80316dfa5 | ||
|
|
9703815f59 | ||
|
|
0dff336556 | ||
|
|
b88a8c5884 | ||
|
|
6c6dd46e02 | ||
|
|
51528e9cfd | ||
|
|
40b4aa2c94 | ||
|
|
d4d216ca33 | ||
|
|
7d00b25fbf | ||
|
|
ba375ec2a2 | ||
|
|
5e48a45ba2 | ||
|
|
14d83b5f5c | ||
|
|
3e31bda6f2 | ||
|
|
4d35c14966 | ||
|
|
abef25d29c | ||
|
|
7793c5c5bc | ||
|
|
ccf1cc9e83 | ||
|
|
ebc03e98f4 | ||
|
|
80fc299c10 | ||
|
|
02a1e37aae | ||
|
|
0480d651cb | ||
|
|
193e5733bf | ||
|
|
2b16acd4cf | ||
|
|
f35bf206e6 | ||
|
|
cdb907d94d | ||
|
|
3e601f5b66 | ||
|
|
c2c75c80ed | ||
|
|
3c6015d97b | ||
|
|
45cfcd6eca | ||
|
|
ca4015f5f9 | ||
|
|
4c744e6ab3 | ||
|
|
6437b9f508 | ||
|
|
428821b40c | ||
|
|
3d92f27de7 | ||
|
|
db00b90306 | ||
|
|
e725f1e936 | ||
|
|
e62dfa2177 | ||
|
|
2b4aeb2b11 | ||
|
|
2f1d8d2dca | ||
|
|
754bf04ab3 | ||
|
|
c51558ff4c | ||
|
|
5a1b822833 | ||
|
|
b3e9c267f5 | ||
|
|
936afd6b01 | ||
|
|
dc874c3b3f | ||
|
|
ae16a5e0e1 | ||
|
|
3e7ab3861a | ||
|
|
ddfac907f4 | ||
|
|
f1633e0360 | ||
|
|
12a61c595e | ||
|
|
d0938e2a24 | ||
|
|
f425746169 | ||
|
|
e28d47888c | ||
|
|
0a3e17eebb | ||
|
|
22ab9363ef | ||
|
|
c134402507 | ||
|
|
85933e2231 | ||
|
|
ca3eb87301 | ||
|
|
5e70911a68 | ||
|
|
360b92e567 | ||
|
|
5ee630ec82 | ||
|
|
aa4921268e | ||
|
|
12f3aa9d06 | ||
|
|
bdf42c2d9c | ||
|
|
af2d22f343 | ||
|
|
6e293a5ee8 | ||
|
|
dd25ed762f | ||
|
|
dca7df50c8 | ||
|
|
9fc69721c9 | ||
|
|
5c2307c531 | ||
|
|
d57c7a1f03 | ||
|
|
71bf90f295 | ||
|
|
10d1fc8d60 | ||
|
|
44510dce1b | ||
|
|
eccd87f303 | ||
|
|
6c3253968f | ||
|
|
2093660ac1 | ||
|
|
b43191d2c5 | ||
|
|
7c907fed6e | ||
|
|
db528c94fc | ||
|
|
be193b21eb | ||
|
|
2bb1b6c6ad | ||
|
|
66fe08f964 | ||
|
|
642d0ab2b7 | ||
|
|
8cc82de489 | ||
|
|
052d063686 | ||
|
|
8bcbd0bd42 | ||
|
|
9dff28f23d | ||
|
|
90627b3ae5 |
28
.wt.json
Normal file
28
.wt.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"actions":
|
||||
[
|
||||
{
|
||||
"command": { "action": "sendInput", "input": "bx\r" },
|
||||
"name": "Build project",
|
||||
"description": "Build the project in the CWD"
|
||||
},
|
||||
{
|
||||
"command": { "action": "sendInput", "input": "bz\r" },
|
||||
"name": "Build solution, incremental",
|
||||
"description": "Just build changes to the solution"
|
||||
},
|
||||
{
|
||||
"command": { "action": "sendInput", "input": "bcz\r" },
|
||||
"name": "Clean & build solution",
|
||||
"icon": "\uE8e6",
|
||||
"description": "Start over. Go get your coffee. "
|
||||
},
|
||||
{
|
||||
"command": { "action": "sendInput", "input": "nuget push -apikey az -source TerminalDependencies %userprofile%\\Downloads" },
|
||||
"name": "Upload package to nuget feed",
|
||||
"icon": "\uE898",
|
||||
"description": "Go download a .nupkg, put it in ~/Downloads, and use this to push to our private feed."
|
||||
},
|
||||
|
||||
]
|
||||
}
|
||||
@@ -1330,66 +1330,77 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
if (const auto& realArgs = args.ActionArgs().try_as<SuggestionsArgs>())
|
||||
{
|
||||
const auto source = realArgs.Source();
|
||||
std::vector<Command> commandsCollection;
|
||||
Control::CommandHistoryContext context{ nullptr };
|
||||
winrt::hstring currentCommandline = L"";
|
||||
_doHandleSuggestions(realArgs);
|
||||
|
||||
// If the user wanted to use the current commandline to filter results,
|
||||
// OR they wanted command history (or some other source that
|
||||
// requires context from the control)
|
||||
// then get that here.
|
||||
const bool shouldGetContext = realArgs.UseCommandline() ||
|
||||
WI_IsFlagSet(source, SuggestionsSource::CommandHistory);
|
||||
if (shouldGetContext)
|
||||
{
|
||||
if (const auto& control{ _GetActiveControl() })
|
||||
{
|
||||
context = control.CommandHistory();
|
||||
if (context)
|
||||
{
|
||||
currentCommandline = context.CurrentCommandline();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Aggregate all the commands from the different sources that
|
||||
// the user selected.
|
||||
|
||||
// Tasks are all the sendInput commands the user has saved in
|
||||
// their settings file. Ask the ActionMap for those.
|
||||
if (WI_IsFlagSet(source, SuggestionsSource::Tasks))
|
||||
{
|
||||
const auto tasks = _settings.GlobalSettings().ActionMap().FilterToSendInput(currentCommandline);
|
||||
for (const auto& t : tasks)
|
||||
{
|
||||
commandsCollection.push_back(t);
|
||||
}
|
||||
}
|
||||
|
||||
// Command History comes from the commands in the buffer,
|
||||
// assuming the user has enabled shell integration. Get those
|
||||
// from the active control.
|
||||
if (WI_IsFlagSet(source, SuggestionsSource::CommandHistory) &&
|
||||
context != nullptr)
|
||||
{
|
||||
const auto recentCommands = Command::HistoryToCommands(context.History(), currentCommandline, false);
|
||||
for (const auto& t : recentCommands)
|
||||
{
|
||||
commandsCollection.push_back(t);
|
||||
}
|
||||
}
|
||||
|
||||
// Open the palette with all these commands in it.
|
||||
_OpenSuggestions(_GetActiveControl(),
|
||||
winrt::single_threaded_vector<Command>(std::move(commandsCollection)),
|
||||
SuggestionsMode::Palette,
|
||||
currentCommandline);
|
||||
args.Handled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
winrt::fire_and_forget TerminalPage::_doHandleSuggestions(SuggestionsArgs realArgs)
|
||||
{
|
||||
const auto source = realArgs.Source();
|
||||
std::vector<Command> commandsCollection;
|
||||
Control::CommandHistoryContext context{ nullptr };
|
||||
winrt::hstring currentCommandline = L"";
|
||||
winrt::hstring currentWorkingDirectory = L"";
|
||||
|
||||
// If the user wanted to use the current commandline to filter results,
|
||||
// OR they wanted command history (or some other source that
|
||||
// requires context from the control)
|
||||
// then get that here.
|
||||
const bool shouldGetContext = realArgs.UseCommandline() ||
|
||||
WI_IsAnyFlagSet(source, SuggestionsSource::CommandHistory);
|
||||
if (const auto& control{ _GetActiveControl() })
|
||||
{
|
||||
currentWorkingDirectory = control.CurrentWorkingDirectory();
|
||||
|
||||
if (shouldGetContext)
|
||||
{
|
||||
context = control.CommandHistory();
|
||||
if (context)
|
||||
{
|
||||
currentCommandline = context.CurrentCommandline();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Aggregate all the commands from the different sources that
|
||||
// the user selected.
|
||||
|
||||
// Tasks are all the sendInput commands the user has saved in
|
||||
// their settings file. Ask the ActionMap for those.
|
||||
if (WI_IsFlagSet(source, SuggestionsSource::Tasks))
|
||||
{
|
||||
const auto tasks = co_await _settings.GlobalSettings().ActionMap().FilterToSnippets(currentCommandline, currentWorkingDirectory);
|
||||
for (const auto& t : tasks)
|
||||
{
|
||||
commandsCollection.push_back(t);
|
||||
}
|
||||
}
|
||||
|
||||
// Command History comes from the commands in the buffer,
|
||||
// assuming the user has enabled shell integration. Get those
|
||||
// from the active control.
|
||||
if (WI_IsFlagSet(source, SuggestionsSource::CommandHistory) &&
|
||||
context != nullptr)
|
||||
{
|
||||
const auto recentCommands = Command::HistoryToCommands(context.History(), currentCommandline, false);
|
||||
for (const auto& t : recentCommands)
|
||||
{
|
||||
commandsCollection.push_back(t);
|
||||
}
|
||||
}
|
||||
|
||||
co_await wil::resume_foreground(Dispatcher());
|
||||
|
||||
// Open the palette with all these commands in it.
|
||||
_OpenSuggestions(_GetActiveControl(),
|
||||
winrt::single_threaded_vector<Command>(std::move(commandsCollection)),
|
||||
SuggestionsMode::Palette,
|
||||
currentCommandline);
|
||||
}
|
||||
|
||||
void TerminalPage::_HandleColorSelection(const IInspectable& /*sender*/,
|
||||
const ActionEventArgs& args)
|
||||
{
|
||||
|
||||
@@ -544,6 +544,7 @@ namespace winrt::TerminalApp::implementation
|
||||
winrt::com_ptr<TerminalTab> _senderOrFocusedTab(const IInspectable& sender);
|
||||
|
||||
void _activePaneChanged(winrt::TerminalApp::TerminalTab tab, Windows::Foundation::IInspectable args);
|
||||
winrt::fire_and_forget _doHandleSuggestions(Microsoft::Terminal::Settings::Model::SuggestionsArgs realArgs);
|
||||
|
||||
#pragma region ActionHandlers
|
||||
// These are all defined in AppActionHandlers.cpp
|
||||
|
||||
@@ -2246,7 +2246,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
|
||||
std::vector<winrt::hstring> commands;
|
||||
const auto bufferCommands{ textBuffer.Commands() };
|
||||
|
||||
|
||||
auto trimToHstring = [](const auto& s) -> winrt::hstring {
|
||||
const auto strEnd = s.find_last_not_of(UNICODE_SPACE);
|
||||
if (strEnd != std::string::npos)
|
||||
@@ -2282,6 +2282,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
return *context;
|
||||
}
|
||||
|
||||
winrt::hstring ControlCore::CurrentWorkingDirectory() const
|
||||
{
|
||||
return winrt::hstring{ _terminal->GetWorkingDirectory() };
|
||||
}
|
||||
|
||||
Core::Scheme ControlCore::ColorScheme() const noexcept
|
||||
{
|
||||
Core::Scheme s;
|
||||
|
||||
@@ -184,6 +184,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
|
||||
void ContextMenuSelectCommand();
|
||||
void ContextMenuSelectOutput();
|
||||
|
||||
winrt::hstring CurrentWorkingDirectory() const;
|
||||
#pragma endregion
|
||||
|
||||
#pragma region ITerminalInput
|
||||
|
||||
@@ -62,5 +62,7 @@ namespace Microsoft.Terminal.Control
|
||||
void SelectOutput(Boolean goUp);
|
||||
IVector<ScrollMark> ScrollMarks { get; };
|
||||
|
||||
String CurrentWorkingDirectory { get; };
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3558,6 +3558,10 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
{
|
||||
return _core.CommandHistory();
|
||||
}
|
||||
winrt::hstring TermControl::CurrentWorkingDirectory() const
|
||||
{
|
||||
return _core.CurrentWorkingDirectory();
|
||||
}
|
||||
|
||||
Core::Scheme TermControl::ColorScheme() const noexcept
|
||||
{
|
||||
|
||||
@@ -113,6 +113,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
void SelectCommand(const bool goUp);
|
||||
void SelectOutput(const bool goUp);
|
||||
|
||||
winrt::hstring CurrentWorkingDirectory() const;
|
||||
#pragma endregion
|
||||
|
||||
void ScrollViewport(int viewTop);
|
||||
|
||||
@@ -805,10 +805,12 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
return _ExpandedCommandsCache;
|
||||
}
|
||||
|
||||
IVector<Model::Command> _filterToSendInput(IMapView<hstring, Model::Command> nameMap,
|
||||
winrt::hstring currentCommandline)
|
||||
#pragma region Snippets
|
||||
std::vector<Model::Command> _filterToSnippets(IMapView<hstring, Model::Command> nameMap,
|
||||
winrt::hstring currentCommandline,
|
||||
const std::vector<Model::Command>& localCommands)
|
||||
{
|
||||
auto results = winrt::single_threaded_vector<Model::Command>();
|
||||
std::vector<Model::Command> results{};
|
||||
|
||||
const auto numBackspaces = currentCommandline.size();
|
||||
// Helper to clone a sendInput command into a new Command, with the
|
||||
@@ -847,21 +849,22 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
return *copy;
|
||||
};
|
||||
|
||||
// iterate over all the commands in all our actions...
|
||||
for (auto&& [name, command] : nameMap)
|
||||
{
|
||||
// Helper to copy this command into a snippet-styled command, and any
|
||||
// nested commands
|
||||
const auto addCommand = [&](auto& command) {
|
||||
// If this is not a nested command, and it's a sendInput command...
|
||||
if (!command.HasNestedCommands() &&
|
||||
command.ActionAndArgs().Action() == ShortcutAction::SendInput)
|
||||
{
|
||||
// copy it into the results.
|
||||
results.Append(createInputAction(command));
|
||||
results.push_back(createInputAction(command));
|
||||
}
|
||||
// If this is nested...
|
||||
else if (command.HasNestedCommands())
|
||||
{
|
||||
// Look for any sendInput commands nested underneath us
|
||||
auto innerResults = _filterToSendInput(command.NestedCommands(), currentCommandline);
|
||||
std::vector<Model::Command> empty{};
|
||||
auto innerResults = winrt::single_threaded_vector<Model::Command>(std::move(_filterToSnippets(command.NestedCommands(), currentCommandline, empty)));
|
||||
|
||||
if (innerResults.Size() > 0)
|
||||
{
|
||||
@@ -874,17 +877,98 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
auto copy = cmdImpl->Copy();
|
||||
copy->NestedCommands(innerResults.GetView());
|
||||
|
||||
results.Append(*copy);
|
||||
results.push_back(*copy);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// iterate over all the commands in all our actions...
|
||||
for (auto&& [name, command] : nameMap)
|
||||
{
|
||||
addCommand(command);
|
||||
}
|
||||
// ... and all the local commands passed in here
|
||||
for (const auto& command : localCommands)
|
||||
{
|
||||
addCommand(command);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
IVector<Model::Command> ActionMap::FilterToSendInput(
|
||||
winrt::hstring currentCommandline)
|
||||
// Update ActionMap's cache of actions for this directory. We'll look for a
|
||||
// .wt.json in this directory. If it exists, we'll read it, parse it's JSON,
|
||||
// then take all the sendInput actions in it and store them in our
|
||||
// _cwdLocalSnippetsCache
|
||||
winrt::Windows::Foundation::IAsyncAction ActionMap::_updateLocalSnippetCache(winrt::hstring currentWorkingDirectory)
|
||||
{
|
||||
return _filterToSendInput(NameMap(), currentCommandline);
|
||||
// Don't do I/O on the main thread, duh
|
||||
co_await winrt::resume_background();
|
||||
|
||||
// This returns an empty string if we fail to load the file.
|
||||
auto localTasksFileContents = CascadiaSettings::ReadFile(currentWorkingDirectory + L"\\.wt.json");
|
||||
if (!localTasksFileContents.empty())
|
||||
{
|
||||
auto data = winrt::to_string(localTasksFileContents);
|
||||
std::string errs;
|
||||
static std::unique_ptr<Json::CharReader> reader{ Json::CharReaderBuilder::CharReaderBuilder().newCharReader() };
|
||||
Json::Value root;
|
||||
if (!reader->parse(data.data(), data.data() + data.size(), &root, &errs))
|
||||
{
|
||||
// In the real settings parser, we'd throw here:
|
||||
// throw winrt::hresult_error(WEB_E_INVALID_JSON_STRING, winrt::to_hstring(errs));
|
||||
//
|
||||
// That seems overly agressive for something that we don't
|
||||
// really own. Instead, just bail out.
|
||||
co_return;
|
||||
}
|
||||
|
||||
auto result = std::vector<Model::Command>();
|
||||
if (auto actions{ root[JsonKey("actions")] })
|
||||
{
|
||||
std::vector<SettingsLoadWarnings> warnings;
|
||||
for (const auto& json : actions)
|
||||
{
|
||||
auto parsed = Command::FromJson(json, warnings, OriginTag::Generated);
|
||||
// Skip over things that aren't snippets
|
||||
if (parsed->ActionAndArgs().Action() != ShortcutAction::SendInput)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
result.push_back(*parsed);
|
||||
}
|
||||
}
|
||||
|
||||
_cwdLocalSnippetsCache.insert_or_assign(currentWorkingDirectory, result);
|
||||
}
|
||||
|
||||
// Now at the bottom, we've either found a file successfully parsed it,
|
||||
// and updated the _cwdLocalSnippetsCache. Or we failed at some point,
|
||||
// and then it doesn't really matter.
|
||||
co_return;
|
||||
}
|
||||
|
||||
winrt::Windows::Foundation::IAsyncOperation<IVector<Model::Command>> ActionMap::FilterToSnippets(
|
||||
winrt::hstring currentCommandline,
|
||||
winrt::hstring currentWorkingDirectory)
|
||||
{
|
||||
// Check if there are any cached commands in this directory.
|
||||
// If there aren't, then we'll try to look for any commands in this
|
||||
// dir's .wt.json
|
||||
auto cachedCwdCommands = _cwdLocalSnippetsCache.find(currentWorkingDirectory);
|
||||
if (cachedCwdCommands == _cwdLocalSnippetsCache.end())
|
||||
{
|
||||
// Here, we haven't cached this path yet
|
||||
co_await _updateLocalSnippetCache(currentWorkingDirectory);
|
||||
cachedCwdCommands = _cwdLocalSnippetsCache.find(currentWorkingDirectory);
|
||||
}
|
||||
|
||||
auto cachedCommands = cachedCwdCommands != _cwdLocalSnippetsCache.end() ?
|
||||
cachedCwdCommands->second :
|
||||
std::vector<Model::Command>{};
|
||||
|
||||
co_return winrt::single_threaded_vector<Model::Command>(_filterToSnippets(NameMap(), currentCommandline, cachedCommands));
|
||||
}
|
||||
#pragma endregion
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
void ExpandCommands(const Windows::Foundation::Collections::IVectorView<Model::Profile>& profiles,
|
||||
const Windows::Foundation::Collections::IMapView<winrt::hstring, Model::ColorScheme>& schemes);
|
||||
|
||||
winrt::Windows::Foundation::Collections::IVector<Model::Command> FilterToSendInput(winrt::hstring currentCommandline);
|
||||
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Foundation::Collections::IVector<Model::Command>> FilterToSnippets(winrt::hstring currentCommandline, winrt::hstring currentWorkingDirectory);
|
||||
|
||||
private:
|
||||
Model::Command _GetActionByID(const winrt::hstring& actionID) const;
|
||||
@@ -101,6 +101,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
void _TryUpdateActionMap(const Model::Command& cmd);
|
||||
void _TryUpdateKeyChord(const Model::Command& cmd, const Control::KeyChord& keys);
|
||||
|
||||
winrt::Windows::Foundation::IAsyncAction _updateLocalSnippetCache(winrt::hstring currentWorkingDirectory);
|
||||
|
||||
Windows::Foundation::Collections::IMap<hstring, Model::ActionAndArgs> _AvailableActionsCache{ nullptr };
|
||||
Windows::Foundation::Collections::IMap<hstring, Model::Command> _NameMapCache{ nullptr };
|
||||
Windows::Foundation::Collections::IMap<Control::KeyChord, Model::Command> _GlobalHotkeysCache{ nullptr };
|
||||
@@ -133,6 +135,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
// we can give the SUI a view of the key chords and the commands they map to
|
||||
Windows::Foundation::Collections::IMap<Control::KeyChord, Model::Command> _ResolvedKeyToActionMapCache{ nullptr };
|
||||
|
||||
std::unordered_map<hstring, std::vector<Model::Command>> _cwdLocalSnippetsCache{};
|
||||
|
||||
friend class SettingsModelUnitTests::KeyBindingsTests;
|
||||
friend class SettingsModelUnitTests::DeserializationTests;
|
||||
friend class SettingsModelUnitTests::TerminalSettingsTests;
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Microsoft.Terminal.Settings.Model
|
||||
|
||||
IVector<Command> ExpandedCommands { get; };
|
||||
|
||||
IVector<Command> FilterToSendInput(String CurrentCommandline);
|
||||
Windows.Foundation.IAsyncOperation<IVector<Command> > FilterToSnippets(String CurrentCommandline, String CurrentWorkingDirectory);
|
||||
};
|
||||
|
||||
[default_interface] runtimeclass ActionMap : IActionMapView
|
||||
|
||||
@@ -1095,6 +1095,20 @@ void CascadiaSettings::ExportFile(winrt::hstring path, winrt::hstring content)
|
||||
}
|
||||
CATCH_LOG();
|
||||
}
|
||||
winrt::hstring CascadiaSettings::ReadFile(winrt::hstring path)
|
||||
{
|
||||
try
|
||||
{
|
||||
auto maybeContents = ReadUTF8FileIfExists({ path.c_str() });
|
||||
if (maybeContents.has_value())
|
||||
{
|
||||
return winrt::hstring{ til::u8u16(*maybeContents) };
|
||||
}
|
||||
}
|
||||
CATCH_LOG();
|
||||
|
||||
return L"";
|
||||
}
|
||||
|
||||
void CascadiaSettings::_validateThemeExists()
|
||||
{
|
||||
|
||||
@@ -113,6 +113,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
static winrt::hstring ApplicationVersion();
|
||||
static bool IsPortableMode();
|
||||
static void ExportFile(winrt::hstring path, winrt::hstring content);
|
||||
static winrt::hstring ReadFile(winrt::hstring path);
|
||||
|
||||
CascadiaSettings() noexcept = default;
|
||||
CascadiaSettings(const winrt::hstring& userJSON, const winrt::hstring& inboxJSON);
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace Microsoft.Terminal.Settings.Model
|
||||
static String ApplicationVersion { get; };
|
||||
|
||||
static void ExportFile(String path, String content);
|
||||
static String ReadFile(String path);
|
||||
|
||||
CascadiaSettings(String userJSON, String inboxJSON);
|
||||
|
||||
|
||||
@@ -501,9 +501,10 @@ JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::FindMatchDirecti
|
||||
|
||||
JSON_FLAG_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::SuggestionsSource)
|
||||
{
|
||||
static constexpr std::array<pair_type, 5> mappings = {
|
||||
static constexpr std::array<pair_type, 6> mappings = {
|
||||
pair_type{ "none", AllClear },
|
||||
pair_type{ "tasks", ValueType::Tasks },
|
||||
pair_type{ "snippets", ValueType::Tasks },
|
||||
pair_type{ "commandHistory", ValueType::CommandHistory },
|
||||
pair_type{ "directoryHistory", ValueType::DirectoryHistory },
|
||||
pair_type{ "all", AllSet },
|
||||
|
||||
Reference in New Issue
Block a user