langium icon indicating copy to clipboard operation
langium copied to clipboard

[3.2] TextDocuments is no longer compatible with NotebookDocument

Open cdietrich opened this issue 1 year ago • 2 comments

in our dsl we also support notebook. in order to achive that we do something like this in our module

createXxxxxSharedModule(
.....
workspace: {
    NotebookDocument: services => new NotebookDocumentsImpl(new NotebookDocuments(services.workspace.TextDocuments))
}

this does not compile anymore

Argument of type 'TextDocumentProvider & TextDocuments<TextDocument>' is not assignable to parameter of type 'TextDocumentsConfiguration<TextDocument> | TextDocuments<TextDocument>'.
  Type 'TextDocumentProvider & TextDocuments<TextDocument>' is missing the following properties from type 'TextDocuments<TextDocument>': _configuration, _syncedDocuments, _onDidChangeContent, _onDidOpen, and 4 more.

casting fails at runtime

Could not find service instance for uri: 'vscode-notebook-cell:/Users/xxxx/zzz/test.ournb#W2sZmlsZQ%3D%3D'

we did not debug the 2nd part yet. assume we need to debug that one though. maybe the uri conversion needs to happen at more places

cdietrich avatar Sep 18 '24 14:09 cdietrich

i assume that the

shared.workspace.NotebookDocument.listen(connection)

we do completely bypasses normalization and uses the original text documents

cdietrich avatar Sep 18 '24 14:09 cdietrich

I believe it would be best if we were to implement our own NotebookDocuments service similar to the TextDocuments. I'm not a big fan of how the NotebookDocumentsImpl is implemented, given that it directly targets a class (and not an interface).

msujew avatar Sep 18 '24 14:09 msujew