JaroslavTulach commented on a change in pull request #2549:
URL: https://github.com/apache/netbeans/pull/2549#discussion_r527843020



##########
File path: java/java.lsp.server/vscode/src/test/suite/extension.test.ts
##########
@@ -21,4 +28,56 @@ suite('Extension Test Suite', () => {
                }
                assert.ok(cannotReassignVersion, "Cannot reassign value of 
version");
        });
+       test("Compile workspace", async () => {
+               let folder: string = assertWorkspace();
+
+               fs.writeFileSync(path.join(folder, 'pom.xml'), `
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.netbeans.demo.vscode.t1</groupId>
+    <artifactId>basicapp</artifactId>
+    <version>1.0</version>
+    <properties>
+        <maven.compiler.source>1.8</maven.compiler.source>
+        <maven.compiler.target>1.8</maven.compiler.target>
+    </properties>
+</project>
+               `);
+
+               let pkg = path.join(folder, 'src', 'main', 'java', 'pkg');
+               let mainJava = path.join(pkg, 'Main.java');
+
+               fs.mkdirSync(pkg, { recursive: true });
+               fs.writeFileSync(mainJava, `
+package pkg;
+class Main {
+       public static void main(String... args) {
+               System.out.println("Hello World!");
+       }
+}
+               `);
+
+               vscode.workspace.saveAll();
+
+               let delayPromise = new Promise((r) => setTimeout(r, 20000));
+               vscode.window.showInformationMessage('Invoking compile 
command');
+               await vscode.commands.executeCommand("java.workspace.compile");

Review comment:
       Can you help, @dbalek? I need to wait for the `java.workspace.compile` 
task to finish and just using `await` isn't enough.  Instead I have to 
`setTimeout(_, 20s)` and that isn't pretty at all.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to