Java Code Examples for org.eclipse.lsp4j.MessageType#Warning
The following examples show how to use
org.eclipse.lsp4j.MessageType#Warning .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultLanguageClient.java From lsp4intellij with Apache License 2.0 | 6 votes |
@Override public void logMessage(MessageParams messageParams) { String message = messageParams.getMessage(); MessageType msgType = messageParams.getType(); if (msgType == MessageType.Error) { LOG.error(message); } else if (msgType == MessageType.Warning) { LOG.warn(message); } else if (msgType == MessageType.Info) { LOG.info(message); } if (msgType == MessageType.Log) { LOG.debug(message); } else { LOG.warn("Unknown message type for " + message); } }
Example 2
Source File: DefaultLanguageClient.java From lsp4intellij with Apache License 2.0 | 5 votes |
@Override public CompletableFuture<MessageActionItem> showMessageRequest(ShowMessageRequestParams showMessageRequestParams) { List<MessageActionItem> actions = showMessageRequestParams.getActions(); String title = "Language Server message"; String message = showMessageRequestParams.getMessage(); MessageType msgType = showMessageRequestParams.getType(); Icon icon; if (msgType == MessageType.Error) { icon = UIUtil.getErrorIcon(); } else if (msgType == MessageType.Warning) { icon = UIUtil.getWarningIcon(); } else if (msgType == MessageType.Info) { icon = UIUtil.getInformationIcon(); } else if (msgType == MessageType.Log) { icon = UIUtil.getInformationIcon(); } else { icon = null; LOG.warn("No message type for " + message); } List<String> titles = new ArrayList<>(); for (MessageActionItem item : actions) { titles.add(item.getTitle()); } FutureTask<Integer> task = new FutureTask<>( () -> Messages.showDialog(message, title, (String[]) titles.toArray(), 0, icon)); ApplicationManager.getApplication().invokeAndWait(task); int exitCode = 0; try { exitCode = task.get(); } catch (InterruptedException | ExecutionException e) { LOG.warn(e.getMessage()); } return CompletableFuture.completedFuture(new MessageActionItem(actions.get(exitCode).getTitle())); }
Example 3
Source File: LSPClientLogHandler.java From lemminx with Eclipse Public License 2.0 | 5 votes |
private static MessageType getMessageType(Level level) { if (level == Level.WARNING) { return MessageType.Warning; } if (level == Level.SEVERE) { return MessageType.Error; } return MessageType.Info; }
Example 4
Source File: LogHandler.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
private MessageType getMessageTypeFromSeverity(int severity) { switch (severity) { case IStatus.ERROR: return MessageType.Error; case IStatus.WARNING: return MessageType.Warning; case IStatus.INFO: return MessageType.Info; default: return MessageType.Log; } }