mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
fix #72632
This commit is contained in:
parent
01a5a52ac5
commit
dcd7b52172
|
@ -870,13 +870,20 @@ export abstract class TextFileService extends Disposable implements ITextFileSer
|
|||
return false;
|
||||
}
|
||||
|
||||
// take over encoding and model value from source model
|
||||
// take over encoding, mode and model value from source model
|
||||
targetModel.updatePreferredEncoding(sourceModel.getEncoding());
|
||||
if (targetModel.textEditorModel) {
|
||||
const snapshot = sourceModel.createSnapshot();
|
||||
if (snapshot) {
|
||||
this.modelService.updateModel(targetModel.textEditorModel, createTextBufferFactoryFromSnapshot(snapshot));
|
||||
}
|
||||
|
||||
if (sourceModel.textEditorModel) {
|
||||
const language = sourceModel.textEditorModel.getLanguageIdentifier();
|
||||
if (language.id > 1) {
|
||||
targetModel.textEditorModel.setMode(language); // only use if more specific than plain/text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// save model
|
||||
|
|
Loading…
Reference in a new issue