From b11a18d7f10441e5a73593c61ac714ee9b808182 Mon Sep 17 00:00:00 2001 From: George Fraser Date: Sun, 30 Dec 2018 14:29:16 -0800 Subject: Gson doesn't like anon objects --- src/main/java/org/javacs/JavaLanguageServer.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/javacs/JavaLanguageServer.java b/src/main/java/org/javacs/JavaLanguageServer.java index c7b475a..3b3bdab 100644 --- a/src/main/java/org/javacs/JavaLanguageServer.java +++ b/src/main/java/org/javacs/JavaLanguageServer.java @@ -209,14 +209,12 @@ class JavaLanguageServer extends LanguageServer { this.compiler = createCompiler(); // Register for didChangeWatchedFiles notifications - var options = - new Object() { - public List watchers = - List.of( - new Object() { - public String globPattern = "**/*.java"; - }); - }; + var options = new JsonObject(); + var watchers = new JsonArray(); + var watchJava = new JsonObject(); + watchJava.addProperty("globPattern", "**/*.java"); + watchers.add(watchJava); + options.add("watchers", watchers); client.registerCapability("workspace/didChangeWatchedFiles", gson.toJsonTree(options)); } -- cgit v1.2.3