Add option to keep current source on lang change

Closes #1604
This commit is contained in:
RabsRincon
2019-12-24 12:33:32 +01:00
parent ae354a318e
commit 5924fd3bc7
3 changed files with 6 additions and 1 deletions

View File

@@ -944,7 +944,7 @@ Editor.prototype.onLanguageChange = function (newLangId) {
if (newLangId !== this.currentLanguage.id) {
var oldLangId = this.currentLanguage.id;
this.currentLanguage = languages[newLangId];
if (!this.waitingForLanguage) {
if (!this.waitingForLanguage && !this.settings.keepSourcesOnLangChange) {
this.editorSourceByLang[oldLangId] = this.getSource();
this.updateEditorCode();
}

View File

@@ -229,6 +229,7 @@ function setupSettings(root, settings, onChange, subLangId) {
add(root.find('.editorsFLigatures'), 'editorsFLigatures', false, Checkbox);
add(root.find('.allowStoreCodeDebug'), 'allowStoreCodeDebug', true, Checkbox);
add(root.find('.useVim'), 'useVim', false, Checkbox);
add(root.find('.keepSourcesOnLangChange'), 'keepSourcesOnLangChange', false, Checkbox);
setSettings(settings);
handleThemes();

View File

@@ -145,6 +145,10 @@
label
input.showMinimap(type="checkbox")
| Show editor minimap
.checkbox
label
input.keepSourcesOnLangChange(type="checkbox")
| Keep editor source on language change
div
label
|  Tab width