File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
server/src/main/kotlin/org/javacs/kt/progress Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ import org.eclipse.lsp4j.WorkDoneProgressNotification
7
7
import org.eclipse.lsp4j.WorkDoneProgressBegin
8
8
import org.eclipse.lsp4j.WorkDoneProgressReport
9
9
import org.eclipse.lsp4j.WorkDoneProgressEnd
10
+ import org.eclipse.lsp4j.WorkDoneProgressCreateParams
11
+ import java.util.concurrent.CompletableFuture
12
+ import java.util.UUID
10
13
11
14
class LanguageClientProgress (
12
15
private val label : String ,
@@ -34,4 +37,15 @@ class LanguageClientProgress(
34
37
private fun reportProgress (notification : WorkDoneProgressNotification ) {
35
38
client.notifyProgress(ProgressParams (token, notification))
36
39
}
40
+
41
+ class Factory (private val client : LanguageClient ) : Progress.Factory {
42
+ override fun create (label : String ): CompletableFuture <Progress > {
43
+ val token = Either .forLeft<String , Number >(UUID .randomUUID().toString())
44
+ return client
45
+ .createProgress(WorkDoneProgressCreateParams ().also {
46
+ it.token = token
47
+ })
48
+ .thenApply { LanguageClientProgress (label, token, client) }
49
+ }
50
+ }
37
51
}
You can’t perform that action at this time.
0 commit comments