Show all occurrences of a word in the IDE

Working on new editor enhancements?
AZJIO
Addict
Addict
Posts: 2143
Joined: Sun May 14, 2017 1:48 am

Re: Show all occurrences of a word in the IDE

Post by AZJIO »

Update
Command line "TitlePart ClassWindow CurrentWord TestFlag" supported for 3rd party Scintilla editors.

Now you can use the same executable for PureBasic, SciTE, Notepad++. In the description of the program, I added configuration files for SciTE and Notepad++

Video of how it works
AZJIO
Addict
Addict
Posts: 2143
Joined: Sun May 14, 2017 1:48 am

Re: Show all occurrences of a word in the IDE

Post by AZJIO »

Update (download)
When searching for tmp$ variables, the \$ character is escaped and as a result I get tmp\$

Code: Select all

	; Escape metacharacters in SelectedWord
	rex1 = CreateRegularExpression(#PB_Any, "[][{}()*+?.\\^$|=<>#]", #PB_RegularExpression_NoCase)
	If rex1
		Text\s = SelectedWord
		RegexReplace2(rex1, @Text, "\\0")
		SelectedWord = Text\s
		FreeRegularExpression(rex1)
	EndIf
Two regular expressions for searching strings

Code: Select all

			AddGadgetItem(#cmbRex, -1, "(?# String )(?m)~?" + #q$ + ".*?[^\\]" + #q$)
			AddGadgetItem(#cmbRex, -1, "(?# ~String )(?m)~" + #q$ + ".*?[^\\]" + #q$)
The search for which procedure a word is in can be speeded up by obtaining the positions of all procedures and line numbers in one pass through the file, and then compare whether the word is inside the positions that are marked as the beginning and end of the procedure. This is faster than searching backwards, as it forces you to navigate through the same text multiple times.

Uploaded it again. Improved the source code for Linux
SMaag
Enthusiast
Enthusiast
Posts: 302
Joined: Sat Jan 14, 2023 6:55 pm
Location: Bavaria/Germany

Re: Show all occurrences of a word in the IDE

Post by SMaag »

I request a very practical extention of that Tool

I tried to use it as a help to declare public functions of a Module
That's possible if you slect show all Procedures and then copy it wiht right Mouse-Click.
Then I paste It into a new File in PB-IDE, replaced all Prucedure with Declare and removed empty lines.
Then I removed private Functions.

Here the idea for the new function

- search for all Public Procedures (eliminate such which start with '_' what's the most used sign for private
- integrate a copy function what copies the Procedures as Declare statements to the Clipboard
Mesa
Enthusiast
Enthusiast
Posts: 433
Joined: Fri Feb 24, 2012 10:19 am

Re: Show all occurrences of a word in the IDE

Post by Mesa »

for information, my own tool made with a scintilla gadget is updated, see the very first post.

M.
Post Reply