Skip to content

Using showSimpleSuggestions for dynamic suggestions #3629

Answered by moranje
moranje asked this question in Q&A
Discussion options

You must be logged in to vote

Not entirely sure why it didn't work back then but I have recently revisited this and it works now. It seems top be missing the provideCompletionItems, but I haven't checked if this was there 4 years ago.

{
    provideCompletionItems: (model: monaco.editor.ITextModel) => {

      if (!choice || choice.options.length === 0) {
        return undefined;
      }

      const word = model.getValueInRange(choice.range());
      const isAnyOfOptions = Boolean(
        choice.options.find((option) => option === word)
      );
      const suggestions: monaco.languages.CompletionItem[] = [];
      for (let i = 0; i < choice.options.length; i++) {
        let option = choice.options[i];

        sug…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by moranje
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
help wanted Issues identified as good community contribution opportunities suggest question
1 participant
Converted from issue

This discussion was converted from issue #1459 on March 03, 2023 13:23.