mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 15:05:39 +01:00
Merge branch 'master' of https://github.com/microsoft/monaco-typescript into let_ts_resolve_libs
This commit is contained in:
commit
7b2cebe6a7
1 changed files with 18 additions and 1 deletions
|
|
@ -10,6 +10,9 @@
|
||||||
<h2>Monaco Editor TypeScript test page</h2>
|
<h2>Monaco Editor TypeScript test page</h2>
|
||||||
<button id="resetBtn">Reset Sample</button>
|
<button id="resetBtn">Reset Sample</button>
|
||||||
<div id="container" style="width:800px;height:600px;border:1px solid grey"></div>
|
<div id="container" style="width:800px;height:600px;border:1px solid grey"></div>
|
||||||
|
<h3>Compiler settings</h3>
|
||||||
|
<textarea style="font-family: monospace;" id="compilerOpts" cols="60" rows="30"></textarea><br/>
|
||||||
|
<button id="updateCompilerSettingsBtn">Update compiler settings</button>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var paths = {
|
var paths = {
|
||||||
|
|
@ -162,6 +165,10 @@
|
||||||
'var game = new Conway.GameOfLife();',
|
'var game = new Conway.GameOfLife();',
|
||||||
].join('\n');
|
].join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDefaultComplierOpts() {
|
||||||
|
return { target: 99, jsx: 1, allowNonTsExtensions: true }
|
||||||
|
}
|
||||||
require([
|
require([
|
||||||
'vs/basic-languages/monaco.contribution',
|
'vs/basic-languages/monaco.contribution',
|
||||||
'vs/language/typescript/monaco.contribution'
|
'vs/language/typescript/monaco.contribution'
|
||||||
|
|
@ -181,8 +188,18 @@
|
||||||
document.getElementById('resetBtn').onclick = () => {
|
document.getElementById('resetBtn').onclick = () => {
|
||||||
editor.setValue(getDefaultCode());
|
editor.setValue(getDefaultCode());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const optsString = localStorage.getItem("compiler-opts") || JSON.stringify(getDefaultComplierOpts(), null, 4)
|
||||||
|
document.getElementById("compilerOpts").textContent = optsString
|
||||||
|
monaco.languages.typescript.typescriptDefaults.setCompilerOptions(JSON.parse(optsString))
|
||||||
|
|
||||||
|
document.getElementById('updateCompilerSettingsBtn').onclick = () => {
|
||||||
|
const newOpts = document.getElementById('compilerOpts').value
|
||||||
|
monaco.languages.typescript.typescriptDefaults.setCompilerOptions(JSON.parse(newOpts))
|
||||||
|
localStorage.setItem("compiler-opts", newOpts)
|
||||||
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue