I use online Monaco editor sample Configures two JSON schemas, with references
While it works fine, in order to receive an intellisense I have to press Ctrl+Space
(i.e. it doesn't appear automatically):
However, in VSCode (which uses Monaco), it appears instantly as soon as I type the first quotation mark:
How should I change Monaco's code sample to behave exactly as in VSCode?
Currently, I managed to work around it by using below code:
this.editor.onKeyUp((e) => {
const position = this.editor.getPosition();
const text = this.editor.getModel().getLineContent(position.lineNumber).trim();
if (e.keyCode === monaco.KeyCode.Enter && !text) {
this.editor.trigger('', 'editor.action.triggerSuggest', '');
}
});
We detect the "Enter" keypress and check if we are at a new line. If yes, trigger suggestions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With