File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ export class DocumentLoadError extends Error {
2121export async function loadDocument (
2222 fileName : string ,
2323 pluginModelFiles : string [ ] = [ ] ,
24+ keepImports : boolean = false ,
2425) : Promise <
2526 { success : true ; model : Model ; warnings : string [ ] , services : ZModelServices } | { success : false ; errors : string [ ] ; warnings : string [ ] }
2627> {
@@ -109,14 +110,17 @@ export async function loadDocument(
109110
110111 const model = document . parseResult . value as Model ;
111112
112- // merge all declarations into the main document
113- const imported = mergeImportsDeclarations ( langiumDocuments , model ) ;
113+ if ( keepImports === false ) {
114+
115+ // merge all declarations into the main document
116+ const imported = mergeImportsDeclarations ( langiumDocuments , model ) ;
114117
115118 // remove imported documents
116119 imported . forEach ( ( model ) => {
117- langiumDocuments . deleteDocument ( model . $document ! . uri ) ;
118- services . shared . workspace . IndexManager . remove ( model . $document ! . uri ) ;
119- } ) ;
120+ langiumDocuments . deleteDocument ( model . $document ! . uri ) ;
121+ services . shared . workspace . IndexManager . remove ( model . $document ! . uri ) ;
122+ } ) ;
123+ }
120124
121125 // extra validation after merging imported declarations
122126 const additionalErrors = validationAfterImportMerge ( model ) ;
You can’t perform that action at this time.
0 commit comments