Xtext 中的作用域和导入
我有以下 Xtext 语法:
Model:
'model' name = ID imports += Import* items += Item* rules += Rule*;
Import:
'import' importURI = STRING;
Rule:
'rule' name = ID '(' items += [Item]* ')';
Item:
'item' name = ID;
打开编辑器时,Rule
中的所有 Item
引用如果位于同一文件中,都会正确突出显示,并且我可以跳转到使用 F3 进行声明。但是,如果我尝试从其他文件导入它们,这将不起作用。例如:
文件 first.mydsl
model first
import "second.mydsl"
rule myRule (second)
文件 second.mydsl
model second
item second
假设这两个文件位于同一文件夹中,它仍然无法从导入的文件中找到“第二个”引用。如果我包含导入文件的文件扩展名或完整路径,它也不起作用。 如何让 Xtext 识别导入的文件?
(交叉发布到 http://www.eclipse.org/forums/index .php/m/805182/#msg_805182)
I've got the following Xtext grammar:
Model:
'model' name = ID imports += Import* items += Item* rules += Rule*;
Import:
'import' importURI = STRING;
Rule:
'rule' name = ID '(' items += [Item]* ')';
Item:
'item' name = ID;
When opening the editor, all Item
references in Rule
s are hilighted correctly if they are in the same file, and I can jump to the declaration using F3. However, that doesn't work if I try to import them from other files. For example:
File first.mydsl
model first
import "second.mydsl"
rule myRule (second)
File second.mydsl
model second
item second
Assuming these two files are in the same folder, it still won't find the 'second' reference from the imported file. It also doesn't work if I include the file extension for the imported file, or the full path.
How do I get Xtext to recognize the imported file?
(crossposted to http://www.eclipse.org/forums/index.php/m/805182/#msg_805182)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请确保按如下方式配置您的工作流程
please make sure you configure your workflow as follows