protected void writeContents(final JsonWriter out, final Either<List<Either<String, MarkedString>>, MarkupContent> contents) throws IOException { boolean _isLeft = contents.isLeft(); if (_isLeft) { final List<Either<String, MarkedString>> list = contents.getLeft(); int _size = list.size(); boolean _equals = (_size == 1); if (_equals) { this.gson.toJson(list.get(0), HoverTypeAdapter.STRING_MARKEDSTRING.getType(), out); } else { this.gson.toJson(list, HoverTypeAdapter.LIST_STRING_MARKEDSTRING.getType(), out); } } else { this.gson.toJson(contents.getRight(), MarkupContent.class, out); } }
private void writeIntId(JsonWriter out, Either<String, Number> id) throws IOException { if (id == null) writeNullValue(out); else if (id.isLeft()) out.value(Integer.parseInt(id.getLeft())); else if (id.isRight()) out.value(id.getRight()); } }
@Override public boolean handleResult( ExtendedLanguageServer element, List<Either<Command, CodeAction>> res) { for (Either<Command, CodeAction> cmd : res) { if (cmd.isLeft()) { result.add(new CommandDto(cmd.getLeft())); } else { // see https://github.com/eclipse/che/issues/11140 LOG.warn("Ignoring code action: {}", cmd.getRight()); } } return false; } };
public boolean isSecond() { return isRight() && getRight().isLeft(); }
public boolean isSecond() { return isRight() && getRight().isLeft(); }
public String getId() { if (id == null) return null; if (id.isLeft()) return id.getLeft(); if (id.isRight()) return id.getRight().toString(); return null; }
public String getResponseId() { if (responseId == null) return null; if (responseId.isLeft()) return responseId.getLeft(); if (responseId.isRight()) return responseId.getRight().toString(); return null; }
public String getId() { if (id == null) return null; if (id.isLeft()) return id.getLeft(); if (id.isRight()) return id.getRight().toString(); return null; }
private TextDocumentSyncKind getDocumentSyncMode() { if (initResult!=null) { Either<TextDocumentSyncKind, TextDocumentSyncOptions> mode = initResult.getCapabilities().getTextDocumentSync(); if (mode.isLeft()) { return mode.getLeft(); } else { throw new IllegalStateException("Harness doesn't support fancy Sync options yet!"); } } return TextDocumentSyncKind.None; }
public String getId() { if (id == null) return null; if (id.isLeft()) return id.getLeft(); if (id.isRight()) return id.getRight().toString(); return null; }
protected void writeId(JsonWriter out, Either<String, Number> id) throws IOException { if (id == null) writeNullValue(out); else if (id.isLeft()) out.value(id.getLeft()); else if (id.isRight()) out.value(id.getRight()); }
protected void writeId(JsonWriter out, Either<String, Number> id) throws IOException { if (id == null) writeNullValue(out); else if (id.isLeft()) out.value(id.getLeft()); else if (id.isRight()) out.value(id.getRight()); }
@Override public void write(JsonWriter out, Either<L, R> value) throws IOException { if (value == null) { out.nullValue(); } else if (value.isLeft()) { left.write(out, value.getLeft()); } else { right.write(out, value.getRight()); } }
@NonNull public String getId() { if (id == null) return null; if (id.isLeft()) return id.getLeft(); if (id.isRight()) return id.getRight().toString(); return null; }
@NonNull public String getId() { if (id == null) return null; if (id.isLeft()) return id.getLeft(); if (id.isRight()) return id.getRight().toString(); return null; }
@Override public void write(JsonWriter out, Either<L, R> value) throws IOException { if (value == null) { out.nullValue(); } else if (value.isLeft()) { left.write(out, value.getLeft()); } else { right.write(out, value.getRight()); } }
private <T> boolean isImplemented(Either<Boolean, T> capability) { if (capability.isLeft()) { return truish(capability.getLeft()); } else { return capability.getRight() != null; } } }
public static String getDocString(CompletionItem completion) { if (completion!=null) { Either<String, MarkupContent> doc = completion.getDocumentation(); if (doc.isLeft()) { return doc.getLeft(); } else { return doc.getRight().getValue(); } } return null; }
@Override public void onSelectionChanged(PreviewNode selectedNode) { Either<ResourceChange, TextEdit> data = selectedNode.getData(); if (data != null && data.isLeft()) { view.showDiff(null); return; } List<TextEdit> edits = collectTextEditsForSelectedNode(selectedNode); updateContentInCompareWidget(selectedNode, edits); }
public CompletionList getCompletions(TextDocumentInfo doc, Position cursor) throws Exception { CompletionParams params = new CompletionParams(); params.setPosition(cursor); params.setTextDocument(doc.getId()); waitForReconcile(); Either<List<CompletionItem>, CompletionList> completions = getServer().getTextDocumentService().completion(params).get(); if (completions.isLeft()) { List<CompletionItem> list = completions.getLeft(); return new CompletionList(false, list); } else /* sompletions.isRight() */ { return completions.getRight(); } }