Skip to content

Include DidChangeTextDocumentParams in documents.onDidChangeContent #473

@Jma353

Description

@Jma353

Would it be possible to pass additional data (e.g. document content changes) to the TextDocuments callback onDidChangeContent, preferably data from DidChangeTextDocumentParams (passed to the server in connection's onDidChangeTextDocument callback)?

Right now, TextDocumentChangeEvent is limited, as it just returns the document, not the change that hit the document. Additionally, if one wishes to subscribe to document changes w/Range's returned for each change, and one also wishes to keep synchronized TextDocuments, there's really no way to do this.

Currently, the only way one can extract Range-based changes for documents is by declaring a connection.onDidChangeTextDocument callback. Two issues arise with this:

// Issue 1: User-defined callback is overridden, by 
// https://github.com/Microsoft/vscode-languageserver-node/blob/master/server/src/main.ts#L255-L269
connection.onDidChangeTextDocument = mySpecialCallback;
documents.listen(connection);

// Issue 2: User-defined callback overrides document-synchronization 
// logic linked above
documents.listen(connection);
connection.onDidChangeTextDocument = mySpecialCallback;

Any advice regarding this?

BTW - happy to instrument this change myself if there's buy-in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    info-neededIssue requires more information from poster

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions