gpt4 book ai didi

grails - GSP页面中针对模型对象的Groovy/Grails工具套件(GGTS)代码辅助

转载 作者:行者123 更新时间:2023-12-02 14:53:34 27 4
gpt4 key购买 nike

我是Grails的新手,现在还在学习。

我对该模型有以下代码:

class Book {

static constraints = {

}

String title
String author
}

和 Controller :
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. }时,我没有得到代码助手的任何建议。键入点后按Ctrl +空格键无济于事。

但是,在 ${ }中按Ctrl + space可以起作用,并且可以正确地将 model识别为 Book对象。

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

最佳答案

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

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

找到了问题并提出了解决方案。在下一个快照版本中将可用。

关于grails - GSP页面中针对模型对象的Groovy/Grails工具套件(GGTS)代码辅助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16166078/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com