Add utility to print trace line in LSP server output.
Signed-off-by: KtorZ <matthias.benkort@gmail.com>
This commit is contained in:
parent
1e64dc9aeb
commit
c3f571334c
|
@ -9,7 +9,7 @@ mod edits;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
mod quickfix;
|
mod quickfix;
|
||||||
pub mod server;
|
pub mod server;
|
||||||
mod utils;
|
pub mod utils;
|
||||||
|
|
||||||
#[allow(clippy::result_large_err)]
|
#[allow(clippy::result_large_err)]
|
||||||
pub fn start() -> Result<(), Error> {
|
pub fn start() -> Result<(), Error> {
|
||||||
|
|
|
@ -1,13 +1,26 @@
|
||||||
use crate::error::Error;
|
use crate::error::Error;
|
||||||
use aiken_lang::{ast::Span, line_numbers::LineNumbers};
|
use aiken_lang::{ast::Span, line_numbers::LineNumbers};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use lsp_types::TextEdit;
|
use lsp_types::{notification::Notification, TextEdit};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use urlencoding::decode;
|
use urlencoding::decode;
|
||||||
|
|
||||||
pub const COMPILING_PROGRESS_TOKEN: &str = "compiling-aiken";
|
pub const COMPILING_PROGRESS_TOKEN: &str = "compiling-aiken";
|
||||||
pub const CREATE_COMPILING_PROGRESS_TOKEN: &str = "create-compiling-progress-token";
|
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 {
|
pub fn text_edit_replace(new_text: String) -> TextEdit {
|
||||||
TextEdit {
|
TextEdit {
|
||||||
range: lsp_types::Range {
|
range: lsp_types::Range {
|
||||||
|
|
Loading…
Reference in New Issue