Temp disable old err mapping
This commit is contained in:
@@ -6,7 +6,7 @@ use std::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use cargo_metadata::{CompilerMessage, Message};
|
use cargo_metadata::{CompilerMessage, Message};
|
||||||
use mist_parser::rev_mapper::{RustMap, find_mapping, get_mapping};
|
use mist_parser::rev_mapper::{self, RustMap, find_mapping};
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct MistDiagnosticMessage {
|
pub struct MistDiagnosticMessage {
|
||||||
@@ -39,7 +39,7 @@ pub fn build(mut args: Vec<String>, root: PathBuf) -> Vec<MistDiagnostic> {
|
|||||||
|
|
||||||
let mut diagnostics = Vec::new();
|
let mut diagnostics = Vec::new();
|
||||||
|
|
||||||
let mut mapping = HashMap::new();
|
let mut mapping: HashMap<rev_mapper::RustMap, rev_mapper::MistMap> = HashMap::new();
|
||||||
|
|
||||||
let mist_src = format!(".mist{MAIN_SEPARATOR}lsp");
|
let mist_src = format!(".mist{MAIN_SEPARATOR}lsp");
|
||||||
|
|
||||||
@@ -64,44 +64,44 @@ pub fn build(mut args: Vec<String>, root: PathBuf) -> Vec<MistDiagnostic> {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
let map = mapping.entry(rust_path.clone()).or_insert_with(|| {
|
// let map = mapping.entry(rust_path.clone()).or_insert_with(|| {
|
||||||
get_mapping(
|
// get_mapping(
|
||||||
&fs::read_to_string(rust_path)
|
// &fs::read_to_string(rust_path)
|
||||||
.expect("Failed to read file for mapping"),
|
// .expect("Failed to read file for mapping"),
|
||||||
)
|
// )
|
||||||
});
|
// });
|
||||||
|
|
||||||
let mist_span =
|
// let mist_span =
|
||||||
find_mapping(&map, &RustMap(span.line_end, span.column_start))
|
// find_mapping(&map, &RustMap(span.line_end, span.column_start))
|
||||||
.expect("Unable to find mapping");
|
// .expect("Unable to find mapping");
|
||||||
|
|
||||||
let mist_msg = MistDiagnosticMessage {
|
// let mist_msg = MistDiagnosticMessage {
|
||||||
message: format!(
|
// message: format!(
|
||||||
"{}: {}",
|
// "{}: {}",
|
||||||
msg.message.message,
|
// msg.message.message,
|
||||||
span.label.clone().unwrap_or_default()
|
// span.label.clone().unwrap_or_default()
|
||||||
),
|
// ),
|
||||||
file_name: if is_root {
|
// file_name: if is_root {
|
||||||
mist_file
|
// mist_file
|
||||||
} else {
|
// } else {
|
||||||
mist_path.to_string_lossy().to_string()
|
// mist_path.to_string_lossy().to_string()
|
||||||
},
|
// },
|
||||||
file_path: mist_path,
|
// file_path: mist_path,
|
||||||
line: mist_span.1.0,
|
// line: mist_span.1.0,
|
||||||
column: mist_span.1.1,
|
// column: mist_span.1.1,
|
||||||
};
|
// };
|
||||||
|
|
||||||
match msg.message.level {
|
// match msg.message.level {
|
||||||
cargo_metadata::diagnostic::DiagnosticLevel::Error => {
|
// cargo_metadata::diagnostic::DiagnosticLevel::Error => {
|
||||||
diagnostics.push(MistDiagnostic::Error(mist_msg))
|
// diagnostics.push(MistDiagnostic::Error(mist_msg))
|
||||||
}
|
// }
|
||||||
|
|
||||||
cargo_metadata::diagnostic::DiagnosticLevel::Warning => {
|
// cargo_metadata::diagnostic::DiagnosticLevel::Warning => {
|
||||||
diagnostics.push(MistDiagnostic::Warning(mist_msg))
|
// diagnostics.push(MistDiagnostic::Warning(mist_msg))
|
||||||
}
|
// }
|
||||||
|
|
||||||
_ => {}
|
// _ => {}
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-12
@@ -167,10 +167,10 @@ impl LanguageServer for Backend {
|
|||||||
.insert(file.clone(), Rope::from_str(&text));
|
.insert(file.clone(), Rope::from_str(&text));
|
||||||
|
|
||||||
// store mapping
|
// store mapping
|
||||||
mapping
|
// mapping
|
||||||
.lock()
|
// .lock()
|
||||||
.await
|
// .await
|
||||||
.insert(rust_path, rev_mapper::get_mapping(&transpiled));
|
// .insert(rust_path, rev_mapper::get_mapping(&transpiled));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -311,10 +311,10 @@ impl LanguageServer for Backend {
|
|||||||
|
|
||||||
params.text_document.uri = Url::from_file_path(&rust_path).unwrap();
|
params.text_document.uri = Url::from_file_path(&rust_path).unwrap();
|
||||||
|
|
||||||
self.mapping.lock().await.insert(
|
// self.mapping.lock().await.insert(
|
||||||
rust_path,
|
// rust_path,
|
||||||
rev_mapper::get_mapping(¶ms.text_document.text),
|
// rev_mapper::get_mapping(¶ms.text_document.text),
|
||||||
);
|
// );
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
self.client
|
self.client
|
||||||
@@ -353,10 +353,10 @@ impl LanguageServer for Backend {
|
|||||||
Ok(transpiled_text) => {
|
Ok(transpiled_text) => {
|
||||||
change.text = transpiled_text;
|
change.text = transpiled_text;
|
||||||
|
|
||||||
self.mapping
|
// self.mapping
|
||||||
.lock()
|
// .lock()
|
||||||
.await
|
// .await
|
||||||
.insert(rust_path, rev_mapper::get_mapping(&change.text));
|
// .insert(rust_path, rev_mapper::get_mapping(&change.text));
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
self.client
|
self.client
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ pub fn build(mut args Vec<String>, root PathBuf) bool {
|
|||||||
|
|
||||||
let mut diagnostics = Vec::new();
|
let mut diagnostics = Vec::new();
|
||||||
|
|
||||||
let mut mapping = HashMap::new();
|
let mut mapping HashMap<rev_mapper::RustMap, rev_mapper::MistMap> = HashMap::new();
|
||||||
|
|
||||||
let mist_src = format!(".mist{MAIN_SEPARATOR}src");
|
let mist_src = format!(".mist{MAIN_SEPARATOR}src");
|
||||||
|
|
||||||
@@ -70,45 +70,45 @@ pub fn build(mut args Vec<String>, root PathBuf) bool {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
let map = mapping.entry(rust_path.clone()).or_insert_with(fn() {
|
// let map = mapping.entry(rust_path.clone()).or_insert_with(fn() {
|
||||||
rev_mapper::get_mapping(
|
// rev_mapper::get_mapping(
|
||||||
&fs::read_to_string(rust_path)
|
// &fs::read_to_string(rust_path)
|
||||||
.expect("Failed to read file for mapping")
|
// .expect("Failed to read file for mapping")
|
||||||
)
|
// )
|
||||||
});
|
// });
|
||||||
|
|
||||||
let [_, rev_mapper::MistMap[line, column]] =
|
// let [_, rev_mapper::MistMap[line, column]] =
|
||||||
rev_mapper::find_mapping(&map, &rev_mapper::RustMap(span.line_end, span.column_start))
|
// rev_mapper::find_mapping(&map, &rev_mapper::RustMap(span.line_end, span.column_start))
|
||||||
.expect("Unable to find mapping");
|
// .expect("Unable to find mapping");
|
||||||
|
|
||||||
let mist_msg = MistDiagnosticMessage {
|
// let mist_msg = MistDiagnosticMessage {
|
||||||
message: format!(
|
// message: format!(
|
||||||
"{}: {}",
|
// "{}: {}",
|
||||||
msg.message.message,
|
// msg.message.message,
|
||||||
span.label.clone().unwrap_or_default()
|
// span.label.clone().unwrap_or_default()
|
||||||
),
|
// ),
|
||||||
file_name: if is_root {
|
// file_name: if is_root {
|
||||||
(); // TODO: fix this
|
// (); // TODO: fix this
|
||||||
mist_file
|
// mist_file
|
||||||
} else {
|
// } else {
|
||||||
mist_path.to_string_lossy().to_string()
|
// mist_path.to_string_lossy().to_string()
|
||||||
},
|
// },
|
||||||
file_path: mist_path,
|
// file_path: mist_path,
|
||||||
line: line,
|
// line: line,
|
||||||
column: column
|
// column: column
|
||||||
};
|
// };
|
||||||
|
|
||||||
match msg.message.level {
|
// match msg.message.level {
|
||||||
cargo_metadata::diagnostic::DiagnosticLevel::Error => {
|
// cargo_metadata::diagnostic::DiagnosticLevel::Error => {
|
||||||
diagnostics.push(MistDiagnostic::Error(mist_msg))
|
// diagnostics.push(MistDiagnostic::Error(mist_msg))
|
||||||
}
|
// }
|
||||||
|
|
||||||
cargo_metadata::diagnostic::DiagnosticLevel::Warning => {
|
// cargo_metadata::diagnostic::DiagnosticLevel::Warning => {
|
||||||
diagnostics.push(MistDiagnostic::Warning(mist_msg))
|
// diagnostics.push(MistDiagnostic::Warning(mist_msg))
|
||||||
}
|
// }
|
||||||
|
|
||||||
_ => {}
|
// _ => {}
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user