[英]Groovy Grails Tool Suite: `static mapping` code block breaks syntax highlighting and content assist
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. 将
static mapping
代码块添加到grails域类时,内容辅助和语法突出显示对该域类不再起作用。 This does not only affect the .groovy domain class file but also the rest of the workspace. 这不仅影响.groovy域类文件,而且还影响工作区的其余部分。
Steps to reproduce: 重现步骤:
Test1
and Test2
being in the same package. Test1
和Test2
位于同一包中。 Test1.groovy 测试1.groovy
package org.test
class Test1 {
Test2 someOtherObject
String someProperty
def doSomethingWithSomeProperty(){
someOtherObject.someMethod.replaceAll(/hello/, '$1 friend')
someProperty
}
}
Test1.groovy 测试1.groovy
package org.test
class Test2 {
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. 在
Test1
someProperty和someMethod用蓝色突出显示,因为它们都是属性或隐式调用的get方法。
Now, if you add a static mapping
code block to Test2
, the syntax highlighting of someMethod
call in Test1
will switch from blue to black-italic. 现在,如果将
static mapping
代码块添加到Test2
,则Test1
中someMethod
调用的语法突出显示将从蓝色变为黑色斜体。 Also, content assist does not work anymore; 同样,内容辅助功能不再起作用。 the replaceAll is underlined because
someMethod
is not actually recognized. 带下划线的replaceAll是因为实际上无法识别
someMethod
。
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. 这已经限制了可用性,但是如果您向
Test1
添加另一个static mapping
代码块,则将不再能够识别Test
方法。 As soon as you remove the block, everything works fine again. 删除该块后,一切都会再次正常运行。
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. 我将优先级设置为“ major”,因为这乍看之下似乎微不足道,但是这会显着降低所有工作流程的速度。 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.
如果这不是主要错误,则将其设置为次要。
I already filed an issue for that , but if anybody knows a workaround, please let me know. 我已经为此提交了一个问题 ,但是如果有人知道解决方法,请告诉我。
EDIT: Sorry, I forgot to add version and operating environment information: 编辑:对不起,我忘了添加版本和操作环境信息:
OS: Windows 7 x64 操作系统:Windows 7 x64
IDE: GGTS 3.5.1 IDE:GGTS 3.5.1
Grails: 2.4.x Grails:2.4.x
EDIT 2: Not reproducible with grails 1.3.7. 编辑2:无法与grails 1.3.7。
It sounds like you're having problems with the groovy eclipse plugin. 听起来您在使用groovy eclipse插件时遇到问题。 You might be better off submitting a bug here instead: http://jira.codehaus.org/browse/GRECLIPSE
您最好改为在此处提交错误: http : //jira.codehaus.org/browse/GRECLIPSE
GGTS is just eclipse with Spring and Groovy plugins already installed. GGTS只是已经安装了Spring和Groovy插件的日食。
You could try updating to the latest developer snapshot to see if that fixes the problem. 您可以尝试更新到最新的开发人员快照,以查看是否可以解决问题。 Just use the update site for the version of eclipse you're using.
只需使用您正在使用的Eclipse版本的更新站点即可。
http://groovy.codehaus.org/Eclipse+Plugin#EclipsePlugin-DevelopmentSnapshotBuilds http://groovy.codehaus.org/Eclipse+Plugin#EclipsePlugin-DevelopmentSnapshotBuilds
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.