File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,9 +33,10 @@ export async function loadDocument(
3333 fileName : string ,
3434 additionalModelFiles : string [ ] = [ ] ,
3535 mergeImports : boolean = true ,
36+ returnPartialModelForError : boolean = false ,
3637) : Promise <
3738 | { success : true ; model : Model ; warnings : string [ ] ; services : ZModelServices }
38- | { success : false ; errors : string [ ] ; warnings : string [ ] }
39+ | { success : false ; model ?: Model ; errors : string [ ] ; warnings : string [ ] }
3940> {
4041 const { ZModelLanguage : services } = createZModelServices ( false ) ;
4142 const extensions = services . LanguageMetaData . fileExtensions ;
@@ -116,6 +117,7 @@ export async function loadDocument(
116117 if ( errors . length > 0 ) {
117118 return {
118119 success : false ,
120+ model : returnPartialModelForError ? ( document . parseResult . value as Model ) : undefined ,
119121 errors,
120122 warnings,
121123 } ;
@@ -139,6 +141,7 @@ export async function loadDocument(
139141 if ( additionalErrors . length > 0 ) {
140142 return {
141143 success : false ,
144+ model : returnPartialModelForError ? ( document . parseResult . value as Model ) : undefined ,
142145 errors : additionalErrors ,
143146 warnings,
144147 } ;
You can’t perform that action at this time.
0 commit comments