<commit_before>/*
 * Copyright (c) 2012-2018 Red Hat, Inc.
 * This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License 2.0
 * which is available at https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *   Red Hat, Inc. - initial API and implementation
 */
package org.eclipse.che.api.languageserver;

import com.google.inject.assistedinject.Assisted;
import java.util.concurrent.CompletableFuture;
import javax.inject.Inject;
import org.eclipse.che.api.core.notification.EventService;
import org.eclipse.che.api.languageserver.messager.ShowMessageJsonRpcTransmitter;
import org.eclipse.che.api.languageserver.shared.model.ExtendedPublishDiagnosticsParams;
import org.eclipse.lsp4j.MessageActionItem;
import org.eclipse.lsp4j.MessageParams;
import org.eclipse.lsp4j.PublishDiagnosticsParams;
import org.eclipse.lsp4j.ShowMessageRequestParams;
import org.eclipse.lsp4j.services.LanguageClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * A LSP language client implementation for Che
 *
 * @author <NAME>
 */
public class CheLanguageClient implements LanguageClient {
  private static final Logger LOG = LoggerFactory.getLogger(CheLanguageClient.class);

  private EventService eventService;
  private ShowMessageJsonRpcTransmitter transmitter;
  private String serverId;

  @Inject
  public CheLanguageClient(
      EventService eventService,
      ShowMessageJsonRpcTransmitter transmitter,
      @Assisted String serverId) {
    this.eventService = eventService;
    this.transmitter = transmitter;
    this.serverId = serverId;
  }

  @Override
  public void telemetryEvent(Object object) {
    LOG.info("Telemetry: {}", object);
  }

  @Override
  public CompletableFuture<MessageActionItem> showMessageRequest(
      ShowMessageRequestParams requestParams) {
    return transmitter.sendShowMessageRequest(requestParams);
  }

  @Override
  public void showMessage(MessageParams messageParams) {
    eventService.publish(messageParams);<commit_msg>Log telemetry in debug only to reduce load,<commit_after>/*
 * Copyright (c) 2012-2018 Red Hat, Inc.
 * This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License 2.0
 * which is available at https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *   Red Hat, Inc. - initial API and implementation
 */
package org.eclipse.che.api.languageserver;

import com.google.inject.assistedinject.Assisted;
import java.util.concurrent.CompletableFuture;
import javax.inject.Inject;
import org.eclipse.che.api.core.notification.EventService;
import org.eclipse.che.api.languageserver.messager.ShowMessageJsonRpcTransmitter;
import org.eclipse.che.api.languageserver.shared.model.ExtendedPublishDiagnosticsParams;
import org.eclipse.lsp4j.MessageActionItem;
import org.eclipse.lsp4j.MessageParams;
import org.eclipse.lsp4j.PublishDiagnosticsParams;
import org.eclipse.lsp4j.ShowMessageRequestParams;
import org.eclipse.lsp4j.services.LanguageClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * A LSP language client implementation for Che
 *
 * @author <NAME>
 */
public class CheLanguageClient implements LanguageClient {
  private static final Logger LOG = LoggerFactory.getLogger(CheLanguageClient.class);

  private EventService eventService;
  private ShowMessageJsonRpcTransmitter transmitter;
  private String serverId;

  @Inject
  public CheLanguageClient(
      EventService eventService,
      ShowMessageJsonRpcTransmitter transmitter,
      @Assisted String serverId) {
    this.eventService = eventService;
    this.transmitter = transmitter;
    this.serverId = serverId;
  }

  @Override
  public void telemetryEvent(Object object) {
    LOG.debug("Telemetry: {}", object);
  }

  @Override
  public CompletableFuture<MessageActionItem> showMessageRequest(
      ShowMessageRequestParams requestParams) {
    return transmitter.sendShowMessageRequest(requestParams);
  }

  @Override
  public void showMessage(MessageParams messageParams) {
    eventService.publish(messageParams);
{'fraction_non_alphanumeric': 0.0859880239520958, 'fraction_numerical': 0.010059880239520959, 'mean_word_length': 4.982808022922636, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2775984', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1181, 'n_words': 274}