Open retailcoder opened 9 years ago
I had started the re-wiring of that feature into the 2.0 architecture, what's left to do is to move logic from the dockable presenter into a ViewModel (leaving the presenter pretty much empty), and make a nice XAML UserControl for it.
let's just tweak "replace all" and make it "replace all selected"
Could I give a little nudge for this feature. I'm currently stuck with non-compilable code so can't use Rubberduck's refactoring. Find and replacing that allowed proper wildcards would be really really helpful right now.
I endorse giving a nudge to this feature as the VBA IDE's Ctrl-H find and replace feature is woefully inadequate for doing anything except the simplest find and replace operations, and one should not have to copy code to an advanced text editor (such as UltraEdit), use its RegEx-based search and replace feature to edit that code, and then copy it back into the VBA IDE code window if RubberDuck is a "full-featured" IDE for VBA.
Also in this vein, the Refactor > Rename capability should support RegEx-based renaming and should also provide scoping for renaming to make it a truly exceptional feature.
Zev: So far as I can find, no RegEx-based search and replace function has been implemented on any of the RD menus. If I missed it, my apologies.
The second part of my suggestion--related to the general one--re scoping and RegEx capabilities for Refactor > Rename--is also not implemented so far as I can tell.
All of this would be very useful.
There has been a first implementation of this feature for a long time. However, it has some serious issues, e.g. in its handling of COM wrappers, and is only present in debug builds. I think nobody has worked on it for several years.
Thanks, Max. I hope someone gets back into it, but I know it would be beyond my capabilities to do so.
Is this implementation broken? Running 2.5.2.6059 and when I try and bring up the regex search and replace, nothing occurs.
Windows 10 Pro 21H2 64-bit Office 365 64-bit 16.0.15726.20188
Log shows: 2022-11-30 12:19:06.6517;DEBUG-2.5.2.6059;Rubberduck.UI.Command.MenuItems.ParentMenus.ParentMenuItemBase;(6168214) Executing click handler for menu item 'Rege&x Search/Replace', hash code 49546911;
Nothing else of consequence.
Hm, that menu item shouldn't be there, this was on the back burner forever. On the bright side (?), it's definitely going to be a RD3 feature.
@mindflux you're a couple of prereleases behind... You may want to upgrade to the latest build. A lot of things have been fixed in the last 10 months.
@mindflux you're a couple of prereleases behind... You may want to upgrade to the latest build. A lot of things have been fixed in the last 10 months.
Okay I grabbed what was latest on rubberduckba. I've got a newer build off github loaded now.
Running 2.5.2.6207 the Regex menu item still exists (it sounds like it's not supposed to right now?).
Mathieu:
As you see from the below, we’ve have a couple of interchanges before about Rubberduck VBA, of which I am a great fan and for which you are due great praise and thanks.
I’m an older lawyer who has been programming since I was a young lawyer (I should have gone into tech, but oh well). A lot of my coding has been in VBA since Office came out and one of my prior firms went to it (I had to give up XyWrite for Word, but when I found out that Word had a much more sophisticated programming environment than XyWrite did, I was all in, and one of the first things I did in VBA was to write a command line interface for Word to implement XyWrite’s command line interface, where, for example, lm 5 in a command line would set the left margin at .5”, and I use that interface to this day—though it is still straight procedural code). I’ve made Word documents jump through hoops, among other things.
Your articles about VBA have helped me so much in understanding OOP much better than I did and making more use of classes than I previously had. I have even taken the first steps at writing a Word routine that uses the Model View View Model approach to a problem, though I am not yet done with having all the executions driven by the user form completely abstracted from the View through a collection of execution classes rather than in the code behind or caller.
But here is why I am writing you today. Through your Twitter account I recently saw your retweet of No Longer Set, who referred to AutoHotkey in one of his linked articles, and was intrigued by it (I’ve been a long-time user of WinBatch to automate Windows after “graduating” from DOS batch files, and have dabbled in PowerShell), so I downloaded it to address the simple issue of going back and forth between the Code Pane and the Immediate Window, and clearing the Immediate Window easily (as one can do in Visual Studio and the Powershell ISE). Luckily, I came to AHK just after v.2 was released so I’m not “burdened” by a v.1 to v.2 transition.
Then I was bitten by my next programming project: VBA has needed a snippets capability and AHK could be its implementing platform. I don’t know if that is something you are thinking about a part of VBA 3.0, and my skills are not advanced enough to do a full-blown implementation with full token substitution like Visual Studio does (whether in AHK or some other language), but I have written in AHK a VBA snippets system (having both a dialog box interface a là Visual Studio and an individual hotkey approach) that I would be happy to have you take a look at and use in any way you find valuable if you would like. I do do name substitution for a new sub or function interactively, but otherwise just leave the insertion point at a particular location for the user (me) to take the next steps.
Here are a couple of pictures of my AHK VBA Snippets interface:
Here are the snippets that I have implemented so far:
[Headers]
Standard Module
Class Module
UserForm Module
Options
[Declarations]
Type
Enum
Constants
Dim Variables
Private Variables
Public Variables
[Properties]
Let
Set
Get
Get Object
[Procedures]
Sub
Function
[Conditionals]
If..EndIf
If..Else..EndIf
If..ElseIf..Else..EndIf
Select Case
[Loops]
For..Next
For Each..Next
Do..Loop
Do..Loop Until
Do..Loop While
Do Until..Loop
Do While..Loop
While..Wend
[Objects]
With..End With
Regular Expression
[Dialogs]
Message Box
Message Box PopUp
Best, and thanks again for all your hard work on Rubberduck VBA!
Nick
Nick De Lancie
638 34th Avenue
San Francisco, California 94121
(415) 668-3110 Home
(415) 317-0875 Mobile
From: Mathieu Guindon @.> Sent: Wednesday, November 30, 2022 02:30 pm To: rubberduck-vba/Rubberduck @.> Cc: NDeLancie @.>; Comment @.> Subject: Re: [rubberduck-vba/Rubberduck] Regex Search & Replace (#327)
Hm, that menu item shouldn't be there, this was on the back burner forever. On the bright side (?), it's definitely going to be a RD3 feature.
— Reply to this email directly, view it on GitHub https://github.com/rubberduck-vba/Rubberduck/issues/327#issuecomment-1332820390 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AFOK5ZOV7PLAE52BUXESI6DWK7IPRANCNFSM4A6HEI3Q . You are receiving this because you commented. https://github.com/notifications/beacon/AFOK5ZLHECHLEH4TURGSW23WK7IPRA5CNFSM4A6HEI32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOJ5YTTJQ.gif Message ID: @. @.> >
@NDeLancie Thanks for your detailed thoughts and ideas. We appreciate your time.
It looks like your pictures didn't upload correctly, perhaps due to (what looks like) an email reply instead of using the Github website? Either way, I like your ideas, and I'd like to see more of what you implemented.
May I suggest you create a new item in the Ideas Discussions section? This thread is about a different topic, and I wouldn't want your idea to be lost in the shuffle. Thanks again!
Let's implement a regex search & replace functionality; a simple dialog that allows entering a regex pattern, selecting the scope of the search (current procedure, current component/module, current project, all opened code panes, or just everywhere); there needs to be "find next", "replace", "replace all" and "cancel" buttons.