1

我是 Grails 的新手,仍在学习。

我有以下模型代码:

class Book {

    static constraints = {

    }

    String title
    String author
}

和控制器:

class KillController {

    def index() { render "kill world"  }

    def view() {
        def book = new Book( author: "Mike", title: "nuff sed")
        [ model: book ]
    }
}

对于view.gsp,我有以下内容:

<html>
    <body>
        Author: ${ model.author }<br />
        Title : ${ model.title }
    </body>
</html>

一切正常,并且产生了正确的输出。但是,在 GSP 编辑器中,当我输入 时${ model. },我没有从 code-assist 获得任何建议。键入点后按 ctrl+space 无济于事。

不过,在里面按 Ctrl+space 可以${ }工作,它可以正确识别model为一个Book对象。

GSP 编辑器中尚不支持模型的代码辅助吗?谢谢!:D

4

1 回答 1

0

这是一个错误。它应该可以工作,并且在许多其他情况下也可以。当我尝试它时,我确实看到正在引发异常:

org.eclipse.core.runtime.OperationCanceledException
at org.codehaus.groovy.eclipse.codeassist.processors.GroovyProposalTypeSearchRequestor.checkCancel(GroovyProposalTypeSearchRequestor.java:356)
at org.codehaus.groovy.eclipse.codeassist.processors.GroovyProposalTypeSearchRequestor.processAcceptedPackages(GroovyProposalTypeSearchRequestor.java:618)
at org.codehaus.groovy.eclipse.codeassist.processors.PackageCompletionProcessor.generateProposals(PackageCompletionProcessor.java:56)
at org.codehaus.groovy.eclipse.codeassist.requestor.GroovyCompletionProposalComputer.computeCompletionProposals(GroovyCompletionProposalComputer.java:162)
at org.grails.ide.eclipse.editor.gsp.adapter.CodeCompletionDelegate.codeComplete(CodeCompletionDelegate.java:71)
at org.codehaus.jdt.groovy.model.GroovyCompilationUnit.codeComplete(GroovyCompilationUnit.java:598)
at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete(CompilationUnit.java:359)
at org.eclipse.jst.jsp.ui.internal.contentassist.JSPJavaCompletionProposalComputer.computeJavaCompletionProposals(JSPJavaCompletionProposalComputer.java:237)
at org.eclipse.jst.jsp.ui.internal.contentassist.JSPJavaCompletionProposalComputer.computeCompletionProposals(JSPJavaCompletionProposalComputer.java:114)
at org.eclipse.wst.sse.ui.internal.contentassist.CompletionProposalComputerDescriptor.computeCompletionProposals(CompletionProposalComputerDescriptor.java:284)
at org.eclipse.wst.sse.ui.internal.contentassist.CompletionProposalCategory.computeCompletionProposals(CompletionProposalCategory.java:290)
at org.eclipse.wst.sse.ui.contentassist.StructuredContentAssistProcessor.collectProposals(StructuredContentAssistProcessor.java:475)
at org.eclipse.wst.sse.ui.contentassist.StructuredContentAssistProcessor.computeCompletionProposals(StructuredContentAssistProcessor.java:254)
at org.eclipse.wst.sse.ui.internal.contentassist.CompoundContentAssistProcessor.computeCompletionProposals(CompoundContentAssistProcessor.java:127)
at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:1839)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:566)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$16(CompletionProposalPopup.java:563)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run(CompletionProposalPopup.java:498)
...

我得看看这里发生了什么。


更新:

提出了这个问题:https ://issuetracker.springsource.com/browse/STS-3337

发现问题并推送修复。将在下一个快照版本中可用。

于 2013-04-23T17:22:35.137 回答