GRECLIPSE
  1. GRECLIPSE
  2. GRECLIPSE-611

Extra double quote added when it shouldn't

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0.0RC1
    • Fix Version/s: 2.0.1Release
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Copied from GRECLIPSE-493:


      When editing a line to add a string, such as changing

      assert exec.input, USAGE

      to

      assert exec.input, "No input specified" + USAGE

      Adding the first quote results in one quote inserted. Typing the close-quote inserts two quotes (leaving the cursor between them). As long is I remember to hit DEL (and not) BS after typing the close, I can almost ignore this behavior.

      In case it needs to be mentioned, when I type the first quote after the comma, the statement becomes invalid since there is no '+' operator.


      Definitely releated to GRECLIPSE-493, but probably a slightly different cause.

        Activity

        Hide
        Andrew Eisenberg added a comment -

        Looked into this a little bit. The problem is with the BracketInserter class, which is a private inner class in CompilationUnitEditor. This class does not add a second closing " if the previous token is an identifier (ie- a second quote is only added after a paren, comma, semi-colon, etc). So, the following will work as expected:

        assert(<quote_here>)
        

        but the following will not:

        assert <quote_here>
        

        I think the rules for closing quotes in Java and groovy are significantly different that I should copy this code from CompilationUnitEditor and modify it in GroovyEditor. I will look at this post 2.0.

        Show
        Andrew Eisenberg added a comment - Looked into this a little bit. The problem is with the BracketInserter class, which is a private inner class in CompilationUnitEditor. This class does not add a second closing " if the previous token is an identifier (ie- a second quote is only added after a paren, comma, semi-colon, etc). So, the following will work as expected: assert (<quote_here>) but the following will not: assert <quote_here> I think the rules for closing quotes in Java and groovy are significantly different that I should copy this code from CompilationUnitEditor and modify it in GroovyEditor. I will look at this post 2.0.
        Hide
        Andrew Eisenberg added a comment -

        OK. I now have the BracketInserter class copied into the GroovyEditor class. And the behavior is working as expected.

        The next task is to tweak BracketInserter so that it behaves in a more Groovy-like way.

        Show
        Andrew Eisenberg added a comment - OK. I now have the BracketInserter class copied into the GroovyEditor class. And the behavior is working as expected. The next task is to tweak BracketInserter so that it behaves in a more Groovy-like way.
        Hide
        Andrew Eisenberg added a comment -

        Fixed. Now there is a copy of the BracketInserter class inside of GroovyEditor. Multiline strings are handled.

        Show
        Andrew Eisenberg added a comment - Fixed. Now there is a copy of the BracketInserter class inside of GroovyEditor. Multiline strings are handled.

          People

          • Assignee:
            Andrew Eisenberg
            Reporter:
            Andrew Eisenberg
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: