GRECLIPSE
  1. GRECLIPSE
  2. GRECLIPSE-871

main() method added by New Wizard vs added by content assist

    Details

    • Number of attachments :
      0

      Description

      I am using STS 2.3.2.RELEASE and trying out its groovy support.

      I noticed that if I use New Wizard to create a groovy class with a main method(), it comes as

      static main(args) {
      
      }
      

      But if I create a class with a main() initially and later use content-assist (ctrl-space), then it gets added as

      public static void main(String[] args) {
      	
      }
      

      Little inconsistency, but can it be resolved?

        Issue Links

          Activity

          Hide
          Andrew Eisenberg added a comment -

          Unfortunately, this is a little bit more difficult to resolve than you would think. The code assist templates that you see come from Java and invoking them in the groovy editor adds the Java code.

          The solution here would be to remove the Java templates and replace them with Groovy equivalents.

          Show
          Andrew Eisenberg added a comment - Unfortunately, this is a little bit more difficult to resolve than you would think. The code assist templates that you see come from Java and invoking them in the groovy editor adds the Java code. The solution here would be to remove the Java templates and replace them with Groovy equivalents.
          Hide
          Andrew Eisenberg added a comment -

          See GRECLIPSE-872, which more precisely describes the problem.

          Show
          Andrew Eisenberg added a comment - See GRECLIPSE-872 , which more precisely describes the problem.
          Hide
          Roshan Dawrani added a comment -

          I don't think I understand the suggestion. If I go to Preferences -> Groovy -> Editor, there are no templates there.

          I see templates only under Preferences -> Java -> Editor, if I replace them there with groovy equivalents, then they are not useful for java files anymore.

          Or, am I missing seeing the templates defined for groovy?

          Show
          Roshan Dawrani added a comment - I don't think I understand the suggestion. If I go to Preferences -> Groovy -> Editor, there are no templates there. I see templates only under Preferences -> Java -> Editor, if I replace them there with groovy equivalents, then they are not useful for java files anymore. Or, am I missing seeing the templates defined for groovy?
          Hide
          Andrew Eisenberg added a comment -

          I should have been a bit more clear. There is nothing that you can do right now. The suggestion to replace the templates in the context of the Groovy editor is an idea for how we can implement your proposal, but it is not possible for end users to do this. (Unless of course you want to send us a patch!)

          Show
          Andrew Eisenberg added a comment - I should have been a bit more clear. There is nothing that you can do right now. The suggestion to replace the templates in the context of the Groovy editor is an idea for how we can implement your proposal, but it is not possible for end users to do this. (Unless of course you want to send us a patch!)
          Hide
          Andrew Eisenberg added a comment -

          Fix is described in GRECLIPSE-872. Go to Preferences -> Groovy -> Editor -> Templates and you can now configure templates.

          Show
          Andrew Eisenberg added a comment - Fix is described in GRECLIPSE-872 . Go to Preferences -> Groovy -> Editor -> Templates and you can now configure templates.

            People

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

              Dates

              • Created:
                Updated:
                Resolved: