Microsoft/monaco-editor

Invalid completion items when using dots in completion item label

Open

#2.136 aberto em 17 de set. de 2020

Ver no GitHub
 (3 comments) (0 reactions) (0 assignees)JavaScript (1.283 forks)batch import
bughelp wantedsuggesttypescript

Métricas do repositório

Stars
 (14.836 stars)
Métricas de merge de PR
 (Mesclagem média 6h 26m) (15 fundiu PRs em 30d)

Description

monaco-editor version: 0.20.0 Browser: Chrome OS: Windows Playground code that reproduces the issue:

function getSuggestions(range) {
    return [
        {
            label: 'parameters.In1',
            kind: monaco.languages.CompletionItemKind.Field,
            insertText: 'parameters.In1',
            insertTextRules: null,
            range: range
        }
    ];
}


monaco.languages.registerCompletionItemProvider('javascript', {
    provideCompletionItems: function(model, position) {
        return {
            suggestions: getSuggestions(null)
        };
    }
});

monaco.editor.create(document.getElementById("container"), {
    language: "javascript"
});

I was only able to reproduce this when registering a completion item provider which return completion items with dots in the label/insertText.

Repro steps:

  1. Execute the code above
  2. Type param and choose the option parameters.In1
  3. Type again type Result: The completion menu shows an option "parameters" which was not returned by my provider neither exists in the Javascript language.

See the gif below: issue-autocomplete2

Guia do colaborador