Uploaded image for project: 'Spring Tool Suite'
  1. Spring Tool Suite
  2. STS-3946

'static mapping' code block breaks syntax highlighting and content assist



    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 3.5.1.RELEASE
    • None
    • None
    • Windows 7 x64


      When you add a 'static mapping' code block to a grails domain class, the content assist and syntax highlighting does not work anymore for this domain class. This does not only affect the .groovy domain class file but also the rest of the workspace.

      Steps to reproduce:

      • create a new project with two domain classes `Test1` and `Test2` being in the same package.
      • Add the following code:

      package org.test

      class Test1 {
      Test2 someOtherObject
      String someProperty

      static constraints = {
      def doSomethingWithSomeProperty()

      { someOtherObject.someMethod.replaceAll(/hello/, '$1 friend') someProperty }


      package org.test

      class Test2 {

      static constraints = {
      String getSomeMethod()

      { return 'hello' }


      Everything should work fine so far. In Test1 someProperty and someMethod are highlighted in blue, as they are both either a property or an implicitly called get method.

      Now, if you add an empty `static mapping` code block to `Test2`, the syntax highlighting of `someMethod` call in `Test1` will switch from blue to black-italic. Also, content assist does not work anymore; the replaceAll is underlined because `someMethod` is not actually recognized.

      This already restricts usability, but if you add another `static mapping` code block to `Test1`, the method of `Test` will not even be recognized anymore.

      I've set the priority to major because this is slowing down all working processes significantly, although it may seem trivial at the first glance. Typos happen more frequently if you do not have the content assist telling you about it. If this is not a major bug, just set it to minor.




            Unassigned Unassigned
            nst1nctz Felix Jian
            0 Vote for this issue
            4 Start watching this issue