Tapatalk

Issue with brace auto-completion (fixed)

Issue with brace auto-completion (fixed)

2
NewbieNewbie
2

    Feb 25, 2017#1

    I have a new problem since last update. When I type in PHP file if ( $a = $b) { all worked well.

    However, now I type and get the right closing bracket as I expect it. But depending on what I type in the middle and then type the closing bracket, UE adds another one.

    if () => if ($a == $row["col"]))

    A simple if ($a == $b) works out properly without extra brackets.

    Any ideas why?

    6,685587
    Grand MasterGrand Master
    6,685587

      Mar 26, 2017#2

      First, I have not really understood what is your problem. But today I have looked on your problem once again and I think, I have gotten it now with comparing the behavior on entering this condition in a PHP file key by key.

      So I try to explain what was changed regarding brace auto-completion and what are the differences between UES v16.10 and v16.20.

      Brace auto-completion was introduced with UltraEdit for Windows v23.20 which was available before just in UEStudio using IntelliTips feature of UEStudio.

      That's why the following settings were removed from Advanced - Settings or Configuration - IDE - IntelliTips - Miscellaneous in UEStudio v16.20:
      • Insert ")]" automatically after "[("
      • Insert "}" automatically after "{"
      • Smart placement of "}" when inserted automatically
      Brace auto-completion can be configured since UES v16.20 at Advanced - Settings or Configuration - Editor - Braces / strings like in UltraEdit v23.20 and later versions.

      Also the configuration settings Enable auto-brace matching and Brace match in comments moved from Editor Display - Brace Matching to Editor - Braces / strings.

      Brace auto-completion and auto-brace matching are by default enabled in configuration.


      How both features work in UE v23.20+ and UES v16.20+?

      I use | as indicator for blinking caret and format matching braces with blue color. The list below is what is shown on pressing a key on keyboard.

      i|
      if|
      if |
      if |
      if (|)

      It can be seen that on pressing key for inserting opening parenthesis UE/UES insert with enabled brace auto-completion automatically also closing parenthesis and position the caret between the parentheses. Further it can be seen with enabled auto-brace matching that the two matching round brackets are displayed with a different foreground and background color.

      if ($|)
      if ($a|)
      if ($a |)
      if ($a =|)
      if ($a ==|)
      if ($a == |)
      if ($a == $|)
      if ($a == $r|)
      if ($a == $ro|)
      if ($a == $row|)
      if ($a == $row[|])

      It can be seen that on pressing key for inserting opening square bracket UE/UES insert with enabled brace auto-completion automatically also closing square bracket and position the caret between the square brackets. Further it can be seen with enabled auto-brace matching that the two matching square brackets are displayed with a different foreground and background color instead of the round brackets.

      if ($a == $row["|])

      A string starts here now. In a new *.php file not containing anything else UE/UES can't find a matching double quote and therefore interprets everything up to end of file (closing parenthesis) as string which results in no highlighting anymore of matching braces.

      Interesting: The configuration setting Enable string auto-completion is enabled, but no second double quote is inserted here. That is most likely a bug which I have reported after having finished writing this post.

      String auto-completion works in comments and in plain text as well as in PHP file when caret is not within matching braces, but does not work here in this use case with caret being between the matching square brackets (or within matching round brackets).

      if ($a == $row["c|])
      if ($a == $row["co|])
      if ($a == $row["col|])
      if ($a == $row["col"|])

      A string terminating double quote is present now in the file which results in auto-brace matching becomes active again and highlights the two matching square brackets.

      The next key press should be key END because the condition is already completely entered.

      But let us assume typing is nevertheless continued with pressing key for closing square bracket.

      if ($a == $row["col"]|)

      UE/UES recognized that the matching square bracket is already present and therefore did not insert another square bracket.

      But auto-brace matching still highlights the square brackets although caret is already after the square brackets.

      So whatever is typed next, it is inserted between closing square bracket and closing round bracket. Therefore pressing now key for closing parenthesis results in inserting one more ) which of course is not wanted. It would be required to press key RIGHT ARROW to move caret after already present closing round bracket.


      How both features work in UES v16.10 and former versions?

      For a comparison the same keys are pressed to enter the same condition with using IntelliTips feature for auto-brace matching.

      i|
      if|
      if |
      if |
      if (|)
      if ($|)
      if ($a|)
      if ($a |)
      if ($a =|)
      if ($a ==|)
      if ($a == |)
      if ($a == $|)
      if ($a == $r|)
      if ($a == $ro|)
      if ($a == $row|)

      No difference up to now in comparison to UES v16.20.

      if ($a == $row[|])

      It can be seen here that auto-brace matching worked different in UES v16.10 in comparison to v16.20. After inserting both square brackets and placing the caret between, the round brackets are still highlighted and not the square brackets.

      if ($a == $row["|"])

      After pressing the key for inserting a double quote one more double quote is inserted automatically by UEStudio and caret is placed between. The auto-brace matching feature highlights now the square brackets.

      if ($a == $row["c|"])
      if ($a == $row["co|"])
      if ($a == $row["col|"])

      The next key press should be key END because the condition is already completely entered.

      But let us assume typing is nevertheless continued with pressing key for double quote, closing square bracket, closing parenthesis.

      if ($a == $row["col"|])
      if ($a == $row["col"]|)
      if ($a == $row["col"])|


      Conclusion:

      The IntelliTips based brace auto-completion of UES v16.10 and former versions was indeed better than the general brace auto-completion introduced with UE v23.20 and superseding in UES v16.20 the IntelliTips based brace auto-completion.

      My suggestion for the moment until a new version of UE and UES with an improved brace auto-completion is released:

      Uncheck setting Enable brace auto-completion at Advanced - Settings or Configuration - Editor - Braces / strings when not really making use of it because of typing closing brackets already present in the file because of enabled brace auto-completion.
      Best regards from an UC/UE/UES for Windows user from Austria

      79
      Advanced UserAdvanced User
      79

        Apr 25, 2017#3

        Just as an FYI to anyone else who comes across this problem - it's still in v17.00.0.15 and has been reported to IDM. However, I encourage anyone who's running into it to also report it. I was hoping that his would be fixed in 17.0 but made the mistake of never reporting it myself, assuming that it was a known issue. Either I was wrong about that or it was known but not considered a high enough priority - I think multiple reports will help get a fix faster.

        I'll probably roll back to 16.10 until it gets fixed.

        6,685587
        Grand MasterGrand Master
        6,685587

          Apr 26, 2017#4

          The string auto-completion issue as described by me was also reported by me to IDM support by email and is fixed in UEStudio v17.00.0.15 and UltraEdit v24.00.0.73.

          The other issue with typing the closing parenthesis after typing closing square bracket resulting in inserting the closing parenthesis although ] and ) are both existing already in file because of brace auto-completion was not reported by me. I was too busy in the last weeks to write this report, too. And I thought the users who want to insert the closing braces by key should better disable the brace auto-completion.

          Update: The brace auto-completion issue on typing ] and next ) although both inserted already in file by brace auto-completion feature was fixed with UE v24.10 and UES v17.10.
          Best regards from an UC/UE/UES for Windows user from Austria