use of org.eclipse.lsp4j.RenameParams in project xtext-core by eclipse.
the class RenameTest2 method testRenameContainer.
@Test
public void testRenameContainer() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package foo");
_builder.newLine();
_builder.newLine();
_builder.append("element Foo {");
_builder.newLine();
_builder.append(" ");
_builder.append("element Bar {");
_builder.newLine();
_builder.append(" ");
_builder.append("}");
_builder.newLine();
_builder.append(" ");
_builder.append("ref foo.Foo.Bar");
_builder.newLine();
_builder.append(" ");
_builder.append("ref Foo.Bar");
_builder.newLine();
_builder.append(" ");
_builder.append("ref Bar");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final String model = _builder.toString();
final String file = this.writeFile("foo/Foo.fileawaretestlanguage", model);
this.initialize();
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(file);
Position _position = new Position(2, 9);
final RenameParams params = new RenameParams(_textDocumentIdentifier, _position, "Baz");
final WorkspaceEdit workspaceEdit = this.languageServer.rename(params).get();
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("changes :");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("Foo.fileawaretestlanguage : Baz [[2, 8] .. [2, 11]]");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("Bar [[5, 5] .. [5, 16]]");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("Bar [[6, 5] .. [6, 12]]");
_builder_1.newLine();
_builder_1.append("documentChanges : ");
_builder_1.newLine();
this.assertEquals(_builder_1.toString(), this.toExpectation(workspaceEdit));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.lsp4j.RenameParams in project xtext-core by eclipse.
the class RenameTest2 method testRenameSelfRef.
@Test
public void testRenameSelfRef() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package foo");
_builder.newLine();
_builder.newLine();
_builder.append("element Foo {");
_builder.newLine();
_builder.append(" ");
_builder.append("ref Foo");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final String model = _builder.toString();
final String file = this.writeFile("foo/Foo.fileawaretestlanguage", model);
this.initialize();
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(file);
Position _position = new Position(2, 9);
final RenameParams params = new RenameParams(_textDocumentIdentifier, _position, "Bar");
final WorkspaceEdit workspaceEdit = this.languageServer.rename(params).get();
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("changes :");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("Foo.fileawaretestlanguage : Bar [[2, 8] .. [2, 11]]");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("Bar [[3, 5] .. [3, 8]]");
_builder_1.newLine();
_builder_1.append("documentChanges : ");
_builder_1.newLine();
this.assertEquals(_builder_1.toString(), this.toExpectation(workspaceEdit));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.lsp4j.RenameParams in project xtext-core by eclipse.
the class RenameTest method doTest.
protected void doTest(final String fileName, final Position position) {
try {
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileName);
final RenameParams params = new RenameParams(_textDocumentIdentifier, position, "Tescht");
final WorkspaceEdit workspaceEdit = this.languageServer.rename(params).get();
StringConcatenation _builder = new StringConcatenation();
_builder.append("changes :");
_builder.newLine();
_builder.append("\t");
_builder.append("MyType1.testlang : Tescht [[0, 5] .. [0, 9]]");
_builder.newLine();
_builder.append("\t");
_builder.append("Tescht [[1, 4] .. [1, 8]]");
_builder.newLine();
_builder.append("\t");
_builder.append("MyType2.testlang : Tescht [[1, 4] .. [1, 8]]");
_builder.newLine();
_builder.append("documentChanges : ");
_builder.newLine();
this.assertEquals(_builder.toString(), this.toExpectation(workspaceEdit));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
Aggregations