-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
settings.json parent folder functionality #15417
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Messy formatting, should clean up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tools\runformat.cmd
from this repo will help reformat files automatically 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you prefer PowerShell (like me), you can also do the following:
Import-Module .\tools\OpenConsole.psm1
Invoke-CodeFormat
Then, just be sure to commit the changes with git.
@microsoft-github-policy-service agree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, I'm cool with this. If you get really stuck with the Resources thing, then we can always just merge as-is and have the core team fix in post
(sorry for the delays, we were all a little preoccupied with Build last week)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tools\runformat.cmd
from this repo will help reformat files automatically 😉
<muxc:NavigationViewItem.ContextFlyout> | ||
<MenuFlyout> | ||
<MenuFlyoutItem | ||
x:Name="OpenJsonFolderNavItem" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you give this a x:Uid
, like:
<muxc:NavigationViewItem x:Name="OpenJsonFolderNavItem"
x:Uid="Nav_OpenJsonFolder"
Then you should be able to set the text in the TerminalSettingsEditor\Resources\en-us\resources.resw
like:
<data name="Nav_OpenJsonFolder.Text" xml:space="preserve">
<value>Open JSON folder</value>
</data>
And even the tooltip should be settable with
<data name="Nav_OpenJsonFolder.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Open the folder holding your settings.json file.</value>
</data>
And if that doesn't work, then there's something wacky going on with XAML
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is exactly what I attempted originally. The thing is, NavigationViewItem.ContextFlyout doesn't take a x:Name and a x:Uid attribute. Moreover, adding the attributes to the Menuflyout or the MenuflyoutItem simply crashes the settings menu all together.
I have successfully set up different navigation items with the exact same x:Name and x:Uid, and I set the data through the .resw file. It works for most Navigation Items, but not with Menuflyouts for some reason.
I think this has something to do with the XAML or how it's wired to the rest of the program.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... Mind committing your changes anyways? I tried the suggested changes on my end, and it worked fine. I'd be happy to take a closer look at your approach and let you know how to fix it :)
Also, you're not referencing the name OpenJsonFolderNavItem
anywhere, so you might as well remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a relic of me trying to get the resources to work! Curious that it works on your end. Must be my system. I'll commit the changes, maybe I am doing something wrong, too. I appreciate the feedback!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good progress! Just a few things before I sign off.
I'm also going to add the "Needs-Discussion" tag so we discuss this as a team. Specifically...
- I have concerns that this feature might not be discoverable
- Should we update the "new tab dropdown" "open settings" item so that if you click it with a specific modifier, it'll open the folder.
- Should the same be done for the settings button in the settings UI (the one you're messing with right now), instead of adding a flyout?
Feel free to brainstorm and discuss in this PR too. :)
@@ -63,7 +63,8 @@ namespace Microsoft.Terminal.Settings.Model | |||
SettingsFile = 0, | |||
DefaultsFile, | |||
AllFiles, | |||
SettingsUI | |||
SettingsUI, | |||
SettingsFolder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Related to this PR, but not necessary to make this change in this PR) IMO, at this point, we should fully commit and also add this as a parameter to the openSettings
action. If you're interested in doing that, I think you'd mainly have to update...
- ActionArgs.cpp
OpenSettingsArgs::GenerateName()
- TerminalSettingsSerializationHelpers.h
JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::SettingsTarget)
- Resources.resw in the
TerminalSettingsModel
project (this is where you update the resource key forGenerateName()
)
Since you already updated TerminalPage::_LaunchSettings()
, this should just work outright!
If you're not interested though, let me know. Happy to do it as a follow up myself :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you prefer PowerShell (like me), you can also do the following:
Import-Module .\tools\OpenConsole.psm1
Invoke-CodeFormat
Then, just be sure to commit the changes with git.
<muxc:NavigationViewItem.ContextFlyout> | ||
<MenuFlyout> | ||
<MenuFlyoutItem | ||
x:Name="OpenJsonFolderNavItem" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... Mind committing your changes anyways? I tried the suggested changes on my end, and it worked fine. I'd be happy to take a closer look at your approach and let you know how to fix it :)
Also, you're not referencing the name OpenJsonFolderNavItem
anywhere, so you might as well remove it.
I definitely agree; you'd have to right click by accident to discover it the way it's set up right now.
The thing is, there's already an alt-click modifier currently. Wouldn't the tooltip get quite lengthy if we tried something like that?
I do believe that we should apply whatever we decide is best universally. As in, it should be the same anywhere you can access the settings JSON. Really, I think our options are either a modifier or some kind of drop down. The latter might result in a messy user experience . A possible approach to the former might to figure out some other place we can move the current modifier to. This is, of course, if we believe that the JSON folder is a more significant and frequent operation than accessing the default JSON file. (I believe that's the current applied modifier, I have to double-check.) |
@carlos-zamora I committed the changes I talked about. However, do note that it's still not working on my local system. I have the output debug text file where the program crashes when I try to navigate to the settings menu at all. I have attached it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding my comment earlier about discoverability. We chatted about this PR more as a team. Two things came out of it:
- We feel it'd be best to prioritize this as an
action
and add it to the command palette. To do that, you'll have to...- follow the instructions from this comment. This hooks it up as an action.
- add
{ "command": { "action": "openSettings", "target": "<JSON KEY FROM TerminalSettingsSerializationHelpers.h>" } },
to defaults.json. This adds it to the command palette for everyone. I'd add it next to the otheropenSettings
actions.
- Since the context menu isn't very discoverable, we think long-term, a better design would be something like the following:
That said, we'd like to pivot this PR to focus on accomplishing the first item above and remove the context menu functionality (so basically, revert all changes made to src/cascadia/TerminalSettingsEditor
). Then, as a follow-up, the UI changes can be introduced with the design from the second point above.
How does that sound? Happy to help and provide any more guidance along the way. 😊
@@ -577,6 +577,10 @@ | |||
<data name="Nav_OpenJSON.Content" xml:space="preserve"> | |||
<value>Open JSON file</value> | |||
<comment>Header for a menu item. This opens the JSON file that is used to log the app's settings.</comment> | |||
</data> | |||
<data name="Nav_OpenJSONFolder.Content" xml:space="preserve"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<data name="Nav_OpenJSONFolder.Content" xml:space="preserve"> | |
<data name="Nav_OpenJSONFolder.Text" xml:space="preserve"> |
Found the bug! This'll fix the crash!
@@ -577,6 +577,10 @@ | |||
<data name="Nav_OpenJSON.Content" xml:space="preserve"> | |||
<value>Open JSON file</value> | |||
<comment>Header for a menu item. This opens the JSON file that is used to log the app's settings.</comment> | |||
</data> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, make sure you use spaces here, not tabs.
If you want, you can also edit this file in Visual Studio. It gives you a table to work with, and always formats it correctly.
This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment. |
2 similar comments
This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment. |
This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment. |
Summary of the Pull Request
Added menu flyout to "Open JSON" that takes you to the JSON parent folder instead.
This is in response to #12382
Added comments for the one function I had to implement for the path. Nothing complicated.