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