Fixed a few bugs with monaco language setting

This commit is contained in:
inaseem 2021-10-04 17:33:01 +05:30
parent 21e5b8c353
commit 082b9000ab
2 changed files with 4 additions and 9 deletions

View File

@ -21,7 +21,7 @@ const Layouts = (props) => {
? { display: "flex", flexDirection: "row", alignItems: "stretch" } ? { display: "flex", flexDirection: "row", alignItems: "stretch" }
: {}), : {}),
}} }}
onDragEnd={() => EventEmitter.dispatch("resize")} onDrag={() => EventEmitter.dispatch("resize")}
> >
{children} {children}
</Split> </Split>

View File

@ -323,11 +323,6 @@ const CodeRunner = (props) => {
showValue(); showValue();
}, },
}); });
editor.getModel().setValue(config.template + "\n");
monaco.editor.setModelLanguage(
editor.getModel(),
config.monacoLang || "plaintext"
);
// Below code is just for adding an empty line in editor // Below code is just for adding an empty line in editor
monaco.languages.registerCodeLensProvider( monaco.languages.registerCodeLensProvider(
config.monacoLang || "plaintext", config.monacoLang || "plaintext",
@ -532,8 +527,8 @@ const CodeRunner = (props) => {
<MonacoEditor <MonacoEditor
wrapperClassName={"rijuEditor"} wrapperClassName={"rijuEditor"}
onChange={handleChange} onChange={handleChange}
defaultLanguage="javascript" language={config.monacoLang || "plaintext"}
defaultValue="// some comment" value={config.template + "\n"}
options={{ options={{
minimap: { enabled: splitType == "horizontal" ? false : true }, minimap: { enabled: splitType == "horizontal" ? false : true },
scrollbar: { verticalScrollbarSize: 0 }, scrollbar: { verticalScrollbarSize: 0 },
@ -568,7 +563,7 @@ CodeRunner.getInitialProps = async (ctx) => {
// let lsp = langs.javascript; // let lsp = langs.javascript;
// if (query.lang) lsp = langs[query.lang]; // if (query.lang) lsp = langs[query.lang];
// return { // return {
// props: { lsp }, // will be passed to the page component as props // props: { langConfig: lsp }, // will be passed to the page component as props
// }; // };
// } // }