File tree Expand file tree Collapse file tree
src/vs/workbench/contrib/notebook/browser Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ import { IModeService } from 'vs/editor/common/services/modeService';
2727import { IDisposable } from 'vs/base/common/lifecycle' ;
2828import { assertType } from 'vs/base/common/types' ;
2929import { parse } from 'vs/base/common/marshalling' ;
30- import { CellUri } from 'vs/workbench/contrib/notebook/common/notebookCommon' ;
30+ import { CellUri , CellKind } from 'vs/workbench/contrib/notebook/common/notebookCommon' ;
3131import { ResourceMap } from 'vs/base/common/map' ;
3232
3333// Output renderers registration
@@ -177,10 +177,11 @@ class CellContentProvider implements ITextModelContentProvider {
177177 }
178178 for ( let cell of notebook . cells ) {
179179 if ( cell . uri . toString ( ) === resource . toString ( ) ) {
180- let bufferFactory = cell . resolveTextBufferFactory ( ) ;
180+ const bufferFactory = cell . resolveTextBufferFactory ( ) ;
181+ const language = cell . cellKind === CellKind . Markdown ? this . _modeService . create ( 'markdown' ) : ( cell . language ? this . _modeService . create ( cell . language ) : this . _modeService . createByFilepathOrFirstLine ( resource , cell . source [ 0 ] ) ) ;
181182 return this . _modelService . createModel (
182183 bufferFactory ,
183- cell . language ? this . _modeService . create ( cell . language ) : this . _modeService . createByFilepathOrFirstLine ( resource , cell . source [ 0 ] ) ,
184+ language ,
184185 resource
185186 ) ;
186187 }
You can’t perform that action at this time.
0 commit comments