@Override public boolean visit(MoveTargetEdit edit) { try { if (edit.getSourceEdit() != null) { org.eclipse.lsp4j.TextEdit te = new org.eclipse.lsp4j.TextEdit(); te.setRange(JDTUtils.toRange(compilationUnit, edit.getOffset(), edit.getLength())); Document doc = new Document(compilationUnit.getSource()); edit.apply(doc, TextEdit.UPDATE_REGIONS); String content = doc.get(edit.getSourceEdit().getOffset(), edit.getSourceEdit().getLength()); if (edit.getSourceEdit().getSourceModifier() != null) { content = applySourceModifier(content, edit.getSourceEdit().getSourceModifier()); } te.setNewText(content); converted.add(te); return false; // do not visit children } } catch (MalformedTreeException | BadLocationException | CoreException e) { JavaLanguageServerPlugin.logException("Error converting TextEdits", e); } return super.visit(edit); }