How to remap "Go to definition" and "Rename all instances" on ZeroBrane Studio? - lua

I'm using ZeroBrane Studio 1.30
Is there any way to remap the Ctrl/Cmd-DoubleClick shortcut to something on the keyboard, like Ctrl-R? (Without the mouse click) on the user preferences?
At the same time, is there a way to remap the "Go to definition" shortcut to something else than Ctrl/Cmd+Alt+Click.
I already tried these with no luck:
keymap[ID.RENAMEALLINSTANCES] = "Ctrl-R"
editor.keymap[#editor.keymap + 1] = {('R'):byte(), wxstc.wxSTC_SCMOD_CTRL, ID.RENAMEALLINSTANCES}
Also instead of ID.RENAMEALLINSTANCES I've tried ID_RENAMEALLINSTANCES with no luck.

Not in 1.30 (which is the currently released version). This functionality has already been added and will be available in the next release (or you can use the current master branch).

Related

TSaveDialog Options ofAllowMultiSelect doesn't work properly on a W10 system

I have an old application, untouched for a long time, built with C++ Builder 2009, that still works fine.
That is to say ..
Today I noticed some of the TSaveDialog->Options don't work as intended on my Windows 10 system. To make sure I'm not dreaming I tested the same application on an older Windows version (I tried XP) and there it worked perfectly fine as intended.
The TSaveDialog instance is setup at design time with Options: [ofHideReadOnly,ofAllowMultiSelect,ofEnableSizing]
I noticed today (on Windows 10) that ofAllowMultiSelect doesn't work anymore ?
Instead ofOverwritePrompt is (incorrectly) used !
In other words I cannot select two ore more files anymore and when I select a file that already exists I first get a 'Confirm Save As' dialog.
When I compile again on my Windows 10 system, using C++ Builder 2009, in debug mode and inspect Options, the debugger seems to (still) properly see ofHideReadOnly, ofAllowMultiSelect, ofEnableSizing, yet the problem persists. So it's not as if the values changed somehow ?
When I try at runtime:
SaveDialog->Options.Clear() ;
SaveDialog->Options << ofHideReadOnly << ofEnableSizing << ofAllowMultiSelect ;
the problem also persists !
When I remove ofAllowMultiSelect (at run time or at design time) 'Confirm Save As' is not shown anymore on an existing file (but I obviously also still can't select multiple files).
I'm flabbergasted by this to be honest ? Not sure what to do next ?
I have no option to test a more recent c++ version but I'm also having difficulties comprehending how the compiler could be responsible here.
Any guidance appreciated.
Delphi tag added because of VCL overlap between c++ Builder and Delphi
On Windows Vista and later, IF AND ONLY IF all of these conditions are met:
the global Dialogs::UseLatestCommonDialogs variable is true
and the TSaveDialog::Template property is NULL
and the TSaveDialog::OnIncludeItem, TSaveDialog::OnClose, and TSaveDialog::OnShow events have no handlers assigned
Then TSaveDialog will internally use the Win32 IFileSaveDialog interface, where the ofAllowMultiSelect option will be mapped to that dialog's FOS_ALLOWMULTISELECT option, which is NOT SUPPORTED by IFileSaveDialog, only by IFileOpenDialog, per the documentation:
FOS_ALLOWMULTISELECT
Enables the user to select multiple items in the open dialog. Note that when this flag is set, the IFileOpenDialog interface must be used to retrieve those items.
If the above 3 conditions are not satisfied, then TSaveDialog will internally use the Win32 GetSaveFileName() function instead, where the ofAllowMultiSelect option will be mapped to that dialog's OFN_ALLOWMULTISELECT option, which IS SUPPORTED by GetSaveFileName() 1.
That is why you are seeing behavioral differences when running your app on Windows XP vs Windows 10.
So, if you want the old TSaveDialog behavior on newer Windows versions, you need to make sure at least 1 of those 3 conditions is not satisfied. For instance, by setting UseLatestCommonDialogs=false before calling SaveDialog->Execute(), or by assigning an (empty) event handler to one of the OnIncludeItem/OnClose/OnShow events.
Or, you could simply call GetSaveFileName() directly, instead of using TSaveDialog at all.
1: However, just note that on Vista+, GetSaveFileName() is just a wrapper for IFileSaveDialog, and is provided only for backwards compatibility. So, you still might not get the exact behavior you want even if you did use GetSaveFileName() on Windows 10.
On a side note: this code does not work the way you think it does:
SaveDialog->Options.Clear();
SaveDialog->Options << ofHideReadOnly << ofEnableSizing << ofAllowMultiSelect;
The Options property is not actually updated! In both statements, the Options property is read from, returning a temporary TOpenOptions, which you are then modifying, but not assigning back to the Options property. IOW, the code is effectively doing the following:
TOpenOptions temp1 = SaveDialog->Options;
temp1.Clear();
TOpenOptions temp2 = SaveDialog->Options;
temp2 << ofHideReadOnly << ofEnableSizing << ofAllowMultiSelect;
So, to update the Options property correctly, use this instead:
SaveDialog->Options = TOpenOptions() << ofHideReadOnly << ofEnableSizing << ofAllowMultiSelect;

TFS checkin policy with ReSharper Cleanup Code

We are trying to have ReSharper's cleanup code run on TFS Checkin. Ideally, when you right click on the solution / project and select Source Control > Check in all the files in the "Included Changes" should run cleanup code. I've got the custom checkin policy to work to some extent, works fine if you select a single file to check in but when you select the solution or project, it tries to run cleanup code on the entire solution / project and not just the files selected in TFS Pending Changes "Include Changes".
I'm running VS 2013 with R# 8.2. My policy evaluate code:
public override PolicyFailure[] Evaluate()
{
if (PendingCheckin.Policies.EvaluationState == PolicyEvaluationState.Unevaluated)
{
DTE2 dte = PendingCheckin.GetService(typeof (DTE)) as DTE2;
foreach (EnvDTE.Document doc in dte.Documents)
{
doc.DTE.ExecuteCommand("ReSharper_SilentCleanupCode");
}
}
return new PolicyFailure[0];
}
I don't think this only applies to ReSharper, executing "Edit.FormatDocument" here would most likely run on all files as well.
Is there a way to run ExecuteCommand on only 1 file / document?
It seems like
PendingCheckin.GetService(typeof (DTE))
only gets files that are open in the Visual Studio editor not all the files that are in the "Include Changes" list. I can get a list of PendingChange through
PendingCheckin.PendingChanges.CheckedPendingChanges
But I don't know how to execute a command on PendingChange. Recommendations here would help
PS: I've read that the check in policy is meant to be used for checking documents only, however this workflow is what we need.

Cascading Context Menu Explorer CommandStore Missing

I'm trying to create a new cascading menu for the windows context menu but in my registry on Windows Vista I do not have a CommandStore Key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\ and if I add one it does not work.
For instance if I was to say do this:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\Shell\Menu]
"MUIVerb"="ZIP"
"SubCommands"="SFX"
"icon"="c:\Program Files\7-Zip\7z.exe"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\SFX]
#="Compress To Exe"
"icon"="c:\Program Files\7-Zip\7z.exe"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\SFX\command]
#=""c:\Program Files\7-Zip\7z" u -mx9 -sfx -r -t7z "%1.exe" "%~f1""
All I get is a menu item called ZIP but no sub menus and an error when clicked.
This will not work, am I doing something wrong, or is there a better way to do this?
As far as I know this can be done only with Windows 7 (and potentially later versions)

