Intellij-IDEA中的Geb创作支持吗? [英] Geb authoring support within Intellij-IDEA?

查看:96
本文介绍了Intellij-IDEA中的Geb创作支持吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Geb文档说IDEA通过Groovy插件( http://www.gebish.org/manual/current/ide-and-typing.html#intellij_idea_support ).特别是说: IntelliJ IDEA(从版本12开始)对编写Geb代码具有特殊支持.这是Groovy支持的内置功能.不需要其他安装."但是,我在IDEA 13.x或14中看不到此内容.一切正常运行,但是我的页面中定义的任何内容DSL定义都没有代码完成或提示. DSL参考使用带下划线"的格式显示,该格式用于指示未知/仅动态/仅用于运行时的Groovy元素.由于Geb文档专门说应提供此元素,因此我想弄清楚是否丢失了某些内容?

The Geb documentation says that IDEA supports Geb via the Groovy plugin (http://www.gebish.org/manual/current/ide-and-typing.html#intellij_idea_support). In particular, it says " IntelliJ IDEA (since version 12) has special support for authoring Geb code. This is built in to the Groovy support; no additional installations are required." However, I'm not seeing this in IDEA 13.x or 14. Everything works and runs, but I get no code completion or hinting for any content DSL definitions defined in my Pages. Also, my content DSL references show with the "underlined" formatting used to indicate unknown/dynamic/runtime-only Groovy elements. Since the Geb docs specifically say it should provide this, I'm trying to figure out if I'm missing something?

推荐答案

您只会在内部页面定义/类中或在IntelliJ 知道其类型时获得内容定义提示您的页面.如果您不跟踪页面类型,则不会有内容定义提示,因为IntelliJ无法确定当前页面类型是什么,并且无法提供自动补全功能.

You will only get content definition hinting inside page definitions/classes or when IntelliJ knows the type of your page. There will be no content definition hints if you don't track page types because IntelliJ can't figure out what the current page type is and won't be able to provide autocompletion.

class MyPage extends Page {
    static content {
        links { $("a") }
        fistLink { links.first() } //Intellij will understand what links are here
    }

    int getLinksCount() {
        links.size() // IntelliJ will understand what links are here
    }
}

class MySpec extends GebSpec {
    ...
    to(MyPage)
    myPage.links // Intellij will not understand/autocomplete links here
    ...
    def myPage = to(MyPage)
    myPage.links // Intellij will understand/autocomplete links here
    ...
}

此外,据我所知,这仅适用于Ultimate版本,而不适用于Community Edition.

Also, from what I remember, this only works in the Ultimate and not the Community Edition.

这篇关于Intellij-IDEA中的Geb创作支持吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