Open cdietrich opened 10 months ago
i will check
i wonder if we can have access to both the current and following token.
thus we can decide if we need a space between two alphanumeric things or not.
or should this be done in completionFor
?
this is also hard to achieve. backtrackToAnyToken wont give a whitespace token
something like
protected override async completionFor(context: CompletionContext, next: NextFeature<GrammarAST.AbstractElement>, acceptor: CompletionAcceptor): Promise<void> {
const { nextTokenStart, previousTokenStart, previousTokenEnd } = this.backtrackToAnyToken(context.textDocument.getText(), context.tokenEndOffset)
if (previousTokenEnd === nextTokenStart) {
const x = context.textDocument.getText().slice(previousTokenStart, previousTokenEnd)
if (HelloWorldCompletionProvider.AllKeywords.has(x)) {
if (GrammarAST.isKeyword(next.feature)) {
const kw = next.feature.value
if (/^[a-z0-9]+$/i.test(kw.charAt(0))) {
return;
}
} else {
return;
}
}
}
await super.completionFor(context, next, acceptor)
}
seems to work
pot. workaround: adjust keyword completion to add the :
given the grammar
in the the sample model
the
:
keyword is not proposedin the completion provider i allow proposals for previous/next context and for single char keywords