use of org.eclipse.lsp4j.VersionedTextDocumentIdentifier in project vscode-nextgenas by BowlerHatLLC.
the class ActionScriptTextDocumentService method didChange.
/**
* Called when a change is made to a file open for editing in Visual Studio
* Code. Receives incremental changes that need to be applied to the
* in-memory String that we store for this file.
*/
@Override
public void didChange(DidChangeTextDocumentParams params) {
VersionedTextDocumentIdentifier textDocument = params.getTextDocument();
String textDocumentUri = textDocument.getUri();
if (!textDocumentUri.endsWith(AS_EXTENSION) && !textDocumentUri.endsWith(MXML_EXTENSION)) {
return;
}
Path path = LanguageServerUtils.getPathFromLanguageServerURI(textDocumentUri);
if (path != null) {
for (TextDocumentContentChangeEvent change : params.getContentChanges()) {
if (change.getRange() == null) {
sourceByPath.put(path, change.getText());
} else {
String existingText = sourceByPath.get(path);
String newText = patch(existingText, change);
sourceByPath.put(path, newText);
}
}
if (currentWorkspace != null) {
IFileSpecification fileSpec = fileSpecGetter.getFileSpecification(path.toAbsolutePath().toString());
currentWorkspace.fileChanged(fileSpec);
}
//we do a quick check of the current file on change for better
//performance while typing. we'll do a full check when we save the
//file later
checkFilePathForProblems(path, true);
}
}
Aggregations