I'm working with the Configure javascript defaults
example from the monaco editor playground.
https://microsoft.github.io/monaco-editor/playground.html#extending-language-services-configure-javascript-defaults
When I start typing the pre-defined class, I get autocompletion, but I need to hit ctl+space one time to see the actual documentation of the suggestions.
Is there a way to set this option by default so that autocompletion will show the docs by default open?
This is the only thing I changed in the code:
monaco.languages.typescript.typescriptDefaults.addExtraLib([
'/**',
' * Know your facts!',
' */',
'declare class Facts {',
' /**',
' * Returns the next fact',
' */',
' static next():string',
'}',
].join('\n'), 'filename/facts.d.ts');
How it opens right now:
How I want it to open by default:
Show activity on this post. var selection = editor. getSelection(); var id = { major: 1, minor: 1 }; var text = "XXX"; var op = {identifier: id, range: selection, text: text, forceMoveMarkers: true}; editor. executeEdits("my-source", [op]);
The Monaco Editor is the code editor that powers VS Code. A good page describing the code editor's features is here. It is licensed under the MIT License and supports Edge, Chrome, Firefox, Safari and Opera. The Monaco editor is not supported in mobile browsers or mobile web frameworks.
Just in case anyone's still wondering: as a workaround you can implement your own storage service which (among other things) will also be used to query the current preference of suggestion expansion.
monaco.editor.create(document.getElementById("container"), {
value: jsCode,
language: "javascript"
}, {
storageService: {
get() {},
getBoolean(key) {
if (key === "expandSuggestionDocs")
return true;
return false;
},
remove() {},
store() {},
onWillSaveState() {},
onDidChangeStorage() {}
}
});
The storage service is also used for things like remembering most recently used suggestions (to personalize IntelliSense) etc., so if you need that functionality you may want to implement the other functions as well. A complete interface with descriptions of what each method should do is IStorageService.
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