Menu

#25 brace detection/highlight

closed
nobody
None
5
2007-10-24
2007-04-21
No

one key element for success of making stable code, is to narrow down those things that make buggy code - one reason that code doesn't work is mostly unclosed brackets

i know that codepress supports autoclose brackets... but for functions'... math that is, you sometimes sit with a lot of brackets/braces without know odds from ends

to make it short, i'd like to see brace detection...

one easy way to do it, is to count opening and closing brackets

pseudo:

if( curr_letter.match(/(\[)|(\{)|(\()/i)
count_forwards(curr_letter)
elseif( curr_letter.match(/(\])|(\})|(\))/i)
count_backwards(curr_letter)
else
do_nothing()

func count_forwards(letter){
cnt = 1
indx = 0
while( cnt ){
indx++
if( next_char == letter )
cnt++
if( next_char == opposid(letter) )
cnt--
}
return indx // or set style on closing tag
}

Discussion

  • Adam Jimenez

    Adam Jimenez - 2007-09-29

    Logged In: YES
    user_id=1871003
    Originator: NO

    would be very neat

    in dreamweaver you press ctrl + # and it highlights all the code in the current braces. press it again and it highlights the next outer set etc.

     
  • Martin Daniel Kirk

    Logged In: YES
    user_id=577658
    Originator: YES

    Balanced Braces in Dreamweaver is useless compared to Notepad++/VisualStudio Brace highlighting

    in DW u need to press a set of keys to see the brace length... in VS + NP++ they are shown automatically.. however in VS/NP++ only the braces are highlighted, making it easier to locate anny error

    in Vb.NET the engine indents the code for u - also helping alot to locate missing "End ..."'s

     
  • pyrou

    pyrou - 2007-10-24
    • status: open --> closed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.