Show all occurrences of a word in the IDE

Working on new editor enhancements?
AZJIO
Addict
Addict
Posts: 1298
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: 1298
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.
Post Reply