File tree Expand file tree Collapse file tree
src/vs/workbench/services/textfile/common Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -870,13 +870,20 @@ export abstract class TextFileService extends Disposable implements ITextFileSer
870870 return false ;
871871 }
872872
873- // take over encoding and model value from source model
873+ // take over encoding, mode and model value from source model
874874 targetModel . updatePreferredEncoding ( sourceModel . getEncoding ( ) ) ;
875875 if ( targetModel . textEditorModel ) {
876876 const snapshot = sourceModel . createSnapshot ( ) ;
877877 if ( snapshot ) {
878878 this . modelService . updateModel ( targetModel . textEditorModel , createTextBufferFactoryFromSnapshot ( snapshot ) ) ;
879879 }
880+
881+ if ( sourceModel . textEditorModel ) {
882+ const language = sourceModel . textEditorModel . getLanguageIdentifier ( ) ;
883+ if ( language . id > 1 ) {
884+ targetModel . textEditorModel . setMode ( language ) ; // only use if more specific than plain/text
885+ }
886+ }
880887 }
881888
882889 // save model
You can’t perform that action at this time.
0 commit comments