webapp.cucumber.js.petrel.GherkinAutoComplete.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ch.sbb.polarion.extension.cucumber Show documentation
Show all versions of ch.sbb.polarion.extension.cucumber Show documentation
It provides the almost same functionality as Xray plugin for Jira.
The newest version!
import AutoCompletion from './AutoCompletion.js'
export default class GherkinAutoComplete extends AutoCompletion {
autoComplete(word, editor){
const searchWord = word.replaceAll(/\(|{|;/g, "")
const ret = []
if (searchWord == "")
return []
for (const key of GherkinAutoComplete.KEYWORDS) {
if (key.toLowerCase().startsWith(searchWord.toLowerCase()) && searchWord !== key){
ret.push({
text: key,
type: 'KEYWORD',
replace: () => key+" "
})
}
}
return ret
}
}
GherkinAutoComplete.FILE_EXTENSIONS = ["feature"]
GherkinAutoComplete.KEYWORDS = ["Feature", "Rule", "Example", "Scenario", "Given", "When", "Then", "And", "But", "*", "Scenario Outline", "Scenario Template", "Examples"]