I am trying to provide intellisense / code completion into a javascript editor using the Monaco editor. The code needs to be valid javascript, not typescript.
Given some
Put this in the editor in the Monaco Playground:
monaco.editor.create(document.getElementById("container"), {
value: "function hello() {\n\talert('Hello world!');\n}",
language: "typescript"
});
const fact = `declare function onMyEvent(event: string): void;
`;
const factFilename = 'myCustomNamespace1';
this.monaco.languages.typescript.typescriptDefaults.addExtraLib(fact, factFilename);
Now when you type onMyEvent
in the right-hand pane, you'll get