Add utility to print trace line in LSP server output.

Signed-off-by: KtorZ <matthias.benkort@gmail.com>
This commit is contained in:
KtorZ 2025-02-22 19:00:40 +01:00
parent 1e64dc9aeb
commit c3f571334c
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
2 changed files with 15 additions and 2 deletions

View File

@ -9,7 +9,7 @@ mod edits;
pub mod error;
mod quickfix;
pub mod server;
mod utils;
pub mod utils;
#[allow(clippy::result_large_err)]
pub fn start() -> Result<(), Error> {

View File

@ -1,13 +1,26 @@
use crate::error::Error;
use aiken_lang::{ast::Span, line_numbers::LineNumbers};
use itertools::Itertools;
use lsp_types::TextEdit;
use lsp_types::{notification::Notification, TextEdit};
use std::path::{Path, PathBuf};
use urlencoding::decode;
pub const COMPILING_PROGRESS_TOKEN: &str = "compiling-aiken";
pub const CREATE_COMPILING_PROGRESS_TOKEN: &str = "create-compiling-progress-token";
/// Trace some information from the server.
pub fn debug(connection: &lsp_server::Connection, message: impl serde::ser::Serialize) {
connection
.sender
.send(lsp_server::Message::Notification(
lsp_server::Notification {
method: lsp_types::notification::LogTrace::METHOD.to_string(),
params: serde_json::json! {{ "message": message }},
},
))
.expect("failed to send notification");
}
pub fn text_edit_replace(new_text: String) -> TextEdit {
TextEdit {
range: lsp_types::Range {