syncContent method

void syncContent(
  1. String path,
  2. String content,
  3. String languageId
)

Syncs in-memory content for path (omp's syncContent): opens the document when untracked, otherwise sends a full-content textDocument/didChange with a bumped version.

Implementation

void syncContent(String path, String content, String languageId) {
  final uri = fileToUri(path);
  final version = openFiles[uri];
  if (version == null) {
    ensureOpen(path, content, languageId);
    return;
  }
  final next = version + 1;
  notify('textDocument/didChange', {
    'textDocument': {'uri': uri, 'version': next},
    'contentChanges': [
      {'text': content},
    ],
  });
  openFiles[uri] = next;
}