<commit_before>/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

use common::PerfLogger;
use lsp_types::request::Request;
use schema_documentation::SchemaDocumentation;

use crate::{LSPRuntimeResult, LSPState};

pub(crate) struct HeartbeatRequest;

impl Request for HeartbeatRequest {
    type Params = ();
    type Result = String;
    const METHOD: &'static str = "relay/heartbeat";
}

#[allow(clippy::unnecessary_wraps)]
pub(crate) fn on_heartbeat<
    TPerfLogger: PerfLogger + 'static,
    TSchemaDocumentation: SchemaDocumentation,
>(
    _state: &LSPState<TPerfLogger, TSchemaDocumentation>,
    _params: <HeartbeatRequest as Request>::Params,
) -> LSPRuntimeResult<<HeartbeatRequest as Request>::Result> {
    Ok("Connected.".to_string())
}<commit_msg>use GlobalState in heartbeat<commit_after>/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

use lsp_types::request::Request;

use crate::LSPRuntimeResult;

use super::GlobalState;

pub(crate) struct HeartbeatRequest;

impl Request for HeartbeatRequest {
    type Params = ();
    type Result = String;
    const METHOD: &'static str = "relay/heartbeat";
}

#[allow(clippy::unnecessary_wraps)]
pub(crate) fn on_heartbeat(
    _state: &impl GlobalState,
    _params: <HeartbeatRequest as Request>::Params,
) -> LSPRuntimeResult<<HeartbeatRequest as Request>::Result> {
    Ok("Connected.".to_string())
}
{'fraction_non_alphanumeric': 0.11409395973154363, 'fraction_numerical': 0.0, 'mean_word_length': 5.007326007326007, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2361241', 'n_tokens_mistral': 500, 'n_tokens_neox': 498, 'n_words': 147}