mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
move diagnostics to a separate file
This commit is contained in:
parent
e4a6343e47
commit
8328e196dd
2 changed files with 22 additions and 27 deletions
|
@ -1,13 +1,8 @@
|
||||||
use hir::{
|
use hir::{Problem, source_binder};
|
||||||
self, Problem, source_binder
|
use ra_ide_api_light::Severity;
|
||||||
};
|
|
||||||
use ra_ide_api_light::{self, LocalEdit, Severity};
|
|
||||||
use ra_db::SourceDatabase;
|
use ra_db::SourceDatabase;
|
||||||
|
|
||||||
use crate::{
|
use crate::{db, Diagnostic, FileId, FileSystemEdit, SourceChange};
|
||||||
db, Diagnostic, FileId, FilePosition, FileSystemEdit,
|
|
||||||
SourceChange, SourceFileEdit,
|
|
||||||
};
|
|
||||||
|
|
||||||
impl db::RootDatabase {
|
impl db::RootDatabase {
|
||||||
pub(crate) fn diagnostics(&self, file_id: FileId) -> Vec<Diagnostic> {
|
pub(crate) fn diagnostics(&self, file_id: FileId) -> Vec<Diagnostic> {
|
||||||
|
@ -74,20 +69,3 @@ impl db::RootDatabase {
|
||||||
res
|
res
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SourceChange {
|
|
||||||
pub(crate) fn from_local_edit(file_id: FileId, edit: LocalEdit) -> SourceChange {
|
|
||||||
let file_edit = SourceFileEdit {
|
|
||||||
file_id,
|
|
||||||
edit: edit.edit,
|
|
||||||
};
|
|
||||||
SourceChange {
|
|
||||||
label: edit.label,
|
|
||||||
source_file_edits: vec![file_edit],
|
|
||||||
file_system_edits: vec![],
|
|
||||||
cursor_position: edit
|
|
||||||
.cursor_position
|
|
||||||
.map(|offset| FilePosition { offset, file_id }),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -14,7 +14,6 @@
|
||||||
#![recursion_limit = "128"]
|
#![recursion_limit = "128"]
|
||||||
|
|
||||||
mod db;
|
mod db;
|
||||||
mod imp;
|
|
||||||
pub mod mock_analysis;
|
pub mod mock_analysis;
|
||||||
mod symbol_index;
|
mod symbol_index;
|
||||||
mod navigation_target;
|
mod navigation_target;
|
||||||
|
@ -32,6 +31,7 @@ mod parent_module;
|
||||||
mod references;
|
mod references;
|
||||||
mod impls;
|
mod impls;
|
||||||
mod assists;
|
mod assists;
|
||||||
|
mod diagnostics;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod marks;
|
mod marks;
|
||||||
|
@ -58,7 +58,7 @@ pub use crate::{
|
||||||
change::{AnalysisChange, LibraryData},
|
change::{AnalysisChange, LibraryData},
|
||||||
};
|
};
|
||||||
pub use ra_ide_api_light::{
|
pub use ra_ide_api_light::{
|
||||||
Fold, FoldKind, HighlightedRange, Severity, StructureNode,
|
Fold, FoldKind, HighlightedRange, Severity, StructureNode, LocalEdit,
|
||||||
LineIndex, LineCol, translate_offset_with_edit,
|
LineIndex, LineCol, translate_offset_with_edit,
|
||||||
};
|
};
|
||||||
pub use ra_db::{
|
pub use ra_db::{
|
||||||
|
@ -399,6 +399,23 @@ impl Analysis {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl SourceChange {
|
||||||
|
pub(crate) fn from_local_edit(file_id: FileId, edit: LocalEdit) -> SourceChange {
|
||||||
|
let file_edit = SourceFileEdit {
|
||||||
|
file_id,
|
||||||
|
edit: edit.edit,
|
||||||
|
};
|
||||||
|
SourceChange {
|
||||||
|
label: edit.label,
|
||||||
|
source_file_edits: vec![file_edit],
|
||||||
|
file_system_edits: vec![],
|
||||||
|
cursor_position: edit
|
||||||
|
.cursor_position
|
||||||
|
.map(|offset| FilePosition { offset, file_id }),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn analysis_is_send() {
|
fn analysis_is_send() {
|
||||||
fn is_send<T: Send>() {}
|
fn is_send<T: Send>() {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue