Need Advice on Finding My Missing { bracket
Need Advice on Finding My Missing { bracket
Hello. Ever since I can remember Ive had an issue with Skite4AHK where-in I'm missing a bracket somewhere, and its causing an opening bracket to attach to a closing bracket that it wasnt meant to attach to. I find myself wasting the most time out of any instance trying to find where the bracket is that I forgot to add. I dont have any method, I just scroll up and down for countless minutes seeing whats attached to what, trying to look through and see whats not connected to what. Does anyone have a method for quickly finding where the bracket is thats missing its counter-part? I feel like in my head I should intuitively know like delete one bracket somewhere and then whatever that bracket is now attached to was the one I'm missing or something, I just cant ever seem to grasp what to do. Thanks and appreciate any help.
Re: Need Advice on Finding My Missing { bracket
If you use a good indenting approach, it should make it easy to identify code blocks and quickly see where their associated pair of braces should be.
Re: Need Advice on Finding My Missing { bracket
Also, avoid the One True Brace (OTB, K&R style) because AHK 1.1 ignores such braces where not permitted.
Re: Need Advice on Finding My Missing { bracket
Haven't had that problem since starting with VSC. Here is an interesting blog I came across while searching bracket pair colorization
Last edited by Chunjee on 11 May 2024, 17:59, edited 1 time in total.
v1: biga.ahk | array.ahk | string-similarity | graphicsearch.ahk | midday.ahk | expect.ahk
Re: Need Advice on Finding My Missing { bracket
Bet I could find it if the code was posted
v1: biga.ahk | array.ahk | string-similarity | graphicsearch.ahk | midday.ahk | expect.ahk
Re: Need Advice on Finding My Missing { bracket
Look between P and }. (Sorry... I had to...)
lol... would definitely help others participate in the search...
You might try using regex search in Notepad++ to highlight matching pairs of braces. This would allow you to inspect to see if the grouping looks correct, and delete each legitimate find one at a time to narrow the search. This may or may not be helpful.Does anyone have a method for quickly finding where the bracket is thats missing its counter-part?
Here is the regex needle to plug in. It supports nesting as well.
(\{(?>[^}{]+|(?-1))*\})
if you have something like this, it may be very difficult to find. Especially with v1
(\d{2])
A script could be written to assist, but as Chunjee pointed out, posting the code will help others assist for a faster solution...
Re: Need Advice on Finding My Missing { bracket
No only I have been specifically trained for this. In fact my entire programming career has lead to this exact point. To find this exact missing curly boi
v1: biga.ahk | array.ahk | string-similarity | graphicsearch.ahk | midday.ahk | expect.ahk
-
- Posts: 864
- Joined: 21 Dec 2015, 02:34
Re: Need Advice on Finding My Missing { bracket
This is where I always thought that a text editor with color coding would come in handy.
I use Notepad++ for everything because I find it the easiest. You can color-code your text as well. Problem is, the color coding doesn't save with the file so next time you re-open your text file, the color coding is gone.
There's Sublime text editor which apparently has color coding but I find that program to be insanely complicated. Good old regular Notepad is just regular black text, so nothing there either.
If Notepad++ could save its colored text we'd have a winner there!
*Edit - Looks like Notepad++ may not actually change the text color by itself; it sort of adds a background color to it (looks the same as when regular text is highlighted, and it allows you to select the color of that highlighting)... but it doesn't change the color of the text. Which isn't too bad but then it can get confusing because someone might confuse that with the text actually being highlighted instead of it being just a color style. And again, it won't save this color-coding when closing the file and re-opening it later.
I use Notepad++ for everything because I find it the easiest. You can color-code your text as well. Problem is, the color coding doesn't save with the file so next time you re-open your text file, the color coding is gone.
There's Sublime text editor which apparently has color coding but I find that program to be insanely complicated. Good old regular Notepad is just regular black text, so nothing there either.
If Notepad++ could save its colored text we'd have a winner there!
*Edit - Looks like Notepad++ may not actually change the text color by itself; it sort of adds a background color to it (looks the same as when regular text is highlighted, and it allows you to select the color of that highlighting)... but it doesn't change the color of the text. Which isn't too bad but then it can get confusing because someone might confuse that with the text actually being highlighted instead of it being just a color style. And again, it won't save this color-coding when closing the file and re-opening it later.
Re: Need Advice on Finding My Missing { bracket
Are you aware of the concept of syntax highlighting (the text color itself, not just the background) that pretty much every editor that is meant for coding, including Notepad++, is capable of? It automatically changes the color of the text depending on the category of the code (variables, function names, literal strings, comments, etc.)? Pretty much every major editor has an AHK-specific extension for highlighting per its syntax as well as many other language-specific features.scriptor2016 wrote: ↑ Good old regular Notepad is just regular black text, so nothing there either.
…
*Edit - Looks like Notepad++ may not actually change the text color by itself; it sort of adds a background color to it (looks the same as when regular text is highlighted, and it allows you to select the color of that highlighting)... but it doesn't change the color of the text.
Notepad++ does indeed let you change the color of the text itself, btw. That’s what the AHK extensions for Notepad++ found here make use of when they implement syntax highlighting.
Re: Need Advice on Finding My Missing { bracket
That's incredible.
v1: biga.ahk | array.ahk | string-similarity | graphicsearch.ahk | midday.ahk | expect.ahk