minor lsp tweaks

- forcibly disable colors
  - do not show labels in error messages
This commit is contained in:
KtorZ 2023-03-29 18:25:16 +02:00
parent aa29636d50
commit efa31e3df7
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
2 changed files with 6 additions and 12 deletions

View File

@ -16,6 +16,9 @@ use crate::server::Server;
pub fn start() -> Result<(), Error> {
tracing::info!("Aiken language server starting");
// Forcibly disable colors on outputs for LSP
owo_colors::set_override(false);
let root = env::current_dir()?;
let config = if paths::project_config().exists() {

View File

@ -589,7 +589,7 @@ impl Server {
),
};
let mut text = match error.source() {
let message = match error.source() {
Some(err) => err.to_string(),
None => error.to_string(),
};
@ -598,15 +598,6 @@ impl Server {
(error.labels(), error.path(), error.src())
{
if let Some(labeled_span) = labels.next() {
if let Some(label) = labeled_span.label() {
text.push_str("\n\n");
text.push_str(label);
if !label.ends_with(['.', '?']) {
text.push('.');
}
}
let line_numbers = LineNumbers::new(&src);
let lsp_diagnostic = lsp_types::Diagnostic {
@ -623,7 +614,7 @@ impl Server {
.map(|c| lsp_types::NumberOrString::String(c.to_string())),
code_description: None,
source: None,
message: text.clone(),
message,
related_information: None,
tags: None,
data: None,
@ -645,7 +636,7 @@ impl Server {
}
} else {
self.stored_messages
.push(lsp_types::ShowMessageParams { typ, message: text })
.push(lsp_types::ShowMessageParams { typ, message })
}
Ok(())