eclipse - Xtext DSL 插件只为文件的第一行提供关键字建议
问题描述
我一直在使用 Xtext 开发 DSL 作为 Eclipse 插件,到目前为止,我能够达到运行时 Eclipse 应用程序在按下 Ctrl+空格时提供建议列表的地步。但是,建议仅针对文件的第一行显示。之后,无论我按了多少次 Ctrl+空格,建议都不会出现。下面是我的 Xtext 语法:
Domainmodel:
(elements+=MainElement)
;
MainElement:
ProjectionName | ProjectionComponent | LayerSpecification |
Description | Capability | Category | ServiceGroup |
IncludeFragment | {MainElement} Override | {MainElement} Overtake
;
ProjectionName:
'projection' modelName=ID ';'
;
ProjectionComponent:
'component' componentName=ID ';'
;
LayerSpecification:
'layer' layerName=ID ';'
;
Description:
'description' string=STRING ';'
;
Capability:
'capability' type=('Online' | 'Offline') ';'
;
Category:
'category' type=('Integration' | 'ExternalB2B' | 'Users') ';'
;
ServiceGroup:
'servicegroup' type=('Mobility' | 'Reporting') ';'
;
IncludeFragment:
('@Dynamic_Component_Dependency' componentName=ID) 'include' 'fragment' fragmentToIncludeName=ID ';'
;
Override:
'@Override'
;
Overtake:
'@Overtake'
;
我还尝试了另一个没有此问题的更简单的示例(如下所述):-
Domainmodel: (elements+=MainElement)* ;
MainElement: FileName | Type ;
Type: Component | Layer | Description | Category | Entity | Comment ;
FileName: 'projection' name=ID ';' ;
Component: 'component' name=ID ';' ;
Layer: 'layer' name=ID ';' ;
Description: 'description' string=STRING ';' ;
List: Users | Developers ;
Users: 'Users' ;
Developers: 'Developers' ;
Category: 'category' lists=List ';' ;
Entity: 'entityset' name=ID 'for' name2=ID ';' ;
Comment: '----------' comment=ID '----------' ;
谁能帮助我理解为什么提到的问题发生在第一个代码而不是第二个代码上?
谢谢你!
解决方案
您的第二个语法在规则中使用零对多基数,Domainmodel: (elements+=MainElement)* ;
而您的第一个语法似乎缺少*
sign Domainmodel: (elements+=MainElement);
。
修复那个Domainmodel: (elements+=MainElement)*;
会有所帮助。
推荐阅读
- flutter - 一个接一个地运行相同的颤振测试。1成功1失败
- c# - Mac 上不存在指定的 deps.json
- android - 使用协程时无法捕获网络错误,但可以在 RxJava 2 中捕获该错误。我错过了什么?
- javascript - 使用弹出窗口内的表单编辑 DataTables 源数据
- linux - 如何将 colab 我的云端硬盘文件夹重命名为其他名称?
- javascript - How can I programmatically trigger ripple effect on a Vuetify.js component?
- javascript - jQuery animate API 多次触发
- java - 我无法连接到本地主机(Openserver、JDBC、MySQL)
- python - 获取 AttributeError:“TestRoutes”对象没有属性“app”
- java - 无法使用 Tomcat9 访问本地主机