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

Correct IScriptsManager resolution in Settings dialog #11254

Merged
merged 2 commits into from
Oct 9, 2023

Conversation

RussKie
Copy link
Member

@RussKie RussKie commented Oct 8, 2023

Resolves #11253

As reported in #11239 (comment) (/cc: @SlugFiller)

@ghost ghost assigned RussKie Oct 8, 2023
Copy link
Member

@mstv mstv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works for me

BTW: The ScriptsSettingsPage takes much time for loading (not caused by the DI refactorings).

GitUI/GitModuleControl.cs Outdated Show resolved Hide resolved
@RussKie
Copy link
Member Author

RussKie commented Oct 8, 2023 via email

@SlugFiller
Copy link
Contributor

Well, the settings page opens now. But the script settings aren't being saved. Going to try to investigate.

@SlugFiller
Copy link
Contributor

Okay, I figured it out. GitUI.ScriptsEngine.IScriptsManager does not offer an interface for altering the scripts. Therefore, in GitUI.CommandsDialogs.SettingsDialog.Pages.ScriptsSettingsPage.PageToSettings it creates a scripts list that is never used.

Also, I hate everything about the way GitUI.ScriptsEngine.GetScripts.FixAmbiguousHotkeyCommandIdentifiers is implemented. Instead of using the HashSet to find empty ids (in a defragmenting fashion), it does a max operation on the original set. Even if only doing max, it doesn't try to simply store the max and increment it.

Last, but not least, it should probably not be inside a function, so it can be used to do a sanity check on saved settings, and not just loaded ones.

Finally, the having a proxy version of the script binding interface should have probably been reserved for being able to deserialize older versions of the XML (e.g. to rename options, or change their type).

@SlugFiller
Copy link
Contributor

SlugFiller commented Oct 8, 2023

nvm, looks like you got it covered

Comment on lines -194 to +185
List<ScriptInfo> scripts = new(ScriptsManager.GetScripts());
BindingList<ScriptInfo> scripts = _scriptsManager.GetScripts();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the cause of the regression.

@SlugFiller
Copy link
Contributor

Confirmed saving settings works now

@mstv
Copy link
Member

mstv commented Oct 8, 2023

saving works but many tests fail

@RussKie
Copy link
Member Author

RussKie commented Oct 8, 2023 via email

@RussKie RussKie merged commit 8ec3ae8 into gitextensions:master Oct 9, 2023
3 of 4 checks passed
@RussKie RussKie deleted the Fix_settings_page branch October 9, 2023 11:08
@ghost ghost added this to the vNext milestone Oct 9, 2023
@RussKie
Copy link
Member Author

RussKie commented Oct 9, 2023

The PR build succeeded though the master is now failing.... I will have to have a look tomorrow or the day after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FormSettings: InvalidOperationException IGitUICommands
3 participants