org.eclipse.lsp4j.MessageType#Info ( )源码实例Demo

下面列出了org.eclipse.lsp4j.MessageType#Info ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: lsp4intellij   文件: DefaultLanguageClient.java
@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);
    }
}
 
源代码2 项目: lsp4intellij   文件: DefaultLanguageClient.java
@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()));
}
 
源代码3 项目: lemminx   文件: LSPClientLogHandler.java
private static MessageType getMessageType(Level level) {
	if (level == Level.WARNING) {
		return MessageType.Warning;
	}
	if (level == Level.SEVERE) {
		return MessageType.Error;
	}
	return MessageType.Info;
}
 
源代码4 项目: lemminx   文件: LimitExceededWarner.java
/**
 * Send limit exceeded warning to client
 * 
 * @param uri         the file uri
 * @param resultLimit the result limit
 * @param feature     the feature 
 */
private void sendLimitExceededWarning(String uri, int resultLimit, LimitFeature feature) {
	String filename = Paths.get(URI.create(uri)).getFileName().toString();
	String message = filename != null ? filename + ": " : "";
	message += "For performance reasons, " + feature.getName() + " have been limited to " + resultLimit
			+ " items.\nIf a new limit is set, please close and reopen this file to recompute " + feature.getName() + ".";

	// create command that opens the settings UI on the client side, in order to
	// quickly edit the setting
	Command command = new Command("Configure limit", ClientCommands.OPEN_SETTINGS,
			Collections.singletonList(feature.getSettingId()));
	
	super.sendNotification(message, MessageType.Info ,command);
}
 
源代码5 项目: eclipse.jdt.ls   文件: LogHandler.java
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;
	}
}
 
 同类方法