How to add cascading content assist in Xtext document

佐手、 提交于 2019-12-11 16:03:33

问题


I want to add cascading content assist while creating an array of pre-defined values. When I'm creating the array, it should first give me the assist to add only '{'. After that it should suggest me the list of pre-defined values and a '}'. If I choose a value, it should suggest me to add a comma, then repeat the above step. It should keep suggesting me these until I add a closing brace.

Currently I'm able to provide content-assist for only one element in the array.

An example of desired behaviour

// defining the allowed values of array
Attribute list_of_codes {
 codes: ["A", "B", "C", "D"]
}

// Using the above values
array {
    elements: *Hits C-space to get '{' in content-assist box*
    elements: { *Hits C-space to get "A", "B", "C", "D", "}" in content-assist box*
    elements: { "A" *Hits C-space to get ',' and '}' in content-assist box*
}
// and so on.

In the end I should get an array that looks like:

array {
    elements: {"A", "C", "D"}
}

How do I achieve this behaviour?

来源:https://stackoverflow.com/questions/56054097/how-to-add-cascading-content-assist-in-xtext-document

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!