ecode: More LSP WIP. Send partial changes in textDocument/didChange. Parsed more protocol features.

This commit is contained in:
Martín Lucas Golini
2022-11-02 03:04:52 -03:00
parent 5c46540f8e
commit 37e946f452
15 changed files with 321 additions and 70 deletions

View File

@@ -15,9 +15,11 @@ LSPDocumentClient::LSPDocumentClient( LSPClientServer* server, TextDocument* doc
LSPDocumentClient::~LSPDocumentClient() {}
void LSPDocumentClient::onDocumentTextChanged() {
void LSPDocumentClient::onDocumentTextChanged( const DocumentContentChange& change ) {
mModified = true;
++mVersion;
if ( !change.text.empty() || change.range.start() != change.range.end() )
mDocChange.push_back( change );
mLastModified.restart();
}
@@ -64,6 +66,14 @@ int LSPDocumentClient::getVersion() const {
return mVersion;
}
const std::vector<DocumentContentChange>& LSPDocumentClient::getDocChange() const {
return mDocChange;
}
void LSPDocumentClient::clearDocChange() {
mDocChange.clear();
}
void LSPDocumentClient::notifyOpen() {
eeASSERT( mDoc );
mServer->didOpen( mDoc, ++mVersion );