Keyboard shortcuts for Compare with Latest Version / Compare with Workspace version in Visual Studio 2012

This was easy in VS 2010, but I can't find the right items in VS 2012.
I'd like to set keyboard shortcuts for the Compare With Latest/Workspace Version context menu items in the TFS Pending Changes view. What's the item I should select in the Keyboard section of the Tools dialog?
(This was tested with Visual Studio 2012 Update 1)
Tools > Options > Environment > Keyboard >
Under Show commands containing search and assign key combinations to:
TeamFoundationContextMenus.PendingChangesPageChangestoInclude.TfsContextPendingChangesPageCompareWithPreviousVersion - compares pending item in context to previous version.
TeamFoundationContextMenus.PendingChangesPageChangestoInclude.TfsContextPendingChangesPageCompareWithLatestVersion - compares pending item in context to latest version.
TeamFoundationContextMenus.PendingChangesPageChangestoInclude.TfsContextPendingChangesPageCompareWithWorkspaceVersion - compares pending item in context to workspace version.
File.TfsCompare - open the compare dialog.
For me, this worked:
VS > Tools > Options > Environment > Keyboard > Show Commands Containing: Team.Git.CompareWithUnmodified
By assigning a shortcut key Ctrl+\, Ctrl+\ to this command ( Team.Git.CompareWithUnmodified) I can now compare my current file (the file that is open in the editor) to the previous version of the file by pressing the shortcut key Ctrl+\, Ctrl+\; no need to find the file in solution explorer, then right-click the file then select Compare.
(you can choose your own shortcut key of course)
Just a note on different behaviour:
Team.Git.CompareWithUnmodified works for me because I am using TeamExplorer in VisualStudio but I use GIT as the underlying source code repository.
Tfs.FileCompare could also work in other scenarios (i.e. if you don't use Git, but use VSTS or TFS as your source control provider).
Other: the command will be different if you use another source control provider.
While you have the file open use this combo to compare with Workspace version:
Menu, O, C, Enter
(This performs Right Click > Source Control > Compare > Workspace Version)
If your keyboard doesn't have a Menu key, do this:
Set the hotkey for File.TfsCompare to Ctrl+\ Ctrl+\
Use the combo: Ctrl+[ Ctrl+S Ctrl+\ Ctrl+\ Enter

Subscribing to file check ins with tfs 2010 alerts

I am trying to setup alerts to the team when a specific file is checked into TFS, have have found some info on this using tfs 2008, which leads me to believe the following filter should work:
'Artifacts/Artifact[starts-with(#ServerItem, $/Matrix/Dev/Matrix/Applications/Matrix.UI/Web.Config)]' <> NULL
But this just give me an Invalid Token error, any ideas how i get this working in 2010?
Thanks.
With installed Power Tools, right-click in Team Explorer on the upmost node (the icon for the TeamCollection) & open "Alerts Explorer".Generate a new CheckIn alert:
now set the source control pathto the files you 're interested in:
This generated a Filter Expression = 'Artifacts/Artifact[starts-with(translate(#ServerItem, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz"), "$/foo/bar.cs")]' <> null

Resources