python、shell、cmd根据本机环境动态代码提示

This commit is contained in:
fofolee
2020-06-24 12:40:52 +08:00
parent 0842f667ec
commit 1d7e26ba28
2 changed files with 70 additions and 41 deletions

View File

@@ -495,24 +495,33 @@ let hasCustomIcon = () => {
let programCheck = () => {
let mode = $('#program').val();
$('.customscript').hide();
$('.simulation').hide();
$('#showInTerm').prop("disabled", false);
if (!hasCustomIcon()) $("#icon").attr('src', `logo/${mode}.png`);
switch (mode) {
case 'custom':
$('.customscript').show();
$('.simulation').hide();
$('#showInTerm').prop("disabled", false);
break;
case 'simulation':
$('.simulation').show();
$('.customscript').hide();
$('#showInTerm').prop("disabled", true);
mode = 'javascript';
break;
case 'csharp':
case 'c':
mode = 'text/x-' + mode
break;
case 'python':
getPythonMods()
break;
case 'cmd':
getCmdCommand()
break;
case 'shell':
getShellCommand()
break;
default:
$('.customscript').hide();
$('.simulation').hide();
$('#showInTerm').prop("disabled", false);
(mode == 'csharp' || mode == 'c') && (mode = 'text/x-' + mode)
break;
}
window.editor.setOption("mode", mode);