monaco-editor
monaco-editor copied to clipboard
Provide configuration for deleting trigger characters after providing pop-up lists
Context
- [X] This issue is not a bug report. (please use a different template for reporting a bug)
- [X] This issue is not a duplicate of an existing issue. (please use the search to find existing issues)
Description
I hope that after entering @, a dropdown list will pop up for selection. After selection, the @ symbol needs to be removed, similar to: selecting test from the @ dropdown, and ultimately staying in the editor is test instead of @ test
Monaco Editor Playground Link
Monaco Editor Playground Code
const value = /* set from `myEditor.getModel()`: */ `@`;
// Hover on each property to see its docs!
const myEditor = monaco.editor.create(document.getElementById("container"), {
value: "",
language: "sql"
});
monaco.languages.registerCompletionItemProvider('sql', {
triggerCharacters: ['@'],
provideCompletionItems: (model, position) => {
let suggestions = [{label: "test", kind: "test", insertText: "test"}];
return { suggestions };
}
}
);
monaco.languages.registerCompletionItemProvider('sql', {
triggerCharacters: ['@'],
replaceTriggerChar: true, // For example, if this configuration is enabled, @ will be replaced
provideCompletionItems: (model, position) => {
let suggestions = [{label: "test", kind: "test", insertText: "test"}];
return { suggestions };
}
}
);