summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/javacs/lsp/CompletionItem.java4
-rw-r--r--src/main/java/org/javacs/lsp/LSP.java8
2 files changed, 8 insertions, 4 deletions
diff --git a/src/main/java/org/javacs/lsp/CompletionItem.java b/src/main/java/org/javacs/lsp/CompletionItem.java
index 678a535..2eab5da 100644
--- a/src/main/java/org/javacs/lsp/CompletionItem.java
+++ b/src/main/java/org/javacs/lsp/CompletionItem.java
@@ -8,9 +8,9 @@ public class CompletionItem {
public int kind;
public String detail;
public MarkupContent documentation;
- public boolean deprecated, preselect;
+ public Boolean deprecated, preselect;
public String sortText, filterText, insertText;
- public int insertTextFormat;
+ public Integer insertTextFormat;
public TextEdit textEdit;
public List<TextEdit> additionalTextEdits;
public List<Character> commitCharacters;
diff --git a/src/main/java/org/javacs/lsp/LSP.java b/src/main/java/org/javacs/lsp/LSP.java
index 8747bc1..4a46cf0 100644
--- a/src/main/java/org/javacs/lsp/LSP.java
+++ b/src/main/java/org/javacs/lsp/LSP.java
@@ -102,12 +102,16 @@ public class LSP {
}
}
+ static String toJson(Object message) {
+ return gson.toJson(message);
+ }
+
static void respond(OutputStream client, int requestId, Object params) {
if (params instanceof Optional) {
var option = (Optional) params;
params = option.orElse(null);
}
- var jsonText = gson.toJson(params);
+ var jsonText = toJson(params);
var messageText = String.format("{\"jsonrpc\":\"2.0\",\"id\":%d,\"result\":%s}", requestId, jsonText);
writeClient(client, messageText);
}
@@ -117,7 +121,7 @@ public class LSP {
var option = (Optional) params;
params = option.orElse(null);
}
- var jsonText = gson.toJson(params);
+ var jsonText = toJson(params);
var messageText = String.format("{\"jsonrpc\":\"2.0\",\"method\":\"%s\",\"params\":%s}", method, jsonText);
writeClient(client, messageText);
}