自动完成播放2.0视图路径在Eclipse中的Scala控制器 [英] Autocomplete for Play 2.0 views paths in Scala controllers in Eclipse
问题描述
这是Google小组讨论的视觉参考: https://groups.google.com/group/play-framework/browse_thread/thread/14660fd7056d577e/a3afb4ca06d25ce5#a3afb4ca06d25ce5
This is a visual reference to the google group discussion: https://groups.google.com/group/play-framework/browse_thread/thread/14660fd7056d577e/a3afb4ca06d25ce5#a3afb4ca06d25ce5
所以, m只是试图添加一些冗长的观点:
So, I'm simply trying to add some verbosity to views:
当我引用这两个文件,或尝试在Scala控制器中,根据Google Group提供的示例,我得到一个错误:
When I reference either of the files, or try to, in the Scala controller, based on the example provided in the Google Group, I get an error:
什么给了?
推荐答案
免责声明:没有一个Eclipse用户,刚刚创建并导入了空白的Play项目来检查这个问题!我没有时间测试Eclipse配置,只是在Play的文档中导入。也许这是更好的配置的一些方法,但你需要自己搜索:)
Disclaimer: I'm not a Eclipse user, just created and imported blank Play's project to check this issue! I had no time to test Eclipse configs, just imported as descriped at Play's docs. Maybe it is some way to better configuration, but you need search for it yourself :)
我不会怪怪玩,它的工作正常,否则它根本不会编译。正如我在Google Group的主题中所写,您需要将视图放在包中: /views/nested/index.scala.html
(当然嵌套
只是一个名字,它可以是其他任何东西),那么你可以抓住它: Ok(views.html。
nested.index()
)
I wouldn't blame Play, it does its job properly, otherwise it wouldn't compile at all. As I wrote in Google Group's topic you need to place your view in package: /views/nested/index.scala.html
(of course nested
is just a some name it can be whatever else), then you can catch it with: Ok(views.html.
nested.index()
)
:
- 在
包资源管理器
点击视图
包含:鼠标右键
>新
>包
并且编写包的名称views.nested
或views.one
或其他东西,即使可以是: code> views.nested.one.two.three - 将新视图添加到此包
myNewView.scala.html
- 在浏览器中运行任何请求(让Play编译新视图),可选择您可以使用命令
play〜run
所以它将在保存到IDE之后立即编译新的或改变的视图。 - 在Eclipse菜单中se
项目
>清洁...
。事实上,这是线索,我不太清楚为什么要清理这些,因为Play会正确地编辑一切,一开始就阅读免责声明。 - 从现在开始,Eclipse将会看到这个新视图
- in
Package Explorer
clickviews
package with:right mouse button
>New
>Package
and write package's nameviews.nested
orviews.one
or something else, even it could be:views.nested.one.two.three
- Add new view into this package
myNewView.scala.html
- Run any request in browser (to let the Play compile new views), optionally you can run Play with command
play ~run
so it will compile your new or changed views right after saving in IDE. - in Eclipse menu choose
Project
>Clean...
. De facto, that's the clue, I'm not quite sure why this cleaning is required as Play compiles everything properly, read the disclaimer at the beginning. - From now your Eclipse will see this new view(s)
屏幕截图
这篇关于自动完成播放2.0视图路径在Eclipse中的Scala控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!