use of org.eclipse.lsp4j.DidChangeWatchedFilesParams in project xtext-core by eclipse.
the class ServerTest method testIncrementalDeletion.
@Test
public void testIncrementalDeletion() {
String model = "type Test {\n" + " NonExisting foo\n" + "}\n";
String path = writeFile("MyType1.testlang", model);
initialize();
assertEquals("Couldn't resolve reference to TypeDeclaration 'NonExisting'.", getFirstDiagnostic().getMessage());
deleteFile("MyType1.testlang");
languageServer.getWorkspaceService().didChangeWatchedFiles(new DidChangeWatchedFilesParams(Lists.newArrayList(new FileEvent(path, FileChangeType.Deleted))));
Assert.assertTrue(Iterables.getFirst(getDiagnostics().values(), null).isEmpty());
}
use of org.eclipse.lsp4j.DidChangeWatchedFilesParams in project xtext-core by eclipse.
the class IndexOnlyProjectTest method testIncrementalBuildNoValidation.
/**
* Shows that the resource is not validated during incremental build
*/
@Test
public void testIncrementalBuildNoValidation() {
writeFile("MyType1.testlang", "type Test { NonExisting foo }");
initialize();
Assert.assertTrue(Joiner.on(",").join(getDiagnostics().entrySet()), getDiagnostics().isEmpty());
String path = writeFile("MyType2.testlang", "type NonExisting {}");
languageServer.getWorkspaceService().didChangeWatchedFiles(new DidChangeWatchedFilesParams(Lists.newArrayList(new FileEvent(path, FileChangeType.Created))));
Assert.assertTrue(Joiner.on(",").join(getDiagnostics().entrySet()), getDiagnostics().isEmpty());
}
use of org.eclipse.lsp4j.DidChangeWatchedFilesParams in project sts4 by spring-projects.
the class LanguageServerHarness method changeFile.
public synchronized void changeFile(String uri) {
FileEvent fileEvent = new FileEvent(uri, FileChangeType.Changed);
getServer().getWorkspaceService().didChangeWatchedFiles(new DidChangeWatchedFilesParams(Arrays.asList(fileEvent)));
}
use of org.eclipse.lsp4j.DidChangeWatchedFilesParams in project eclipse.jdt.ls by eclipse.
the class WorkspaceEventHandlerTest method testChangeWorkingCopy.
@Test
public void testChangeWorkingCopy() throws Exception {
importProjects("eclipse/hello");
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("hello");
// IJavaProject javaProject = JavaCore.create(project);
IFile file = project.getFile("src/org/sample/Foo.java");
ICompilationUnit unit = (ICompilationUnit) JavaCore.create(file);
String source = unit.getSource();
openDocument(unit, source, 1);
File projectFile = project.getRawLocation().toFile();
File classFile = new File(projectFile, "bin/org/sample/Foo.class");
long lastModified = classFile.lastModified();
assertTrue(lastModified > 0);
source = source.replace("world", "world2");
File javaFile = new File(projectFile, "src/org/sample/Foo.java");
FileUtils.writeStringToFile(javaFile, source);
String uri = JDTUtils.toURI(unit);
DidChangeWatchedFilesParams params = new DidChangeWatchedFilesParams(Arrays.asList(new FileEvent(uri, FileChangeType.Changed)));
new WorkspaceEventsHandler(projectsManager, javaClient, lifeCycleHandler).didChangeWatchedFiles(params);
waitForBackgroundJobs();
assertTrue(classFile.lastModified() > lastModified);
}
Aggregations