use of org.eclipse.lsp4j.TextDocumentIdentifier in project xtext-core by eclipse.
the class PrepareRenameTest method testPrepareRenameFqn_end_ok.
@Test
public void testPrepareRenameFqn_end_ok() throws Exception {
String model = "package foo.bar {\n" + " type A {\n" + " foo.bar.MyType bar\n" + " }\n" + " type MyType { }\n" + "}\n";
initializeWithPrepareSupport();
String uri = writeFile("my-type-valid.testlang", model);
PrepareRenameParams params = new PrepareRenameParams(new TextDocumentIdentifier(uri), new Position(2, 18));
Range range = languageServer.prepareRename(params).get().getLeft();
assertEquals("MyType", new Document(0, model).getSubstring(range));
}
use of org.eclipse.lsp4j.TextDocumentIdentifier in project xtext-core by eclipse.
the class PrepareRenameTest method testPrepareRenameFqn_missing_file_null.
@Test
public void testPrepareRenameFqn_missing_file_null() throws Exception {
String uri = uriExtensions.toUriString(new File("missing." + fileExtension).toURI().normalize());
initializeWithPrepareSupport();
PrepareRenameParams params = new PrepareRenameParams(new TextDocumentIdentifier(uri), new Position(2, 5));
Assert.assertNull(languageServer.prepareRename(params).get());
}
use of org.eclipse.lsp4j.TextDocumentIdentifier in project xtext-core by eclipse.
the class PrepareRenameTest method testPrepareRenameFqn_end_null.
@Test
public void testPrepareRenameFqn_end_null() throws Exception {
String model = "package foo.bar {\n" + " type A {\n" + " foo.bar.MyType bar\n" + " }\n" + " type MyType { }\n" + "}\n";
initialize();
String uri = writeFile("my-type-valid.testlang", model);
PrepareRenameParams params = new PrepareRenameParams(new TextDocumentIdentifier(uri), new Position(2, 18));
Assert.assertNull(languageServer.prepareRename(params).get());
}
use of org.eclipse.lsp4j.TextDocumentIdentifier in project xtext-core by eclipse.
the class PrepareRenameTest method testPrepareRenameFqn_before_nok.
@Test
public void testPrepareRenameFqn_before_nok() throws Exception {
String model = "package foo.bar {\n" + " type A {\n" + " foo.bar.MyType bar\n" + " }\n" + " type MyType { }\n" + "}\n";
initializeWithPrepareSupport();
String uri = writeFile("my-type-valid.testlang", model);
PrepareRenameParams params = new PrepareRenameParams(new TextDocumentIdentifier(uri), new Position(2, 11));
Assert.assertNull(languageServer.prepareRename(params).get());
}
use of org.eclipse.lsp4j.TextDocumentIdentifier in project xtext-core by eclipse.
the class PrepareRenameTest method testRenameFqn_invalid_null.
@Test
public void testRenameFqn_invalid_null() throws Exception {
String model = "package foo.bar {\n" + " type A {\n" + " foo.bar.MyType bar\n" + " }\n" + " type MyType { }\n" + "}\n";
String uri = writeFile("my-type-invalid.testlang", model);
initializeWithPrepareSupport();
RenameParams params = new RenameParams(new TextDocumentIdentifier(uri), new Position(2, 5), "Does not matter");
Assert.assertNull(languageServer.rename(params).get());
}
Aggregations