Skip to content
Discussion options

You must be logged in to vote

I've figured out that build and update work in combination for me:

let ws = services.sharedServices.workspace;
const referenceAST = extractReferencesToAST(externalModel)

let referencesDocument = 
    ws.LangiumDocumentFactory.fromModel(referenceAST, pathToRefs);

if (ws.LangiumDocuments.hasDocument(pathToRefs)) {
    ws.DocumentBuilder.update([], [pathToRefs]);
} 
await ws.DocumentBuilder.build(
    [referencesDocument], 
    {validationChecks: 'all'}
);
ws.LangiumDocuments.addDocument(referencesDocument);

So once I tell DocumentBuilder i want to remove the existing external model, the "update" succeeds.

Thanks for the tip with build.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@bjthehun
Comment options

@bjthehun
Comment options

@msujew
Comment options

@bjthehun
Comment options

Answer selected by bjthehun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants